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 have added new fields on the user profile page.

I want to display a message that says: "It's good ... or not"

I couldn't find a hook in the WordPress codex.

I don't want to use a plugin only my own code I want change this code :

<div id="message" class="updated">
    <p><strong>Updated profile </strong></p>
    </div>
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

You will have to use a gettext filter as there are no hooks or filters associated with your request.

function custom_user_message($translation, $text){
    if('Profile updated.' == $text){
        $current_user = wp_get_current_user();
        $foo_condition = ''; //Do some checking here for user custom field
        if(!$foo_condition)
            return $text.' Custom Message';
    }
    return $translation;
}
add_filter( 'gettext', 'custom_user_message', 10, 2 );
share|improve this answer
    
Yes, thanks i try this way :) –  Mepps Dec 28 '11 at 12:01
add comment

I know this is old but it could help others. There is actually an action to use with this: admin_notices. Here is the link to it on the Codex

Here is how you would use it:

function my_admin_notice(){
    echo '<div class="updated">
       <p>Aenean eros ante, porta commodo lacinia.</p>
    </div>';
}
add_action('admin_notices', 'my_admin_notice');
share|improve this answer
add comment

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.