vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   TOTW: Thread of the Week Poll - Version 1.16 (https://vborg.vbsupport.ru/showthread.php?t=74737)

Marco van Herwaarden 01-19-2005 10:00 PM

TOTW: Thread of the Week Poll - Version 1.16
 
Thread of the Week Poll - Version 1.16

Description
With this hack it is possible to setup an automated system for electing a "Thread of the Week". Based on 1 or more rules you define it will select a number of threads from your board and will post a poll to let your members select their favourite thread.

This hack was written based on a requestion made here previously: https://vborg.vbsupport.ru/showthread.php?t=63969

Tested on
- vB 3.0.7
- vB 3.0.6
- vB 3.0.5
- vB 3.0.3 (Will probably also work on earlier versions)

Install Information
Installation using HIS installer included (HIS by Link14716 https://vborg.vbsupport.ru/showthrea...staller+system)
Uninstaller included
Install time: 2 minutes, easy
File edits: 0
Template edits: 0
Database modifications: 2 new tables

Features
  • Can run 1 or more Rules for selecting threads to include in Poll
  • Forums to be scanned for candidate threads can be selected.
  • Selection of candidate threads is done based on views and replies. The 'weight' of these selection criteria is settable for every rule.
  • Poll's are fully configurable (Posted as user, Thread title, Poll question, number of options)
  • Polls are automatic closed when a new poll is started
  • Polls can be generated on a settable interval. Interval can be given in days or weeks. Alternativle a new poll can also be generated on a fixed day every month.
  • uCash Integration. Activate in ACP Settings if you have uCash installed
  • Setable uCash price money for place 1, 2 and 3.
  • Date selection based on Thread Start Date or Last Reply Date. Selection can be made for every Rule.
  • Optional result post on closing of Poll, user configurable text.
  • Thread title with replacement variables. See Admin help!!
  • Poll title with replacement variables. See Admin help!!
  • Result post with replacement variables. See Admin help!!
  • Help added to the Admin screen.
  • .......
To be included in future releases
If enough request i am think of the following to add in a future release. More suggestions are welcome
- Integration with more existing Award system, already rewards possible using uCash
- More selection criteria

Support
Support will be given in this thread.

If you have problems, please first check the following:
- Did you set the uCash/uShop correct in ACP->vB Options->Thread of the Week (On/Off)
- Turn on logging in the Scheduled Taks for Thread of the Week. Check the Scheduled Task Log for any messages.

If you still have problems, please post the following information, so i can quickly try to help you:
- vBulletin version
- PHP and MySQL Version
- Version of this hack
- The schedule options you have set in the Rule Manager
- Selection Options
- When is it scheduled to run in the Scheduled Task Manager
- Any other relevant information

Thanks to
A big thanks to link14716 for the installer and to trafix for letting me use a script as a starting point for the admin settings, saved me a lot of time.

Also a huge thanks to sabret00th for testing (now i got someone to blame if there are still any errors left :)).


Donations
I will not charge for this hack. But if you like it and are looking for a way to spend your money, paypal donations are always welcome (marcoh64@msn.com) ;)

Please click Install if you are using this hack

Change log:
Version 1.16:
- Fixed bugs in updating Username/Userid/Thread Title in posted thread and forum info
- Removed 2 unneeded queries
- Added replacement variables for Thread Title:
- {date} - Current date formatted according to vB settings
- {beginofweek} - Date (formatted) of the start of the current week (sunday is start)
- {endofweek} - Date (formatted) of the end of the current week (saturday is end)
- {beginofweekmon} - Date (formatted) of the start of the current week (monday is start)
- {endofweekmon} - Date (formatted) of the end of the current week (sunday is end)
- Added {date} replacement variable to Poll Title
- Made all replacement variables case-insensitive
- Admin Help pages updated accordingly

Version 1.15:
- Add the option to override the default calculation for the cutoff date when selecting candidates. Now possible to enter a number of days to go back when selecting candidates.

