vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Add-On Releases - [AJAX] Helpful Answers - Post Rating System (plus many sub-features) (https://vborg.vbsupport.ru/showthread.php?t=204117)

Simon Lloyd 05-26-2011 01:16 PM

In helpfulanswers_settings (admincp) turn this off:
Show Users Who Voted On Their Post
If enabled, users will see who voted on their post in the notifications area.
Yes No

furnival 05-26-2011 07:01 PM

I appreciate you taking the time to reply but I knew that much. What I said was it would be useful for me to be able to make positive ratings named and negative feedback anonymous but it's no big deal I can live without it.

On a different note... Some of my users are asking how the time period for the max post ratings a user can make per day is calculated. Is it on a rolling 24 hour period, please? I couldn't see how this is done in the code.

Ted S 05-26-2011 11:47 PM

Quote:

Originally Posted by furnival (Post 2200314)
I appreciate you taking the time to reply but I knew that much. What I said was it would be useful for me to be able to make positive ratings named and negative feedback anonymous but it's no big deal I can live without it.


On a different note... Some of my users are asking how the time period for the max post ratings a user can make per day is calculated. Is it on a rolling 24 hour period, please? I couldn't see how this is done in the code.

There's a small admin panel that may do what you want in the user cp. It's nothing fancy.

Ted S 05-26-2011 11:52 PM

Quote:

Originally Posted by furnival (Post 2200314)
On a different note... Some of my users are asking how the time period for the max post ratings a user can make per day is calculated. Is it on a rolling 24 hour period, please? I couldn't see how this is done in the code.

It's rolling from the time of the last vote.

Line 323 of helpfulanswers.php should you wish to adjust

Code:

$datecut = TIMENOW - 86400;
$helpfulanswer = $db->query_first_slave("
  SELECT COUNT(helpfulanswerid) as count FROM " . TABLE_PREFIX . "helpfulanswer
  WHERE userid = $safeuserid AND dateline > $datecut
  ");

To change to days something like this will work:

Code:

$helpfulanswer = $db->query_first_slave("
  SELECT COUNT(helpfulanswerid) as count FROM " . TABLE_PREFIX . "helpfulanswer
  WHERE userid = $safeuserid AND (TO_DAYS(dateline) > TO_DAYS(TIMENOW))
  ");


furnival 05-27-2011 10:18 PM

Thanks Ted! I really appreciate your time on this.

On a different note, I was using 2.0.5 but I just upgraded to 2.0.6. It seems it wasn't updating the counter on the "user" table. I'm going to try building this using SQL queries (because I'm planning on using users' helpful post count to control whether they get admitted to a restricted forum, which is an add on modification somebody is going to develop for me.)
I'll post the SQL queries I used if I get it working.

I hope this post makes sense.

Ted S 05-28-2011 02:54 AM

Quote:

Originally Posted by furnival (Post 2200700)
Thanks Ted! I really appreciate your time on this.

On a different note, I was using 2.0.5 but I just upgraded to 2.0.6. It seems it wasn't updating the counter on the "user" table. I'm going to try building this using SQL queries (because I'm planning on using users' helpful post count to control whether they get admitted to a restricted forum, which is an add on modification somebody is going to develop for me.)
I'll post the SQL queries I used if I get it working.

I hope this post makes sense.

It's very simple to plug a new query into the update process...

Open up helpfulanswers.php and go to line 344

Code:

$db->query_write("
  INSERT INTO " . TABLE_PREFIX . "helpfulanswer
  SET postid = $postinfo[postid], userid = $safeuserid, yesno = '$saferank', dateline = ". TIMENOW ."
 ");

You'll see the user query a few lines lower which is a conditional query meaning that it does a few checks for variables before it runs [there does seem to be a bug as the two if statements are the same].

You can modify that query to add to the user table or just copy it and make it alter another table. field = field+1 to increment a counter.

furnival 05-28-2011 05:14 PM

Excellent, many thanks Ted I used that code.

Regarding the post you made before about how the no. of posts rated in a 24 hour period works..... I might be pushing my luck here, but this will be my last request I promise: it would be useful for me to exclude users in certain usergroups from the limit on the number of posts they can rate in 24 hours (so that moderators can rate an unlimited number of posts as helpful). Is there an addition I could make to the code around line 323 to achieve that, please?

Ted S 05-28-2011 06:30 PM

Quote:

Originally Posted by furnival (Post 2200950)
Excellent, many thanks Ted I used that code.

Regarding the post you made before about how the no. of posts rated in a 24 hour period works..... I might be pushing my luck here, but this will be my last request I promise: it would be useful for me to exclude users in certain usergroups from the limit on the number of posts they can rate in 24 hours (so that moderators can rate an unlimited number of posts as helpful). Is there an addition I could make to the code around line 323 to achieve that, please?

No need to stop anywhere... the idea of my mods is to extend them so asking how to do so is perfectly reasonable...

And yes, you can do this. If you just exclude groups from the function it's very simple...

Find

Code:

$datecut = TIMENOW - 86400;
  $helpfulanswer = $db->query_first_slave("
  SELECT COUNT(helpfulanswerid) as count FROM " . TABLE_PREFIX . "helpfulanswer
  WHERE userid = $safeuserid AND dateline > $datecut
  ");
  $count = $helpfulanswer['count'];

Change to something like...

Code:

$datecut = TIMENOW - 86400;
  if(!is_member_of($bbuserinfo, 1,2,3)){
  $datecheck = "AND dateline > ". $datecut;
  } else { $datecheck = ''; }
 
  $helpfulanswer = $db->query_first_slave("
  SELECT COUNT(helpfulanswerid) as count FROM " . TABLE_PREFIX . "helpfulanswer
  WHERE userid = $safeuserid $datecheck
  ");
  $count = $helpfulanswer['count'];

Where x,y,z are groups to exclude.

furnival 05-28-2011 08:59 PM

Oh dear, I can't seem to get that code to work.
On edit: a programmer helped me out with the above tweak to allow moderators to rate an unlimited number of posts; he said he'll post the code here at the weekend.

Wonksta 06-11-2011 01:32 PM

I don't know if this has been asked before but I am a little concerned.

If the Reputation feature is enabled with this Mod and someone is on a Reputation Spread before repping the same person, can they get around to having to wait for the Rep Spread by just randomly pressing the thumbs up on a bunch of posts and then being able to rep the same person via the inbuilt vBulletin rep system because they spread Reps via this Mod?

Reason I ask is I am worried this will cause a lot of rep whoring if enabled...


All times are GMT. The time now is 11:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02232 seconds
  • Memory Usage 1,756KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete