Povylas
Povylas

Reputation: 786

Assign role or grant permissions for WP user then he collects some points

Lets begin from the start:
I want to make a website where users could generate content. It will be based on Wordpress and am using TDO Mini Forms to let users submit content. I have also added CubePoints plug-in to grant points for my users.

I want user to get some points for approved submission and then he earns, for example, 100 points his posts would be published instantly. To my mind hat can be achieved by granting the user a new role with more permissions or modify permissions for that particular user.

Can I do it with Wordpress I will I have to go back to Drupal and make it happen with modr8 and Rules modules?

Upvotes: 2

Views: 1346

Answers (1)

DeviousBlue
DeviousBlue

Reputation: 241

Wordpress has a class for managing users called WP_User defined in /wp-includes/capabilities.php

So to change a users's role you could say:

$user = new WP_User( $target_user_id );
$user_points = method_to_get_user_points();

if( $user_points > 100 ){
    $user->remove_role( 'subscriber' );
    $user->add_role( 'editor' );
}

Upvotes: 2

Related Questions