Version 1.14:
- Bug that would make the cronjob crash if the current poll thread was deleted.
- Fixed version number in Manager script

Version 1.13:
- uCash Integration. Activate in ACP Settings to show them.
- Setable uCash price money for place 1, 2 and 3.
- Date selection can now be based on Thread Start Date or Last Reply Date. Selection can be made for every Rule.
- Optional result post on closing of Poll, user configurable text.
- Thread title with replacement variables. See Admin help!!
- Poll title with replacement variables. See Admin help!!
- Result post with replacement variables. See Admin help!!
- Help added to the Admin screen.
- Some minor modifications and bug fixes
- Removed debugging lines
- Scheduled task will now log information on the processing of the Rules in the Scheduled Task Log
- INSTALLER WILL ALSO UPGRADE FROM PREVIOUS VERSIONS, SEE UPGRADE NOTES.

Version 1.12:
- Fixed bug where threadoftheweek.php would not run correct (or even generate a database error) when running through the scheduler (as oppsed to running it with "Run Now")
- Added loads of debug information. To activate debugging, change includes/cron/threadoftheweek.php and uncomment the line "// $TOTW_DEBUG = TRUE;". Debug lines will go to the Scheduler log.
- Forum counters will now be updated when a new poll is posted.
- Fixed bug where "Run on day x of month" didn't work.
- Some minor changes
- The first time the rule is run, only threads with a last postdate in the time interval which is set for the rule will be selected as Candidates. In the older versions all threads where considered on the first run.

sabret00the 01-20-2005 03:00 PM

thank you, i've installed this and it's a great hack :)

Polo 01-20-2005 03:50 PM

This one will come really handy for me :)

RaZor Edge 01-20-2005 06:17 PM

Can be great if we can set an option to only choose threads started in the current week!

Marco van Herwaarden 01-20-2005 06:39 PM

You can set it to only choose threads from the past 7 days (or last week).

How you mean current week?

yoyoyoyo 01-20-2005 07:12 PM

excellent! I will click install now and add it in later tonight with some other stuff I have lined up, also! thanks

lordofgun 01-21-2005 01:05 AM

So you must use the HIS system?

lordofgun 01-21-2005 01:39 AM

Quote:

Originally Posted by lordofgun
So you must use the HIS system?

Never mind. :D

trafix 01-21-2005 01:46 AM

Nice job :) ..... now if my forum had some thread ... lol

Marco van Herwaarden 01-21-2005 03:35 AM

Quote:

Originally Posted by trafix
Nice job :) ..... now if my forum had some thread ... lol

Lol that was my problem in testing :)

Marco van Herwaarden 01-21-2005 03:43 PM

I would really like to have some input from people who have installed this hack on the following 2 things:
- Integration with an Award system? If yes which one?
- More 'Weight' criteria to select threads. Based on what would you like threads to be selected. Can't believe that replies and views are enough.

trackpads 01-21-2005 04:02 PM

Excellent! I would like to see some Ucash support if you get the time. May give some bucks to the thread starter.

Thanks!!

-Jason

Marco van Herwaarden 01-21-2005 06:44 PM

Hmm never used uShop, but will look into it.

trackpads 01-21-2005 07:12 PM

Quote:

Originally Posted by MarcoH64
Hmm never used uShop, but will look into it.

Much appreciated!!

docvader 01-22-2005 05:39 AM

Excellent. Seems to work great on 3.06. An automatic donation to thread winner via UCash UShop would be great, but I'm bypassing that doing it manually. Nice job.

AlexanderT 01-22-2005 02:19 PM

looks like a great job!

j_86 01-22-2005 02:27 PM

Nice hack :)

yoyoyoyo 01-22-2005 03:11 PM

finally got it installed...excellent!

docvader 01-22-2005 04:40 PM

Getting this error, not sure if it's from this hack, but I have nothing else that would "look" for these things:
Quote:

Database error in vBulletin 3.0.6:

