WordPress.org

Support

Support » Plugins and Hacks » What Hook do I need to use??

What Hook do I need to use??

  • I am creating a plugin for my WPMS that needs to change user meta data when a new user activates the site from the link sent by WP when the user signs up for a blog.

    add_action('wpmu_activate_user','lf_wpmu_activate_user',10,3);    
    
    function lf_wpmu_activate_user($user_id){ 
    
        $info = get_userdata($user_id);
    
        $args = array(
            'ID'=>$user_id,
            'test_meta_data' =>'this is a test',
            'show_welcome_panel' => 0
    
        );
        wp_update_user($args);
    
    }

    I can verify that the code is being read by WP with a few lines of code that writes to a file. But my function is not being fired when a user clicks on the link to activate the site.

    Am I hooking to the correct hook? Or should I be connecting to a different hook.. this seems like it should be fairly simple but it is not working.

    Thanks for the help..

Viewing 2 replies - 1 through 2 (of 2 total)
  • Tom Lynch

    @unknowndomain

    I am also having this problem, it seems that wpmu_activate_user and wpmu_activate_blog don’t get called from plugins.

    To verify I put did_action( xxxx ) at the end of wp-activate.php and confirmed it only gets called once regardless of whether I have my code or not. Looks like plugins aren’t loaded in wp-activate.php

    Can anyone suggest a solution, I had hoped that add_signup_meta would transfer any additional meta data over to the usermeta table automatically but this isn’t happening either.

    Tom Lynch

    @unknowndomain

    This issue was resolved by activating the plugin Network Wide, as the defined constant WP_INSTALLING at the top of wp-activate.php prevents plugins loading that aren’t site wide.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What Hook do I need to use??’ is closed to new replies.