New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello JG,

    Yes, it can be easily done. Please use the following code to redirect to home page if user is inactive.

    
    /**
     * Redirect user if account is deactivated.
     */
    function buddydev_redirect_from_inactive_users_profile() {
    	// do not redirect if not in single user page or my profile page.
    	if ( ! bp_is_user() || bp_is_my_profile() || is_super_admin() ) {
    		return;
    	}
    
    	if ( function_exists('bp_account_deactivator') && bp_account_deactivator()->is_inactive( bp_displayed_user_id() ) ) {
    		// Redirect on homepage.
    		bp_core_redirect( home_url() );
    	}
    }
    add_action( 'bp_template_redirect', 'buddydev_redirect_from_inactive_users_profile' );
    
    

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Ralph,

    I have checked the plugin and found no issue as there is no “Reply” button if activity is closed. We filter out the button on this “bp_activity_can_comment_reply” filter. Either this filter is getting modified or not fired up. Please give it a shot with default theme. There might be chance that your theme modifying this.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: two notifications when a user comments on post #23643

    Hello,

    We have updated the plugin. Please download the latest version of plugin and give it a shot. Please do let me know it it works or not. It is a bug due when blog synchronisation is on with Allow activity stream commenting on posts and comments option enabled.

    https://buddydev.com/plugins/bp-notify-post-author-blog-comment/

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello JG,

    I have check again the MemberPress code and found there is fallback membership for product group. So you are right User can still have active membership if transaction expired or refunded. Please use the following code for save bet. Now I am checking is there any active subscription for the user and then deactivating if not found any

    
    function buddydev_activtate_user( $txn ) {
    
    	if ( function_exists( 'bp_account_deactivator' ) && bp_account_deactivator()->is_inactive( $txn->user_id ) ) {
    		bp_account_deactivator()->set_active( $txn->user_id );
    	}
    }
    add_action( 'mepr-txn-status-complete', 'buddydev_activtate_user' );
    
    function buddydev_deactivtate_user( $txn ) {
    
    	if ( function_exists( 'bp_account_deactivator' ) && bp_account_deactivator()->is_active( $txn->user_id ) ) {
    		$active_subscription_count = MeprSubscription::get_all_active_by_user_id( $txn->user_id, '', '', true );
    
    		if ( empty( $active_subscription_count ) ) {
    			bp_account_deactivator()->set_inactive( $txn->user_id );
    		}
    	}
    }
    
    add_action( 'mepr-txn-status-refunded', 'buddydev_deactivtate_user', 20 );
    add_action( 'mepr-transaction-expired', 'buddydev_deactivtate_user', 20 );
    

    Please let me know if it works or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello JG,

    Try the following code. If will set user account status active on transaction completed and set inactive of refund or expired.

    
    function buddydev_activtate_user( $txn ) {
    
    	if ( function_exists( 'bp_account_deactivator' ) && bp_account_deactivator()->is_inactive( $txn->user_id ) ) {
    		bp_account_deactivator()->set_active( $txn->user_id );
    	}
    }
    add_action( 'mepr-txn-status-complete', 'buddydev_activtate_user' );
    
    function buddydev_deactivtate_user( $txn ) {
    
    	if ( function_exists( 'bp_account_deactivator' ) && bp_account_deactivator()->is_active( $txn->user_id ) ) {
    		bp_account_deactivator()->set_inactive( $txn->user_id );
    	}
    }
    
    add_action( 'mepr-txn-status-refunded', 'buddydev_deactivtate_user' );
    add_action( 'mepr-transaction-expired', 'buddydev_deactivtate_user' );
    
    

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

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

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

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

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Tosin,

    Please check the following code. remove the older code and let me know if it works or not.

    
    
    function buddydev_is_user_restricted( $user_id ) {
    	// These user's won't be able to send the message.
    	$restricted_user_ids = array( 2, 4766812, 4766806, 4766824, 4766786, 4766838 );
    
    	return in_array( $user_id, $restricted_user_ids );
    }
    
    function buddydev_start_buffering() {
    
    	if ( ! function_exists( 'bp_profile_messages_ux_init_pro' ) || ! buddydev_is_user_restricted( bp_displayed_user_id() ) ) {
    		return;
    	}
    
    	ob_start();
    }
    add_action( 'bp_member_header_actions', 'buddydev_start_buffering', 19 );
    
    function buddydev_end_buffering() {
    
    	if ( ! function_exists( 'bp_profile_messages_ux_init_pro' ) || ! buddydev_is_user_restricted( bp_displayed_user_id() ) ) {
    		return;
    	}
    
    	ob_get_clean();
    }
    add_action( 'bp_member_header_actions', 'buddydev_end_buffering', 21 );
    
    

    This will work in legacy.

    Regards
    Ravi

    • This reply was modified 7 years, 5 months ago by Ravi.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Isabel,

    Thank you for posting. Yes, it can be done easily. Please try the following code in your active theme “functions.php” file. It will change checkbox categories to drowndown category.

    
    /**
     * BuddyBlog Categories as dropdown
     *
     * @param array $settings Settings.
     *
     * @return array
     */
    function buddydev_buddyblog_categories_as_dropdown( $settings ) {
    
    	if ( empty( $settings['tax'] ) ) {
    		return $settings;
    	}
    
    	foreach ( $settings['tax'] as $taxonomy => $detail ) {
    		$settings['tax'][$taxonomy]['view_type'] = 'dd';
    	}
    
    	return $settings;
    }
    
    add_filter( 'buddyblog_post_form_settings', 'buddydev_buddyblog_categories_as_dropdown' );
    
    

    Please let me know if that works or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Branded login support #23505

    Hello Tosin,

    Please find out the following function in plugin “bl_get_error_message” and there you can modify the message.

    Regards
    Ravi