The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Ok.
I'm in the process of writing a new hack, and I'm hoping to include a 'member of the month' function to it. I've been thinking of different ways to do this (preferably without Cron Jobs), and thought I'd come up with a solution, but I'm having problems. The motm is determined by a condition attached to each post. Basically, the way I thought I'd do it is (pseudocode): Code:
if (currentmonth != storedmonth) query_first( SELECT username, userid FROM user WHERE dateline <= todaysdate AND dateline >= a month ago ORDER BY condition DESC ) } Anyone any ideas on how I can do this? As a temp mock-up, I've used: Code:
WHERE p.dateline >= $today-(60*60*24*30) AND p.dateline <= $today-(60*60*24) I did try: Code:
WHERE ".date('mY',."p.dateline".)." = $currentmonth I hope this makes some sort of sense. I know I've been a little vague, but I don't wish to give too much away at this point. But if people need more info I will do my best to comply ![]() Hwu |
#2
|
||||
|
||||
![]()
First, get the number of the current month with PHP's date, then get the UNIX time of the first day in the current month and query the table for all entries which have a higher value in the time column.
There you go :-) . PHP Code:
And btw, it doesn't work for a second reason: The value to the left has to be the name of a column, but i doubt date() will return the name of an already existing column. |
#3
|
||||
|
||||
![]()
Thanks for the suggestion, but I still don't think that will work, for the same reason I post above. AFAIC tell, that's the same logic as I was trying to use first time.
The problem is, I need to retrieve all posts from the previous month to this one, and I can't see a short way of doing it without much code writing. I understand what you're saying about the quoted code. I never expected it to work, was just a wild stab in the dark out of desperation. Btw, the p.dateline that you refer to is valid, but I haven't quoted the rest of the query. p is an alias for the post table which is set earlier in the query. Cheers. |
#4
|
||||
|
||||
![]()
I never said that p.dateline isn't valid. What i said was that the where-clause is not valid. You have to supply the name of a column there, but date() sure won't give you the name of an existing column.
|
#5
|
||||
|
||||
![]()
Ah right, I see what you mean.
Sorry ![]() Looks like I might have to forget this without cron jobs. Shame ![]() |
#6
|
||||
|
||||
![]()
Why shouldn't this work? Just try it!
"First, get the number of the current month with PHP's date, then get the UNIX time of the first day in the current month and query the table for all entries which have a higher value in the time column." |
#7
|
||||
|
||||
![]() Quote:
Thanks for your pointers. I didn't quite follow what you were getting at the first time I read it, but looked again last night with a clear head, did some research, and have solved the problem. Code looks something like this: PHP Code:
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|