BuddyDev

Search

BuddyPress User Testimonials plugin provides the following hook to control the permissions for various actions:-

  • testimonial_can_delete  : Whether current user can delete the testimonial or not?
  • testimonial_can_approve : Can current user approve testimonial
  • bp_testimonials_can_user_write : Can the current user write testimonial

All these filters provide a boolean value( true|false) to contol the action.

To find the current user, you can use the function get_current_user_id()

To find the user whom the testimonial was being written, you can use bp_displayed_user_id()

Example 1:- Only super admins can approve testimonial


add_filter('testimonial_can_approve', 'bpt_only_super_admins_can_approve');<strong>

function bpt_only_super_admins_can_approve( $can ){

if( is_super_admin() )

return true;

return false;

}

You can put the code in bp-custom.php and it will allow only super admins to approve the testimonials.