What this hack does: This hack will list and instantly refresh (when a new subscription is made) a list of the latest X paid subscribers to your forum. It's a nice way of recognizing members who help pay the the forum bills, and encourages others to join.
// ###################### thankyou #######################
function thankyou(){
global $DB_site;
// This is the template for usernames
$thanksbit = ' <a href=\"member.php?$session[sessionurl]u=$contributer[userid]\"><font color=\"#228E8E\"><b>$contributer[username]</b></font></a>';
$latestcontributers = $DB_site->query("SELECT username, status,regdate, subscriptionlog.userid
FROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog
LEFT JOIN " . TABLE_PREFIX . "user AS user
USING ( userid )
WHERE user.userid = subscriptionlog.userid
AND STATUS = '1'
ORDER BY regdate DESC
LIMIT 5");
Note 1: Change "LIMIT 5" to any number. By default, it will show the latest 5 paid subscribers. If you want to show the latest 3, simply change to "LIMIT 3". Note2 The template for usernames is in the code. To change the style and colour, edit this line from the code you added to functions.php:
6. First run To auto fill the list for the first time, you just need to edit an existing subscription, or just wait for the next subscription to arrive.
To auto fill it right now: Simply go to your admin control panel, click on subscriptions, view list, edit any existing subscription, for example, add 1 day to the subscription of a member, and save. You can re-edit to subtract the 1 day if you want.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
You're right. I forgot that there was no date references for usergroups. I'll have to come back to this one I guess once I have some time to play around with it. I'm still trying to restore everything after upgrading to 3.0.1.
For those interested, I've had a few emails back and forth with Kall, and he emailed me several of his forum files to investigate.
The conclusion is as follows:
1. The "foreach" warning is a result of another hack, in combination with this hack. The other hack is the "store cash hack". The line numbers reported in the warning is not related to this hack.
2. Despite the warning, both hacks seem to work fine, with no problems, so you can ignore it.
Warning: Invalid argument supplied for foreach() in /home/asiansin/public_html/forums/global.php on line 645
Warning: Invalid argument supplied for foreach() in /home/asiansin/public_html/forums/includes/functions.php on line 2895
Warning: Invalid argument supplied for foreach() in /home/asiansin/public_html/forums/includes/functions.php on line 2895
Warning: Invalid argument supplied for foreach() in /home/asiansin/public_html/forums/includes/functions.php on line 2895
Database error in vBulletin 3.0.1:
Invalid SQL: SELECT username, subscriptionlog.userid
FROM subscriptionlog AS subscriptionlog
LEFT JOIN user AS user
USING ( userid )
WHERE user.userid = subscriptionlog.userid
AND STATUS = '1'
ORDER BY regdate DESC
LIMIT 5
mysql error: Column: 'STATUS' in where clause is ambiguous
I have the ucash/ustore hack installed, as well as the recurring paypal hack.
The "foreach" error is not a problem, but the mysql error is a problem. I've made an update to the first post.
You just need to re-do step 2 with this code:
PHP Code:
// ###################### thankyou ####################### function thankyou(){ global $DB_site, $stylevar, $vboptions, $vbphrase;
require_once('./global.php');
$latestcontributers = $DB_site->query("SELECT username, status, regdate, subscriptionlog.userid FROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog LEFT JOIN " . TABLE_PREFIX . "user AS user USING ( userid ) WHERE user.userid = subscriptionlog.userid AND STATUS = '1' ORDER BY regdate DESC LIMIT 5");
Thanks for the prompt response. Now I'm getting this error:
Quote:
Database error in vBulletin 3.0.1:
Invalid SQL: SELECT username, status, regdate subscriptionlog.userid
FROM subscriptionlog AS subscriptionlog
LEFT JOIN user AS user
USING ( userid )
WHERE user.userid = subscriptionlog.userid
AND STATUS = '1'
ORDER BY regdate DESC
LIMIT 5
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '.userid
FROM subscriptionlog AS subscription