Get avatar of the logged-in user in WordPress

All you need to do is pass the current users email address into the get_avatar() function. <?php $current_user = wp_get_current_user(); if ( ($current_user instanceof WP_User) ) { echo get_avatar( $current_user->user_email, 32 ); } ?> Here are some links for specifics: get_avatar(); wp_get_current_user(); A response to your new problem in the comments below: <?php echo ‘<img … Read more

Display only author posts in dashboard all posts panel

The following worked for me to show only the current user’s posts in the admin add_action( ‘load-edit.php’, ‘posts_for_current_author’ ); function posts_for_current_author() { global $user_ID; /*if current user is an ‘administrator’ do nothing*/ //if ( current_user_can( ‘add_users’ ) ) return; /*if current user is an ‘administrator’ or ‘editor’ do nothing*/ if ( current_user_can( ‘edit_others_pages’ ) ) … Read more

Display emails of users who already posted at least once

You can place following code in your functions.php file & use the shortcode [myblogwriters min_posts=”1″] anywhere in the page/post content and can also change the min_posts value 🙂 function show_min_one_post_writers($atts){ global $wpdb; $attrs = shortcode_atts( array( ‘min_posts’ => ” ), $atts ); $min_posts = $attrs[‘min_posts’]; $authors = $wpdb->get_col(“SELECT `post_author` FROM (SELECT `post_author`, COUNT(*) AS `count` … Read more

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