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
/** | |
* Disallow special characters in BuddyPres username. | |
*/ | |
add_filter( 'bp_core_validate_user_signup', function ( $results ) { | |
if ( empty( $results ) || empty( $results['errors'] ) ) { | |
return $results; | |
} | |
$username = $results['user_name']; |
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
// For Group creation. | |
add_action( 'groups_action_sort_creation_steps', function () { | |
$allowed_length = 225; // how may characters are allowed? | |
$step = wp_unslash( bp_action_variable( 1 ) ); | |
if ( empty( $_POST['save'] ) ) { | |
return; | |
} |
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
// custom sorting of member types on registration page | |
// by the creation order in member types pro plugin. | |
add_filter( 'bp_xprofile_member_type_field_allowed_types', function ( $member_types, $registered_types ) { | |
if ( empty( $member_types ) || ! function_exists( 'bpmtp_get_active_member_type_entries' ) ) { | |
return $member_types; | |
} | |
// find all our active types(Member Types Pro plugin) | |
$active_type_objects = bpmtp_get_active_member_type_entries(); | |
// sort by post_id(it is similar to creation order) |
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
/** | |
* Shortcode to sum all the values of the given xprofile field. | |
* | |
* @param int|string $field field id or name. | |
* | |
* Example 1:- Total Cows owned by our members [xprofile-field-sum field="Number of Cows you Own"] | |
* Example 2:- Total Cows owned by our members [xprofile-field-sum field=32] | |
*/ | |
add_shortcode( 'xprofile-field-sum', function ( $atts = array(), $content = '' ) { |
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 | |
/** | |
* Filters Users based on Gender. Make sure only users of same genders are visible. | |
*/ | |
class BuddyDev_Same_Gender_Based_Member_Filter { | |
/** | |
* Boot | |
* | |
* @return BuddyDev_Same_Gender_Based_Member_Filter |
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
/** | |
* Filter BuddyPress multi select value and add spans around for custom styling. | |
* | |
* @see https://buddydev.com/support/forums/topic/add-extra-css-on-a-profile-field/ | |
*/ | |
add_filter( 'bp_get_the_profile_field_value', function ( $value ) { | |
global $field; | |
if ( empty( $field ) || 'multiselectbox' !== $field->type ) { | |
return $value; | |
} |
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
/** | |
* Get time/count for the user | |
* | |
* @param int $user_id user id. | |
* | |
* @return array | |
*/ | |
function buddydev_get_activity_mtype_based_rates( $user_id ) { |
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 | |
/** | |
* BuddyPress - Members Profile Loop | |
* | |
* @package BuddyPress | |
* @subpackage bp-legacy | |
* @version 3.0.0 | |
*/ | |
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */ |
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
/** | |
* Redirect after successful upload of profile photo on BuddyPress. | |
*/ | |
class BP_Profile_Photo_Successful_Upload_Redirection_Helper { | |
/** | |
* Singleton instance. | |
* | |
* @var BP_Profile_Photo_Successful_Upload_Redirection_Helper |
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
/** | |
* BuddyPress Moderation Tools:- White List users | |
* | |
* All contents from whitelisted users are disabled from reporting. | |
*/ | |
add_filter( 'bpmts_is_user_whitelisted', function ( $is, $user_id ) { | |
$white_listed_user_ids = [ 1, 2, 3 ];// add your own ids. | |
if ( in_array( $user_id, $white_listed_user_ids ) ) { |
NewerOlder