PDA

View Full Version : Pull the last paid subsciber


Jenta
03-15-2005, 11:50 AM
Im trying to show the last paid subscriber in the What's Going On site statistics area. I believe this can be done with some template edits alone. Perhaps something in phpinclude_start like this code someone posted at .com


if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')

{

// GET FORUM COUNTERS

$forumcounts= $DB_site->query("SELECT forumid, replycount, threadcount

FROM " . TABLE_PREFIX . "forum

");

// SET VALUES

while ($forumcount = $DB_site->fetch_array($forumcounts))

{

$forumreply[$forumcount[forumid]] = $forumcount[replycount];

$forumthread[$forumcount[forumid]] = $forumcount[threadcount];

}

}

Im guessing it would have to go like this...

SELECT * FROM `subscriptionlog` WHERE ??????

take the next auto_increment, subtract 1, then pull the userid


Then add a phrase like the newest registered user one edit the forumhome template

Standard Phrase: welcome_to_our_newest_member_x

Varname $vbphrase[welcome_to_our_newest_member_x]

Text Welcome to our newest member, <a href="{1}">{2}</a>

in forumhome

<div><phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase></div>

Add this under

<div>Welcome to our newest paid subscriber: <a href="member.php?$session[sessionurl]u=userid">username</a></div>


Anyone know how?

Thanks!

sabret00the
03-17-2005, 06:18 PM
urghh if it's in the table you just said then it's as simple as

phpinclude_start
$latest_subscription = $DB_site->query_first("SELECT subscirptionlog.subsciptionid, user.username, subscirptionlog.userid FROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscirptionlog.userid) ORDER BY subsciptionlog.subscriptionid DESC LIMIT 1");

then just put
<a href="member.php?$session[sessionurl]u=$latest_subscription[userid]>$latest_subscription[username]</a> is the latest subscriber at $vboptions[bbtitle].

:) hope it helps as i never read your think completely.

Jenta
03-17-2005, 08:43 PM
sweet that worked, had to do some minor typo fixes and something else but its working
ill post the minor changes to ur code in a bit

thanks a million!

sabret00the
03-18-2005, 08:01 AM
no problem :)

Jenta
03-20-2005, 06:29 PM
in template phpinclude_start

if (THIS_SCRIPT == 'index')
{
$latest_subscription = $DB_site->query_first("SELECT subscriptionlog.subscriptionid, user.username, subscriptionlog.userid
FROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscriptionlog.userid)
ORDER BY subscriptionlog.subscriptionlogid
DESC LIMIT 1");
}

In template forumhome add something like this in the what's going on area...

<div><strong>Latest Contributer: <a href="member.php?$session[sessionurl]u=$latest_subscription[userid]>$latest_subscription[username]</a></strong></div>