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
| /** | |
| * 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 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
| /** | |
| * 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 ) ) { |
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
| 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 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
| /** | |
| * Attach media with comments on a mediapress activity. | |
| * | |
| * @param int $comment_id comment id. | |
| * @param array $r args. | |
| * @param BP_Activity_Activity $activity activity object. | |
| */ | |
| function mpp_custom_comment_posted( $comment_id, $r, $activity ) { |
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
| /** | |
| * 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 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
| /** | |
| * Redirect user to some page on site when automatically activated and logged in. | |
| * | |
| * @param string $url url to redirect to. | |
| * @param int $user_id user id. | |
| * | |
| * @return string | |
| */ | |
| function buddydev_custom_activation_redirect( $url, $user_id ) { |
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 | |
| // your php custom code goes below this line. |
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
| /** | |
| * Add block/unblock button on single message thread. | |
| */ | |
| function buddydev_show_user_report_button_on_message_thread() { | |
| // only message involving single user can be blocked. | |
| if ( ! function_exists( 'bpmts_report_button' ) || ! bp_is_my_profile() ) { | |
| 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
| /** | |
| * Get the applicable limit for the given role. | |
| * | |
| * @param string $role role name. | |
| * | |
| * @return array | |
| */ | |
| function buddydev_custom_get_role_based_message_limit( $role ) { |
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
| class BP_Other_User_As_Profile_Field { | |
| /** | |
| * Field id, replace with actual field id. | |
| * | |
| * @var string | |
| */ | |
| private $field_id = 25; // Chang it with actual field id. |