WordPress.org

Ready to get started?Download WordPress

Forums

What Hook do I need to use?? (3 posts)

  1. jwhiteman67
    Member
    Posted 2 years ago #

    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..

  2. Tom Lynch
    Member
    Posted 1 year ago #

    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.

  3. Tom Lynch
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic