BuddyDev

Search

[Resolved] autoaccept User Testimonials

  • Participant
    Level: Initiated
    Posts: 20
    constantinos amiridis on #47402

    hi

    is it possible to autoaccept user testimonials?

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #47404

    Hi,
    Thank you for the question.

    our team will assist you within 48 hours with a working code to achieve it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 20
    constantinos amiridis on #47408

    lovely! best dev team ever!

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2502
    Ravi on #47409

    Hello,

    Please update the plugin ‘BuddyPress User Testimonials’ and use the following code in your ‘bp-custom.php’ file.

    
    add_action( 'bp_testimonials_action_saved_testimonial', function ( $testimonial_id ) {
    
    	if ( ! class_exists( 'BPTestimonialMapper' ) ) {
    		return;
    	}
    
    	$testimonial = BPTestimonialMapper::get_comment( $testimonial_id );
    
    	$testimonial->comment_approved = 1;
    
    	if ( ! is_array( $testimonial ) ) {
    		$testimonial = (array) $testimonial; // since we had retrieved object, we need to convert it to array.
    	}
    
    	wp_update_comment( $testimonial );
    }, 9 );
    
    add_filter( 'bp_testimonials_user_notification_testimonial_link', function ( $testimonial_link, $user_id, $action ) {
    
    	if ( 'new_testimonial' == $action ) {
    		$testimonial_link = trailingslashit( bp_core_get_user_domain( $user_id ) . buddypress()->testimonials->slug );
    	}
    
    	return $testimonial_link;
    }, 10, 3 );
    
    add_filter( 'bp_testimonials_admin_nav', function ( $admin_nav_items ) {
    
    	$admin_nav_items = array_filter( $admin_nav_items, function ( $admin_nav_item ) {
    		return $admin_nav_item['id'] != 'my-account-testimonials-pending-testimonials';
    	} );
    
    	return $admin_nav_items;
    } );
    
    add_action( 'bp_testimonials_setup_nav', function () {
    	$parent_slug = buddypress()->testimonials->slug;
    
    	bp_core_remove_subnav_item( $parent_slug, 'pending-testimonials', 'members' );
    } );
    
    

    Please check and let me know if everything works fine or not.

    PS: Refer to this URL if you do not have the ‘bp-custom.php’ file
    https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 20
    constantinos amiridis on #47416

    thanks,

    works great

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2502
    Ravi on #47422

    Hello,

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

    Regards
    Ravi

The topic ‘ [Resolved] autoaccept User Testimonials’ is closed to new replies.

This topic is: resolved