No giving Rep.Point for admin user

Solved4.26K viewsGeneral
0

I’m happy to be using AnsPress and your Askbug theme.

Can I avoid to give point (disable point) to admin user when admin do any acttions?

I hope to give point only non-admin user.

Thanks in advance.

selected answer
1

Add this snippet to theme functions.php:

add_filter( 'ap_reputation', 'my_function_to_disable_admin_reputation', 10, 3 );
function my_function_to_disable_admin_reputation( $reputation, $type, $user_id ) {
  if( is_super_admin( $user_id ) || user_can( $user_id, 'manage_options' ) ) {
    return 0;
  }
  return $reputation;
}
commented on answer

Thanks for your help.

I copy and paste it end of functions.php, (after //require get_template_directory() . ‘/includes/admin/auto-installer.php’;)
but shows 505 error.

Is there wrong way?

Please tell me what error is shown. Check error log for more detail.

Many sorry Rahul!!
I try it again and it works well.
Sorry again…

No problem. Thanks for letting me know.