• I feel like this is going to be a simple question for someone here, but I’ve been struggling with it on and off for days.

    I’m adding a profile_update action to WordPress through my theme’s functions.php file. I have custom radio buttons set up as part of my site’s registration process through a plugin, Cimy User Extra Fields. If the user has selected one of the radio buttons, I want to perform a certain action on a profile update. When the user has selected the other, I want to perform a different action.

    This works well if the user is updating an existing profile. But I want it to work on initial registration as well, and the call to the custom radio buttons don’t return anything at that point. How can I pass a value to the profile_update function in such a way that I can test for it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you set the priority on your “do_action” higher than Cimy uses (not sure what they use, the default is 10) your code would run after theirs. So Cimy would have updated the user_meta for that user by then. Then you could lookup their values in the user meta like so…

    function my_profile_update($user_id)
    {
        //Cimy should have updated "radio" in user meta by now
        $radio = get_user_meta($user_id, "radio", true);
        //... do your checks/etc ...
    }
    do_action('profile_update', 'my_profile_update', 20); //make sure 20 is higher than Cimy uses.
    Thread Starter tiszenkel

    (@tiszenkel)

    Wow, I completely forgot about this after eight months. I did solve the problem, and it was simple! All I did was attach the same action to the user_register hook.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Passing value to profile_update hook’ is closed to new replies.