BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Donation feature for buddypress #40188

    Hello Tosin,

    The following code will help to render shortcode if any of the field’s data is available:

    
    
    add_filter( 'the_content', function ( $content ) {
    
    	// Our donation page link.
    	if ( ! is_page( 36918 ) || ! isset( $_GET['user_id'] ) || ! $_GET['nonce'] ) {
    		return $content;
    	}
    
    	$user = get_user_by( 'id', absint( $_GET['user_id'] ) );
    
    	if ( ! $user || ! wp_verify_nonce( $_GET['nonce'], 'donate-' . $user->ID ) ) {
    		return $content;
    	}
    
    	$bank_name               = xprofile_get_field_data( 3217, $user->ID );
    	$account_number          = xprofile_get_field_data( 3218, $user->ID );
    	$account_name            = xprofile_get_field_data( 3219, $user->ID );
    	$paystack_url            = xprofile_get_field_data( 3220, $user->ID );
    	$crypto_currency_name    = xprofile_get_field_data( 4447, $user->ID );
    	$crypto_currency_address = xprofile_get_field_data( 4446, $user->ID );
    
    	$missing_details = array();
    
    	// Replace field id with your one mandatory for donation. If empty return your message.
    	if ( empty( $bank_name ) ) {
    		$missing_details[] = __( 'Bank name has not been provided' );
    	}
    	if ( empty( $account_number ) ) {
    		$missing_details[] = __( 'Account number has not been provided' );
    	}
    	if ( empty( $account_name ) ) {
    		$missing_details[] = __( 'Account name has not been provided' );
    	}
    	if ( empty( $paystack_url ) ) {
    		$missing_details[] = __( 'Paystack URL has not been provided' );
    	}
    	if ( empty( $crypto_currency_name ) ) {
    		$missing_details[] = __( 'Cryptocurrency name has not been provided' );
    	}
    	if ( empty( $crypto_currency_address ) ) {
    		$missing_details[] = __( 'Cryptocurrency address has not been provided' );
    	}
    
    	$render_shortcode = false;
    
    	if ( $bank_name || $account_number || $account_name || $paystack_url || $crypto_currency_name || $crypto_currency_address ) {
    		$render_shortcode = true;
    	}
    
    	if ( ! $render_shortcode ) {
    		return $content . __( 'Following details are missing' ) . join( ' & ', $missing_details );
    	}
    
    	ob_start();
    
    	// Replace group_id to your group id.
    	echo do_shortcode( "[bpsc-user-avatar user_id={$user->ID} group_id=2]" );
    	echo do_shortcode( "[bpsc-user-display-name user_id={$user->ID} group_id=2]" );
    	echo do_shortcode( "[bp-shortcodes-profile user_id={$user->ID} group_id=2]" );
    
    	$shortcode_content = ob_get_clean();
    
    	return $content . $shortcode_content;
    } );
    
    

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Array text in Header Actions #40168

    Hello Carsten,

    Thank you for the acknowledgment. Yes, Array text showing on my local development server as well when I am applying some kind of restriction using the Message Control plugin.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Array text in Header Actions #40165

    Hello Carsten,

    Also, please make sure the activity component is enabled Poke works with the activity component enabled.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Array text in Header Actions #40164

    Hello Carsten,

    Please try after deactivating “BP Messaging Control” plugins and refresh caches if you are using any cache plugin.

    Regards
    Ravo

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Donation feature for buddypress #40162

    Hello Tosin,

    Try the following code:

    
    
    add_filter( 'the_content', function ( $content ) {
    
    	// Our donation page link.
    	if ( ! is_page( 36918 ) || ! isset( $_GET['user_id'] ) || ! $_GET['nonce'] ) {
    		return $content;
    	}
    
    	$user = get_user_by( 'id', absint( $_GET['user_id'] ) );
    
    	if ( ! $user || ! wp_verify_nonce( $_GET['nonce'], 'donate-' . $user->ID ) ) {
    		return $content;
    	}
    
    	$missing_details = array();
    	// Replace field id with your one mandatory for donation. If empty return your message.
    	if ( empty( xprofile_get_field_data( 3217, $user->ID ) ) ) {
    		$missing_details[] = __( 'Bank name has not been provided' );
    	}
    	if ( empty( xprofile_get_field_data( 3218, $user->ID ) ) ) {
    		$missing_details[] = __( 'Account number has not been provided' );
    	}
    	if ( empty( xprofile_get_field_data( 3219, $user->ID ) ) ) {
    		$missing_details[] = __( 'Account name has not been provided' );
    	}
    	if ( empty( xprofile_get_field_data( 3220, $user->ID ) ) ) {
    		$missing_details[] = __( 'Paystack URL has not been provided' );
    	}
    	if ( empty( xprofile_get_field_data( 4447, $user->ID ) ) ) {
    		$missing_details[] = __( 'Cryptocurrency name has not been provided' );
    	}
    	if ( empty( xprofile_get_field_data( 4446, $user->ID ) ) ) {
    		$missing_details[] = __( 'Cryptocurrency address has not been provided' );
    	}
    
    	if ( ! empty( $missing_details ) ) {
    		return $content . __( 'Following details are missing' ) . join( ' & ', $missing_details );
    	}
    
    	ob_start();
    
    	// Replace group_id to your group id.
    	echo do_shortcode( "[bpsc-user-avatar user_id={$user->ID} group_id=2]" );
    	echo do_shortcode( "[bpsc-user-display-name user_id={$user->ID} group_id=2]" );
    	echo do_shortcode( "[bp-shortcodes-profile user_id={$user->ID} group_id=2]" );
    
    	$shortcode_content = ob_get_clean();
    
    	return $content . $shortcode_content;
    } );
    
    

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Array text in Header Actions #40161

    Hello Carsten,

    Thank you for sharing the screenshot. On my end, it is showing ‘Send Message’ and ‘Suspend’ buttons. Please have a look here:

    https://tinyurl.com/yhnjtwtd

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Categories and Tags on blog posts #40154

    Hello Daniel,

    Please let me know which software you are using for posting. Please point me to the post URL so that where this issue is occurring.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Donation feature for buddypress #40152

    Hello Tosin,

    Please let me is there any error occurring or not. Also, try the third option as ‘comma’ for the multi-valued field. for e.q.

    
    xprofile_get_field_data( 3219, $user->ID, 'comma' );
    
    

    Please let me know if it resolves the issue or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Array text in Header Actions #40150

    Hello Carsten,

    I have tried after deactivating two plugins PWA and Object Cache 4 Everyone. But unable to see the issue on the profile. Please tell me how can I see the issue.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: Array text in Header Actions #40145
    This reply has been marked as private.