Invalid SQL: SELECT
threadid
, ((views * ) + (replycount * )) AS score
, views
, replycount
, title
, postusername
, postuserid
FROM thread
WHERE lastpost > 0
AND forumid IN ()

ORDER BY score DESC
LIMIT

mysql error: You have an error in your SQL syntax near ') + (replycount * )) AS score
, views
, replycount
, title
, postuse' at line 3

mysql error number: 1064

Date: Saturday 22nd of January 2005 04:14:04 AM
Script: http://x.russbo.com/vb/cron.php?&rand=173925
Referer:
Username: Unregistered
IP Address: 65.173.88.230

Any idea?? I did have this running well, with a test poll, without any apparent problems yesterday.

Marco van Herwaarden 01-22-2005 05:07 PM

Hmm this shouldn't be possible. It looks like the values for the rule are not filled. There must be a rule, or script would never even come to this point.

And the entry screen for the settings, don't allow empty values if all is good.

Could you check your rule settings. (maybe printscreen)

docvader 01-22-2005 05:18 PM

I just did the 3.06 upgrade, which has screwed up a bunch of my hacks. So, I'm not sure it's your hack that's doing this, I was just wondering if you thought it might. (I'm still dealing with some Shoutbox issues, LOL). The rule settings for the poll look fine to me, as does the functioning of the hack within the AdminCP. But the only two new Cron additions were the Statistics hack by PDFreak, and yours. So, I was just wondering if you had seen this error before, or, if you might recognize it.

Marco van Herwaarden 01-22-2005 09:56 PM

Well the hack is pretty stand alone, an upgrade shouldn't effect anything except maybe some phrases.

Yes this query is part of the cronjob for this hack.

What this cronjob does is read the rules table and then execute for every rule some code.

This query that give you an error is inside the part that gets triggered for each rule that needs to be run (meaning that there IS a rule row in the database that needs to be run).

So given the fact that this part of the code can only be executed if there is a rule, i really dont get why this query have no values from the rules row.

The line [sql], ((views * ) + (replycount * )) AS score[/sql]
should have the values of the weight for views and replies inserted there. So for example:
[sql], ((views * VIEWWEIGHT) + (replycount * REPLYWEIGHT)) AS score[/sql]
If you have access to the database, please check if there is somehow an empty row in the 'threadofweekrules' table.

Otherwise all i can think of is to clear all rules, and add them again.

Romeos Tune 01-22-2005 10:23 PM

Thanks for the fun hack! :) Good Job!

docvader 01-22-2005 11:13 PM

This is what is in the database:
Quote:

row(s) starting from record #
in mode and repeat headers after cells

Full Texts threadofweekrulesid description active schedule_type schedule_value postforumid postasuser threadtitle posttext sticky pollquestion pollpublic numberpolloptions analyzeforums permission_usergroupids weight_views weight_replies lastrun currentpollid previouspolledthreads
All boxes have data in them, with the exception of permission_usergroupids

Now, I did set this up so that it ran for one day. And, it seemed to have worked. So, I'm not saying that this doesn't work; I just don't understand where this error came from. I wanted you to be aware of it.

let me know what I can do to help, if need be.

James T Brock 01-26-2005 06:58 PM

It doesn't work as advertised. On my forum I have it set for the last 7 days but it shows threads from months ago in the poll!!

sabret00the 01-26-2005 07:10 PM

Quote:

Originally Posted by James T Brock
It doesn't work as advertised. On my forum I have it set for the last 7 days but it shows threads from months ago in the poll!!

it will do that for the inital poll, proceeding polls will be as set.

sabret00the 01-26-2005 07:11 PM

Quote:

Originally Posted by MarcoH64
- Integration with an Award system? If yes which one?

uCash unless you mean adding a simple to show thread to show that "this a thread of the month winner"

Quote:

Originally Posted by MarcoH64
- More 'Weight' criteria to select threads. Based on what would you like threads to be selected. Can't believe that replies and views are enough.

it seems to work of views, it would be nice to have something like replies * views = weight

