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
add_action('bp_ajax_querystring','bpdev_exclude_users',20,2); | |
function bpdev_exclude_users($qs=false,$object=false){ | |
//list of users to exclude | |
if($object!='members')//hide for members only | |
return $qs; | |
$excluded_user=join(',',bpdev_get_subscriber_user_ids());//comma separated ids of users whom you want to exclude | |
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
class BuddyDev_Profile_Field_Completion_Helper { | |
/** | |
* Show notice to user? | |
* | |
* @var bool | |
*/ | |
private $show_notice = true; |
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
add_filter( 'bp_core_get_active_member_count', function ( $count ) { | |
// protect from errro if plugin is disabled. | |
if ( ! class_exists( 'BPMTP_Member_Types_Pro' ) ) { | |
return $count; | |
} | |
// optimize. | |
$current_count = get_transient( 'bpmtp_all_active_members' ); | |
if ( false !== $current_count ) { |
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
/** | |
* Redirect users to login if not not logged, otherwise, redirect to user activity. | |
*/ | |
function buddydev_custom_user_home_page() { | |
if ( ! is_user_logged_in() ) { | |
bp_core_redirect( wp_login_url( site_url( '/' ) ) ); | |
} |
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 | |
// your php custom code goes below this line. |
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 |
NewerOlder