invite_user
Action HookDescription
Fires immediately after an existing user is invited to join the site, but before the notification is sent.Hook Information
File Location |
wp-admin/user-new.php
View on GitHub
|
Hook Type | Action |
Line Number | 116 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$user_id
|
The invited user's ID. |
array
|
$role
|
Array containing role information for the invited user. |
string
|
$newuser_key
|
The key of the invitation. |
Usage Examples
Basic Usage
<?php
// Hook into invite_user
add_action('invite_user', 'my_custom_function', 10, 3);
function my_custom_function($user_id, $role, $newuser_key) {
// Your custom code here
}
Source Code Context
wp-admin/user-new.php:116
- How this hook is used in WordPress core
<?php
111 *
112 * @param int $user_id The invited user's ID.
113 * @param array $role Array containing role information for the invited user.
114 * @param string $newuser_key The key of the invitation.
115 */
116 do_action( 'invite_user', $user_id, $role, $newuser_key );
117
118 $switched_locale = switch_to_user_locale( $user_id );
119
120 if ( '' !== get_option( 'blogname' ) ) {
121 $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
PHP Documentation
<?php
/**
* Fires immediately after an existing user is invited to join the site, but before the notification is sent.
*
* @since 4.4.0
*
* @param int $user_id The invited user's ID.
* @param array $role Array containing role information for the invited user.
* @param string $newuser_key The key of the invitation.
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-admin/user-new.php
Related Hooks
Related hooks will be displayed here in future updates.