Hi,
Is there way to add “Add testimonial” to the buttons on a members cover image ?
Thanks (sorry with all the quesstions)
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
BrajeshYes, if it is just a matter of adding a snippet….
Thanks heaps
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
RaviHi 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.