• Hi All

    I have a function which needs to be triggered once a new blog is registered.
    Can any one please let me know which action do i need to use.
    I was trying below code
    function addUserToSugarCrm($user_id){
    //Code here
    }
    add_action ( ‘wpmu_activate_user’, ‘addUserToSugarCrm’ );

    But this is not getting triggered.

    Can any one please help me out here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Looking at the hook in ms-functions.php it pulls/passes 3 args

    do_action('wpmu_activate_user', $user_id, $password, $meta);

    Therefore I think you’ll need to match priority(10) and args(3) in your add_action

    add_action ( 'wpmu_activate_user', 'addUserToSugarCrm' 10, 3);
    
    function addUserToSugarCrm($user_id, $password, $meta){
    //Code here for the $user_id, $password, and/or $meta
    }

    You say “a new blog is registered”, but I presume you mean when a new user is registered. wpmu_activate_user doesn’t fire when blogs are activated, only when a new user is activated, obviously.

    An alternative hook during user creation is the wpmu_new_user which only passes one arg, $user_id. So this might work for you, too.

    add_action ( 'wpmu_new_user', 'addUserToSugarCrm');
    
    function addUserToSugarCrm($user_id){
    //Code here that does something with the $user_id
    }

    Thread Starter latha_wp

    (@latha_wp)

    Thanks for the reply..
    I think i need this.. I will try it out…

    Thanks again

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add action at the time of new blog registration WPMU’ is closed to new replies.