Help rewrite a code
-
* Multiply Point Payouts * @since 1.0 * @version 1.0 */ function mycred_pro_balance_adjustment_multiply( $request, $mycred ) { // Get the user ID $user_id = absint( $request['user_id'] ); // Ignore admins if ( user_can( $user_id, 'edit_users' ) ) return $request; // If user is an editor, quadruple the amount if ( user_can( $user_id, 'moderate_comments' ) ) $request['amount'] = $request['amount'] * 4; // If user is a author, triple the amount elseif ( user_can( $user_id, 'publish_posts' ) ) $request['amount'] = $request['amount'] * 3; // If user is a contributor, double the amount elseif ( user_can( $user_id, 'edit_posts' ) ) $request['amount'] = $request['amount'] * 2; return $request; } add_filter( 'mycred_run_this', 'mycred_pro_balance_adjustment_multiply', 10, 2 );
I found this code on your website; on how to multiply user point based on role…
But as it is now, it is based on user capabilities… Can you please help re-write the code to work to multiple user roles instead of their capabilities.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Help rewrite a code’ is closed to new replies.