Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-09-2007, 01:26 PM
RS25com RS25com is offline
 
Join Date: Dec 2001
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I set everyones reputation power to never be more than 1?

My site is using the reputation system as a "negative" setup that auto-bans users after a certain number of rep points. This has been working exceptionally well for me.

I have recently updated the reputation system to give users one point for every 6 months they have been a member. I want to do this in such a way that if someone gets a point taken away, after six months they can "earn" it back. The problem is that the system currently is looking at the date of registration and then updating their reputation for EACH 6 months. Therefore, if a long time member gets 2 points, in 6 months they are BOTH wiped out.

Example:

Member for 4 years
-2 rep points
In six months they get 8 points
Take their -2 points and add 8 points for a total of +6!

Now when they give points, they also give more than 1 point to other users, so some folks are getting banned after 1 hit from a long term member. (I.e., I have one member who has +4 power, and one hit from him will ban another user as my threshold is set to 3 points.)

I found includes/function_reputation.php and some code as follows:

Quote:
function fetch_reppower(&$userinfo, &$perms, $reputation = 'pos')
{
global $vboptions;

// User does not have permission to leave negative reputation
if (!($perms['genericpermissions'] & CANNEGATIVEREP))
{
$reputation = 'pos';
}

if (!($perms['genericpermissions'] & CANUSEREP))
{
$reppower = 0;
}
else if ($perms['adminpermissions'] & CANCONTROLPANEL AND $vboptions['adminpower'])
{
$reppower = iif($reputation != 'pos', $vboptions['adminpower'] * -1, $vboptions['adminpower']);
}
else if (($userinfo['posts'] < $vboptions['minreputationpost']) OR ($userinfo['reputation'] < $vboptions['minreputationcount']))
{
$reppower = 0;
}
else
{
$reppower = 1;

if ($vboptions['pcpower'])
{
$reppower += intval($userinfo['posts'] / $vboptions['pcpower']);
}
if ($vboptions['kppower'])
{
$reppower += intval($userinfo['reputation'] / $vboptions['kppower']);
}
if ($vboptions['rdpower'])
{
$reppower += intval(intval((TIMENOW - $userinfo['joindate']) / 86400) / $vboptions['rdpower']);
}

if ($reputation != 'pos')
{
// make negative reputation worth half of positive, but at least 1
$reppower = intval($reppower / 2);
if ($reppower < 1)
{
$reppower = 1;
}
$reppower *= -1;
}
}

// CHANGED REPUTATION POWER TO ALWAYS EQUAL ONE HERE
$reppower = 1;

return $reppower;
}
So I added the next to last line to set the reppower = 1. This way, I hope, anytime someone gives another person a rep point it will only count for 1 point.

Is that going to work?

Thanks!
Reply With Quote
  #2  
Old 02-09-2007, 04:04 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Let's see if I understood you correctly. You simply want all your users to have the same "rep changing power" you don't want long-time users to have more power? Is that right?
Reply With Quote
  #3  
Old 02-13-2007, 05:28 PM
RS25com RS25com is offline
 
Join Date: Dec 2001
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's right. And, actually, after some testing it turns out that the code above DOES work IF you set it to -1. So I am all set and it's very handy.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:18 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03474 seconds
  • Memory Usage 2,175KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete