BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Upload content only users or modeators #43489

    Hello Carlo,

    Thank you for the acknowledgment. I am glad that I could help you.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BuddyPress User Profile Tabs Creator Pro #43488

    Hello Nancy,

    Please try after deactivating the “BuddyPress User Profile Tabs Creator Pro” plugin and then try to access the restricted tab i.e. Timeline, Connections, and Profile Visitors.

    You can deactivate the plugin from the Dashboard > Plugins > Installed Plugin page.

    Please let me know if it helps or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] How can I follow my affiliateWP referrer? #43479

    Hello Renatt,

    Try the following code. It will make the user to auto-follow referer user when the referral status changes to complete.

    
    add_action( 'affwp_complete_referral', function ( $referral_id ) {
    
    	if ( ! function_exists( 'affwp_get_referral_by' ) || ! function_exists( 'bp_is_following' ) ) {
    		return;
    	}
    
    	//$customer_id = bp_loggedin_user_id();
    	$referral = affwp_get_referral( $referral_id );
    
    	// Should we also need to check the status of referral.
    	if ( ! $referral || ! $referral->affiliate_id || ! $referral->customer_id ) {
    		return;
    	}
    
    	$affiliate_user_id = affwp_get_affiliate_user_id( $referral->affiliate_id );
    	$customer          = affwp_get_customer( $referral->customer_id );
    
    	if ( ! $customer ) {
    		return;
    	}
    
    	$args = array(
    		'leader_id'   => $affiliate_user_id,
    		'follower_id' => $customer->user_id,
    	);
    
    	if ( ! bp_is_following( $args ) ) {
    		bp_start_following( $args );
    	}
    }, 100 );
    
    

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BuddyPress User Profile Tabs Creator Pro #43478

    Hello Nancy,

    Try after deactivating the BuddyPress Users Profile Tabs Creator plugin. it might be conflicting. Please let me know if it helps or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BuddyPress User Circles – Change Title/Heading #43477

    Hello Mark,

    Thank you for posting here. Yes, you can use any translator plugin to translate or rename any string. You can use the loco translate plugin to translate this.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Upload content only users or modeators #43457

    Hello Carlo,

    Please try the following code in your active theme functions.php file or bp-custom.php file

    
    add_filter( 'mpp_user_can_create_gallery', function( $can_create, $component, $component_id ) {
    	if ( 'groups' != $component ) {
    		return $can_create;
    	}
    
    	if ( groups_is_user_admin( get_current_user_id(), $component_id ) ) {
    		return true;
    	}
    
    	return false;
    }, 10, 3 );
    
    add_filter( 'mpp_user_can_upload', function ( $can_upload, $component, $component_id ) {
    	if ( 'groups' != $component ) {
    		return $can_upload;
    	}
    
    	if ( groups_is_user_admin( get_current_user_id(), $component_id ) ) {
    		return true;
    	}
    
    	return false;
    }, 10, 3 );
    
    

    Please let me know if it helps or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Pay Per Post by selling access with WooCommerce #43456

    Hello Tosin,

    Thank you for the acknowledgment.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BuddyPress User Profile Tabs Creator Pro #43448

    Hello Nancy,

    Please try the following code:

    
    add_action( 'bp_template_redirect', function () {
    	// Return if not on user page.
    	if ( ! bp_is_user() ) {
    		return;
    	}
    
    	// Either user activity page or user friends page need to check access.
    	$needs_access_check = bp_is_user_activity() || bp_is_user_friends();
    
    	// If on visitor tab to check accessibility.
    	if ( ! $needs_access_check && bp_is_current_component( 'visitors' ) ) {
    		$needs_access_check = true;
    	}
    
    	// Return if no need to check user accessibility.
    	if ( ! $needs_access_check ) {
    		return;
    	}
    
    	// Currently, Logged-in user roles.
    	$user_roles = is_user_logged_in() ? wp_get_current_user()->roles : array();
    
    	// Replace editor with your role.
    	$allowed_roles     = array( 'administrator', 'editor' );
    	$has_allowed_roles = array_intersect( $allowed_roles, $user_roles );
    
    	// Redirect if not allowed.
    	if ( ! $has_allowed_roles ) {
    		// Provide page in case to redirect to custom page.
    		$redirect_page_id = 0;
    		$redirect_to      = empty( $redirect_page_id ) ? bp_displayed_user_domain() : get_permalink( $redirect_page_id );
    
    		bp_core_add_message( __( 'You are not allowed to access this page.' ) );
    		bp_core_redirect( $redirect_to );
    	}
    });
    
    

    You can place is code in ‘bp-custom.php’ file

    For more info: https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/

    Note: Please make sure that the default user tab is set other than ‘Timeline’, ‘Connections’, and ‘Profile Views’

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Directed back to profile after edit #43447

    Hello Carsten,

    Thank you for the acknowledgment. I am glad that I could help you.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Directed back to profile after edit #43281

    Hello Carsten,

    Check the following code:

    
    add_action( 'xprofile_updated_profile', function ( $user_id, $posted_field_ids, $errors ) {
    
        if ( ! $errors ) {
            bp_core_add_message( __( 'Changes saved.', 'buddypress' ) );
            bp_core_redirect( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() );
        }
    
    }, 10, 3 );
    
    

    But it is not a good user experience.

    Regards
    Ravi