Created
April 5, 2023 02:44
-
-
Save cryptexvinci/f0c3266163244944016b1efbf9f440ec to your computer and use it in GitHub Desktop.
Set the default value for private messaging option on user register or add.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set the default value for private messaging option on user register or add. | |
* @param int $user_id The ID of the newly registered user. | |
* @return void | |
*/ | |
function um_change_who_can_pm_default( $user_id ) { | |
// Set the default value for private messaging option to 'friends' for the new user. | |
update_user_meta( $user_id, '_pm_who_can', 'friends' ); | |
} | |
add_action( 'user_register', 'um_change_who_can_pm_default', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment