Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Assign group to user based on reputation
Avatar
Yehonal
Member
sp_UserOfflineSmall Offline
Apr 23, 2016 - 12:07 pm

Hello SP community!

I would ask you 2 things:

1) is it possible, as title says, to assign a role/group based on reputation system?

2) what can i actually do with reputation? does it have a a functional way to use it?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2016 - 12:20 pm

lets start with #2... I assume you have read the plugin codex page:  https://simple-press.com/docum.....on-system/

reputation is a way of rating users... so the more reputation  you have, the more you can give to other users... its a kind of karma way of rating users and letting other folks reading the forum the "quality" of a user... whether other people respect and value the posts from that user...  so you can bestow your reputation on other users that you feel have made valuable contributions to your forum...

as to #1, the answer is yes and no... 🙂  no, its not directly built in the plugin to automatically do that, but it can be done pretty easily using our core and plugin api...  if  you are interested in adding some custom code to do this, we can help show guide you there...

Avatar
Yehonal
Member
sp_UserOfflineSmall Offline
Apr 23, 2016 - 12:26 pm

Yes, would be nice 🙂 thank you

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 23, 2016 - 4:05 pm

first, this will be untested, so you many need to play a bit...

second, helps if you understand how wp filters/actions work:  https://codex.wordpress.org/Plugin_API

and something like this:

add_filter('sph_memberdata_update', 'my_check_reputation', 3);
function my_check_reputation($userid, $itemname, $itemdata) {
    if ($itemname == 'reputation') { # user reputation being updated
        # now check if reputation enough to warrant membership change
        if ($itemdata > 2000) { # change 2000 to anything
            sp_add_membership(1, $userid); # grant membership to usergroup 1
        } else if ($itemdata > 1000) { # a second value check
            sp_add_membership(2, $userid); # grant membership to usergroup 2           
        } # just add more if check for different values if needed (or use switch statement)
    }
}

this will grant membership to usergroup 1 if reputation is greater than 2000... If greater than 1000, membership will be granted to usergroup 2...  you can add as many checks as you like... or do whatever you want...  if using single usergroup membership, this will even handled if user loses reputation and falls below certain level...

again, untested, but should point you in the right direction...

you would put this code in the spFunctions.php file of your sp theme.. as always, we recommend a child theme before making any edits to our themes...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625