This file contains hidden or 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 | |
/** | |
* Exclude Ultimate Member pages from WP Rocket cache | |
* Add this to your theme's functions.php file or create a custom plugin | |
*/ | |
/** | |
* To disable WP Rocket cache for Ultimate Member pages. | |
* | |
* @return void |
This file contains hidden or 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 | |
/** | |
* Enable viewing of unapproved members in the member directory | |
* | |
* Hooks into the member directory query to temporarily allow all users | |
* to view unapproved members by modifying user permissions. | |
*/ | |
function um_enable_view_unapproved_members() { | |
add_filter( 'um_user_permissions_filter', 'um_allow_edit_everyone_permission' ); |
This file contains hidden or 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 | |
/** | |
* Automatically add specific users as friends when a new user registers | |
* | |
* This function hooks into the Ultimate Member user registration process | |
* and automatically creates friend connections between new users and | |
* a predefined list of existing members. | |
*/ | |
// Hook into the UM user registration process |
This file contains hidden or 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 | |
/* | |
* Adds a user to a specified group with specific details, such as the group ID, user ID, | |
* when a user registers on a website using the Ultimate Member plugin. | |
*/ | |
add_action( 'um_registration_set_extra_data', 'my_registration_set_extra_data', 10, 2 ); | |
function my_registration_set_extra_data( $user_id, $args ) { |
This file contains hidden or 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 | |
/** | |
* Exclude a specific field from the search results in the Ultimate Member directory | |
* | |
* This code prevents the 'referred_by' field from being included when users | |
* search through the members directory, while still allowing other fields | |
* to be searched normally. | |
*/ | |
/** |
This file contains hidden or 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 | |
/** | |
* Update private messaging option for all existing users. | |
* @return void | |
*/ | |
function um_update_existing_users_pm_option() { | |
// Get all existing users. | |
$users = get_users(); | |
// Loop through each user and update their private messaging option to 'friends'. |
This file contains hidden or 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' ); |
This file contains hidden or 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 | |
/** | |
* Gets the search term from the member directory search query. | |
* | |
* @return void | |
*/ | |
function um_member_directory_search_term() { | |
// Only execute on the members page. | |
if ( ! um_is_core_page( 'members' ) ) { | |
return; |
This file contains hidden or 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 default values for privacy in new accounts | |
* | |
* Set Profile Privacy = "who can see profile" to Friends only | |
*/ | |
add_action("um_registration_complete","custom_um_user_registration_complete", 1); | |
function custom_um_user_registration_complete( $user_id ){ | |
update_user_meta( $user_id, "profile_privacy", "Friends only"); | |
} |
This file contains hidden or 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 | |
add_filter( "um_view_field_value_checkbox", "my_um_view_field_value_checkbox", 10, 2 ); | |
function my_um_view_field_value_checkbox( $html, $data ) { | |
if ( $data['metakey'] != 'your_checkbox_meta_key' ) { | |
return $html; | |
} |
NewerOlder