The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Creating a Cron Job
Hello all! This is what I have so far. I basically have members "rank up" based on things they do around the community. I want these to be automatic, so I created the following CRON. Below is the code for the cron PHP file called promos.php
http://pastebin.com/kC10i0j1 (Pastebin for your convenience). I based it off the default user promotions. This is the scheduled task I setup Varname: promos Title: User Promotions 2 Description: Automatic user promotions based on achievement points. Log Phrase: Usergroup: <strong>{1}</strong>{2}; Users: {3}<dfn>* = Primary Usergroup, % = Secondary Usergroup</dfn> Hour: 23 Active: Yes Log Entries: No Filename: ./includes/cron/promos.php Product: vBulletin When I tried to run it, I just got a grey screen with "User Promos 2" at the top. Can someone help me make this work? |
#2
|
|||
|
|||
If you take the promotion.php and your php file and use notepad ++ to compare you have lots of things messed up
|
#3
|
||||
|
||||
I am aware, I did it a different way on purpose.
|
#4
|
|||
|
|||
Maybe that's your problem then by looking at the code you have messed some parts up
|
#5
|
||||
|
||||
That's not very descriptive. What exactly do you see that I messed up? I have this same code running in a different way on a custom page and it works. No reason this shouldn't.
|
#6
|
|||
|
|||
Well, I don't know why you're getting a grey screen. To be honest I don't remember what happens when you press "run now" in the scheduled task manager (which is what I assume you're doing). But I think you do have at least one problem: mysql_fetch_array() returns one row of the results as an array. If your query only selects one column, it's still an array with one index. So instead of calling mysql_fetch_array to get all of the returned values (as it seems you're doing), you need to call mysql_fetch_array() repeated in a loop until it returns NULL (or maybe it returns FALSE, I can't remember). In fact you probably should just use $vbulletin->db->fetch_array(), which just ends up calling mysql_fetch_array().
|
#7
|
||||
|
||||
I have changed
PHP Code:
new version: http://pastebin.com/0FTFAEeq |
#8
|
|||
|
|||
Oh, yeah, I see now. I didn't look at the rest of the code closely. You obviously knew how that function works- sorry for the long explanation.
|
#9
|
||||
|
||||
That's alright. Just hoping to get this working for my members. I cant find any reason it should. I get the list of applicable users, then do something for each member. :/
MOST UP TO DATE: http://pastebin.com/kC10i0j1 --------------- Added [DATE]1403320942[/DATE] at [TIME]1403320942[/TIME] --------------- Fixed this. Thanks for the input all! --------------- Added [DATE]1403373658[/DATE] at [TIME]1403373658[/TIME] --------------- http://pastebin.com/DcuiPm9X So, I created a page with the exact same code, minus the CRON logging, and it works properly, however when I wun the CRON job (code listed above in pastebin link) it sets EVERYONE's membergroupsids to the same thing, even though that part should only run on people not in certain member groups. Any thoughts? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|