MyBB Community Forums
Plugin Request - Improved Reputation System - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Requests (https://community.mybb.com/forum-65.html)
+---- Thread: Plugin Request - Improved Reputation System (/thread-229505.html)



Plugin Request - Improved Reputation System - Myusername69 - 2020-09-23

**FREE**

So instead of everybody's votes being equal...

User A can have a reputation of 486,900
User B can have a reputation of 100,000

If User A "reps" User B, User B will have 100,486 reputation afterwards
If User A "negs" User B, User B will have 99,514 reputation afterwards

Nobody can see the "reps" or "negs" except for User B - who will get a message in his control panel saying he was "repped" or "negged" by User A (with a comment)

So posts don't have any indicator on them at all, only public indicator is the User's changing reputation level

I think I have an idea how to do it... 

Find the API endpoint that would lead to doing +1/-1 to a users reputation... 

..instead get the reputation of the person initiating it, say 678, then take 1% of it, so 6...

... Then change +1 to +6 or -1 to -6 depending if it was rep or neg 

I think that's basically it...


RE: Plugin Request - Improved Reputation System - Omar G. - 2020-09-23

(2020-09-23, 11:56 AM)Myusername69 Wrote: I think that's basically it...

Pretty much, taking a quick look I think you will need to hook to reputation_do_add_start and reputation_add_start to modify the value of $mybb->usergroup['reputationpower'] and probably $mybb->input['reputation'] if I understand correctly your inquiry.


RE: Plugin Request - Improved Reputation System - noob1337 - 2020-09-29

(2020-09-23, 06:45 PM)Omar G. Wrote:
(2020-09-23, 11:56 AM)Myusername69 Wrote: I think that's basically it...

Pretty much, taking a quick look I think you will need to hook to reputation_do_add_start and reputation_add_start to modify the value of $mybb->usergroup['reputationpower'] and probably $mybb->input['reputation'] if I understand correctly your inquiry.


$senderuid = $mybb->user['uid'];

$query1337 = $db->simple_select("reputation", "SUM(reputation) AS reputation_count", "uid='{$senderuid}'");
$sender_repvalue = (int)$db->fetch_field($query1337, "reputation_count");

$sender_reppower = ceil($sender_repvalue / 100);


so i put that into ~line 382 in reputation.php



and right below it modified a part of the reputation object from
//"reputation" => $mybb->get_input('reputation', MyBB::INPUT_INT),
//changed to
"reputation" => $sender_reppower,

so when someone with a reputation of 999 "reps" someone else, the other person receives 10 reputation

(2020-09-23, 06:45 PM)Omar G. Wrote:
(2020-09-23, 11:56 AM)Myusername69 Wrote: I think that's basically it...

Pretty much, taking a quick look I think you will need to hook to reputation_do_add_start and reputation_add_start to modify the value of $mybb->usergroup['reputationpower'] and probably $mybb->input['reputation'] if I understand correctly your inquiry.


so I think reputation_do_add_start and reputation_add_start are for plugins... and I think that's over my head for now, I'm not even sure what hook means (but I understand it a little more after looking at what you said)



$mybb->usergroup['reputationpower'] I think I'm going to ignore cause I don't want to break anything... I saw that as one of the options in myBB... actually I think I should change it to 1,000,000,000,000 or something so it doesn't end up blocking the change I did because the reputations are going to get high quickly, soon people could be giving "rep" for like values of 5,000 (in my system meaning they have a reputation of 500,000 in the database and 1% is 5,000)


Also I'm going to change line 201 in reputation.php and add "* 7" so that people can only rep the same person once a week... I think once a day would make it exploitable


Now I need to make reputation "reps" and "negs" private to only the person that received them...

Okay to make Reputation private I added this part inside the start of the existing if(!$mybb->input['action']) part (around line 573 in reputation.php)

// Otherwise, show a listing of reputations for the given user.
if(!$mybb->input['action'])
{
	if($uid != $mybb->user['uid']) 
	{
		// Not viewing own reputations
		error_no_permission();
	}

Now I need to hide the HTML link on posts

... also now Admins can't access user's rep maybe need to hardcode in the 'uid' of an admin to be allowed


RE: Plugin Request - Improved Reputation System - Omar G. - 2020-09-29

	if($uid != $mybb->user['uid'] && !$mybb->usergroup['issupermod']) 
	{
		// Not viewing own reputations
		error_no_permission();
	}

I suppose you could use canmodcp but that would allow any moderator that can use the moderator control panel.

I don't know which HTML post link you mean but you can take a look at the post bit template set.


RE: Plugin Request - Improved Reputation System - Myusername69 - 2020-09-29

(2020-09-29, 08:31 PM)Omar G. Wrote:
	if($uid != $mybb->user['uid'] && !$mybb->usergroup['issupermod']) 
	{
		// Not viewing own reputations
		error_no_permission();
	}

I suppose you could use canmodcp but that would allow any moderator that can use the moderator control panel.

I don't know which HTML post link you mean but you can take a look at the post bit template set.

OK, thanks I'll look into canmodcp

And yeah ur right about templates, I was dumb and took me a while to find it :|