Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new here, I found this spot interesting and very special. I've already found useful information through your discussions.

My first question is about user management. As Admin, I would need to display some text or notification on the dashboard of a specific user. For a "specific" user name, for example.

share|improve this question
    
Hi, med, welcome! Yes, lots of knowledge packed in almost 26k Q&A's ;) Remember to show research efforts and what have you tried (if applies) whenever making a Question. –  brasofilo Jan 13 '13 at 6:47

1 Answer 1

You can show admin notices via the admin_notices action. You can display it for a specific user by checking the contents of the global $current_user:

function wpa80367_admin_notice() {
    global $current_user;
    if ( 'someusername' == $current_user->user_login ):
        echo '<div class="updated"><p>';
        echo 'This is an admin notice just for you, someusername.';
        echo '</p></div>';
    endif;
}
add_action( 'admin_notices', 'wpa80367_admin_notice' );

You could also extend this by saving per-user notices as user metadata via add_user_meta, then checking if a user has a notice in the above function via get_user_meta.

Another option is to display messages in a Dashboard Widget rather than admin notice.

share|improve this answer
    
Thanks Milo ...so I would have to edit functions.php by adding this custom code whenever I need to display a notice to a some user ... Is there a way to submit such notices from Admin Dashboard by creating some form there ??? –  med Jan 13 '13 at 16:23
    
yes, this is just a static example. you could create a form to add user meta associated to a user (see get_users), then retrieve existing user meta in the above function. –  Milo Jan 13 '13 at 16:37
    
Great! Thanks a lot . –  med Jan 13 '13 at 16:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.