Echo author ID in author.php

Try this code. $author = get_user_by( ‘slug’, get_query_var( ‘author_name’ ) ); echo $author->ID; Alternatively, if author name has not been set use: if ( $author_id = get_query_var( ‘author’ ) ) { $author = get_user_by( ‘id’, $author_id ); } credit @AndyAdams in the easily missed comments bellow

How to get a buddypress user profile link and a certain user profile field for the current post author?

For an author’s profile link, use bp_core_get_user_domain( $user_id ) to get the URL, and bp_core_get_userlink( $user_id ) to get an HTML link element, including display name. For the xprofile data, use xprofile_get_field_data( $field, $user_id ) $field can be either the name of the field (like ‘Biography’) or the numerical field id.

How to remove the author pages?

The above answer is good, but if redirecting to home page, it should specify a 301 status and exit after. add_action(‘template_redirect’, ‘my_custom_disable_author_page’); function my_custom_disable_author_page() { global $wp_query; if ( is_author() ) { // Redirect to homepage, set status to 301 permenant redirect. // Function defaults to 302 temporary redirect. wp_redirect(get_option(‘home’), 301); exit; } } wp_redirect() … Read more

How to get Author ID outside the loop

The simplest and most straightforward way to get the post author ID outside the loop, if you know the post ID, is to use the WordPress core function get_post_field(). $post_author_id = get_post_field( ‘post_author’, $post_id ); If you do not yet know the post ID of the page you are on, then since WP 3.1 the … Read more

How to check if a user (not current user) is logged in?

I would use transients to do this: create a user-online-update function that you hook on init; it would look something like this: // get the user activity the list $logged_in_users = get_transient(‘online_status’); // get current user ID $user = wp_get_current_user(); // check if the current user needs to update his online status; // he does … Read more

Javadoc @author tag good practices

I would say that for most purposes @author is unwanted noise. The user of your API shouldn’t – and probably doesn’t – care, or want to know, who wrote which parts. And, as you have already stated, SVN already holds this information in a much more authoritative way than the code can. So if I was one … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)