fiber1 01-26-2005 07:29 PM

I have the same issue that docvader does so there is an issue there. I am just not sure of the resolution.

Marco van Herwaarden 01-26-2005 08:51 PM

Quote:

Originally Posted by James T Brock
It doesn't work as advertised. On my forum I have it set for the last 7 days but it shows threads from months ago in the poll!!

In the current version the initial poll takes threads from the beginning. I got a new version here that has some small modifications, one of them is that also the initial poll limits the age of the threads.

Quote:

Originally Posted by fiber1
have the same issue that docvader does so there is an issue there. I am just not sure of the resolution.

I have send docvader (i think, or am i mixing up mail addresses now) a test version with some extra debug options to find the problem. I don't have a result from that yet. You can send me a pm with MSN/ICQ or mail contact info and i could send you that also.

Quote:

Originally Posted by sabret00the
it seems to work of views, it would be nice to have something like replies * views = weight

Current selection score is calculated as follows:
score = (views * weight_views) + (replies * weight_replies)

General:
Will look soon into a uShop integration.

trackpads 01-26-2005 09:44 PM

Quote:

Originally Posted by MarcoH64
Will look soon into a uShop integration.


Thanks!!!!!

TTG 01-27-2005 02:44 PM

Looks like it could be a useful addition. Installed a week ago and it worked well for the 1st poll .. never worked again no matter what I do. Checked all details and after 10 days still waiting for the next poll !?

Polo 01-27-2005 02:53 PM

so is this mod working correctly for anyone?

Marco van Herwaarden 01-27-2005 02:54 PM

Quote:

Originally Posted by TTG
Looks like it could be a useful addition. Installed a week ago and it worked well for the 1st poll .. never worked again no matter what I do. Checked all details and after 10 days still waiting for the next poll !?

- How often is your Scheduled Task set to run?
- What Schedule type and value did you set?
- What is the last run date?

TTG 01-27-2005 04:47 PM

My mistake .. set the schedule and forgot to add the filename for the task .. duh

Marco van Herwaarden 01-27-2005 08:32 PM

:D

Glad that this also answers the question of Polo ;)

sabret00the 01-28-2005 09:17 AM

Quote:

Originally Posted by Polo
so is this mod working correctly for anyone?

working perfectly for me.

Polo 01-28-2005 08:19 PM

Ok, sounds good, will install on my forum :)

Marco van Herwaarden 01-28-2005 08:54 PM

There is a modified version ready, but i am still waiting to get test results back. Seems the person testing is a bit busy with other things atm.

fiber1 01-29-2005 04:15 AM

Quote:

Originally Posted by MarcoH64
Well the hack is pretty stand alone, an upgrade shouldn't effect anything except maybe some phrases.

Yes this query is part of the cronjob for this hack.

What this cronjob does is read the rules table and then execute for every rule some code.

This query that give you an error is inside the part that gets triggered for each rule that needs to be run (meaning that there IS a rule row in the database that needs to be run).

So given the fact that this part of the code can only be executed if there is a rule, i really dont get why this query have no values from the rules row.

The line [sql], ((views * ) + (replycount * )) AS score[/sql]
should have the values of the weight for views and replies inserted there. So for example:
[sql], ((views * VIEWWEIGHT) + (replycount * REPLYWEIGHT)) AS score[/sql]
If you have access to the database, please check if there is somehow an empty row in the 'threadofweekrules' table.

Otherwise all i can think of is to clear all rules, and add them again.

If you could just post the fix once resolved, when you find it that would be great

docvader 01-29-2005 04:48 AM

Quote:

Originally Posted by MarcoH64
There is a modified version ready, but i am still waiting to get test results back. Seems the person testing is a bit busy with other things atm.

OH, were you talking about me?

Sorry. Will try it again. didn't get that file to work, but, the hack seems to be working great.


All times are GMT. The time now is 05:45 AM.

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.01320 seconds
  • Memory Usage 1,843KB
  • 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
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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