invite_user

Fires immediately after a user is invited to join a site, but before the notification is sent.

Description

do_action( 'invite_user', (int) $user_id, (array) $role, (string) $newuser_key ); 

Parameters (3)

0. $user_id (int)
The invited user's ID.
1. $role (array)
The role of invited user.
2. $newuser_key (string)
The key of the invitation.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'invite_user', $user_id, $role, $newuser_key ); 
The following example is for adding a hook callback.
  1. // define the invite_user callback 
  2. function action_invite_user( $user_id, $role, $newuser_key ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'invite_user', 'action_invite_user', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'invite_user', 'action_invite_user', 10, 3 ); 

Defined (1)

The action is defined in the following location(s).

/wp-admin/user-new.php  
  1. do_action( 'invite_user', $user_id, $role, $newuser_key );