BuddyDev

Search

User Testimonials

  • Participant
    Level: Initiated
    Posts: 19
    John Waters on #48259

    Hi,

    Is there way to add “Add testimonial” to the buttons on a members cover image ?

    Thanks (sorry with all the quesstions)

  • Keymaster
    (BuddyDev Team)
    Posts: 24257
    Brajesh Singh on #48279

    Hi John,
    Thank you for the question.

    Would you be able to use if we put a few lines of php code for the same?

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    John Waters on #48286

    Yes, if it is just a matter of adding a snippet….

    Thanks heaps

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2985
    Ravi on #48305

    Hello John,

    Please use the following code to add a button to write a testimonial link:

    
    
    add_action( 'bp_member_header_actions', function () {
    
    	if ( ! function_exists( 'tesimonial_current_user_can_write' ) || ! tesimonial_current_user_can_write() ) {
    		return;
    	}
    
    	$displayed_user_id = bp_displayed_user_id();
    
    	if ( ! bp_testimonials_is_enabled_for_user( $displayed_user_id ) ) {
    		return;
    	}
    
    	$link = trailingslashit( bp_displayed_user_domain() . BP_TESTIMONIALS_SLUG );
    
    	$button_args = array(
    		'id'                => 'user-testimonial',
    		'component'         => 'testimonials',
    		'must_be_logged_in' => true,
    		'block_self'        => true,
    		'wrapper_id'        => 'testimonial-button-' . $displayed_user_id,
    		'link_href'         => $link,
    		'link_text'         => __( 'Write Testimonial' ),
    		'link_title'        => __( 'Write Testimonial' ),
    		'link_id'           => 'testimonial-' . $displayed_user_id,
    	);
    
    	if ( function_exists( 'bp_nouveau' ) && ! defined( 'BP_PLATFORM_VERSION' ) ) {
    		$button_args['parent_element'] = 'li';
    	}
    
    	echo bp_get_button( $button_args );
    } );
    
    

    Please give it a try and let me know

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 19
    John Waters on #48314
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24257
    Brajesh Singh on #48315

    Hi John,
    Thank you for the reply.

    The code uses the markup generated by BuddyPress. seems your theme does not have support for generic markup( it might have styled specific buttons).

    I will suggest reaching out to the theme author for css assistance or copy it from the existing button to this one.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved