View Full Version : paid subscription info
katwomanofsteel
08-15-2008, 05:03 PM
What's the paid subscription variable?
Marco van Herwaarden
08-16-2008, 10:12 AM
What do you mean with "the paid subscription variable"?
katwomanofsteel
08-16-2008, 02:28 PM
Hi Marco,
We have 4 different paid subscriptions: platinum, silver, gold, bronze and none are associated with any specific forums/usergroups/permissions as it is only used as a donation system.
Since we have upgraded from vb 3.5.1 to 3.5.8, the current variable we were using to pull in the subscription description (an img) per user in the posts $post[sub_id] (associated level of paid subscription) and $post[active_sub] (which checked to see if the paid subscription was active) have stopped working...
This is what the postbit looks like now (hint- the blank space on the right above the flag of the user's country):
https://vborg.vbsupport.ru/attachment.php?attachmentid=85605&stc=1&d=1218900319
And this is what it's supposed to look like (with gold subscription icon on the right above the flag):
https://vborg.vbsupport.ru/attachment.php?attachmentid=85606&stc=1&d=1218900319
I've been looking all over the vB db for how the paid subscriptions are associated with the user - can't find it anywhere...
Thanks for your help! :)
Marco van Herwaarden
08-17-2008, 09:43 AM
I don't think $post[sub_id] and $post[active_sub] are default vB variables, they where most likely added by a modification you had on your 3.5.1 installation.
katwomanofsteel
08-17-2008, 02:12 PM
hmmm well is there a variable or something I could use to pull the paid subscription info in the template then? I can't find it in the db - but it has to exist somewhere since I see it in the admin cp :)
There were many modifications to the 3.5.1 install, and mostly undocumented... trying to find them and document them as I go...
--------------- Added 1219017788 at 1219017788 ---------------
Ok, found it in the db - it's the subscriptionlog table - status field = 1 if user has a paid subscription, and subscriptionid is the type of paid subscription...
now how to pull that in. I have a conditional statement in the postbit template:
<if condition="$subscription['status'] == 1">
$vbphrase[paidsubscriptiontype]
<else />
Free
</if>
But that isn't working. It's still showing Free for users whose status = 1, so not sure what I need to use to grab this field...
--------------- Added 1219020711 at 1219020711 ---------------
getting closer... found the hack in the old code. Previous developer did not document an added $posts query joining the subscriptionlog table info...
katwomanofsteel
08-18-2008, 04:34 PM
Strange - my replies were being merged with my post from the other day...
I found it in the db - it's the subscriptionlog table - subscriptionid is the type of paid subscription... anyone know how to grab this? It isn't $subscription[subscriptionid]...
Dismounted
08-19-2008, 08:57 AM
If the subscribed user will be put into a usergroup specific to the subscription, you can just check their usergroup (X is the subscription usergroup):
<if condition="is_member_of($post, X)">
$vbphrase[paidsubscriptiontype]
<else />
Free
</if>
katwomanofsteel
08-19-2008, 05:37 PM
yeah there is no specific usergroup and/or permissions for the paid members... guess I could create that with no permissions though...
Thanks will try it out!
Dismounted
08-20-2008, 06:18 AM
yeah there is no specific usergroup and/or permissions for the paid members... guess I could create that with no permissions though...
Yea, you could just create a holder usergroup, just set all permissions to "No" or "0". A "yes" will always override a "no".
katwomanofsteel
08-20-2008, 05:21 PM
But how would the holder usergroup be able to tell if it's a gold, silver, bronze or platinum?
I tried doing this in the postbit template:
<if condition="is_member_of($post, 28)">
<img src="http://www.wetcanvas.com/forums/images/sub/icon_bronze.gif" alt="Bronze Membership">
<else />
<if condition="is_member_of($post, 27)">
<img src="http://www.wetcanvas.com/forums/images/sub/icon_silver.gif" alt="Silver Membership">
<else />
<if condition="is_member_of($post, 26)">
<img src="http://www.wetcanvas.com/forums/images/sub/icon_gold.gif" alt="Gold Membership">
<else /> </if>
</if>
</if>
but that didn't work...
I did put this hack back into showthread.php:
$posts = $db->query_read("SELECT sublog.status AS active_sub,sub.subscriptionid as sub_id, post.*, post.username...
and then this additionally: ... LEFT JOIN subscriptionlog AS sublog ON sublog.userid = user.userid AND sublog.status = 1LEFT JOIN subscription as sub ON sub.subscriptionid = sublog.subscriptionid
And I can pull now active_sub (which just checks to see if they have an active paid subscription) but can't seem to pull sub_id (which shows what type)...
Dismounted
08-21-2008, 06:20 AM
But how would the holder usergroup be able to tell if it's a gold, silver, bronze or platinum?
You can create a holder usergroup for each of gold, silver, bronze or platinum.
katwomanofsteel
08-21-2008, 10:42 AM
sorry thought you meant one holder group for all but yes, I did try that - that is the usergroup id numbers 26,27,28 that I had in the conditional statements listed above and that didn't work...
so there is no other way to grab that one field from the db table subscriptionlog? I would think sub_id should work with that hack - since active_sub does.
--------------- Added 1219363529 at 1219363529 ---------------
hmmm well now it's working - but I have to manually add all of the active subscribers manually into the secondary usergroup don't know why it is not updating with the subscription.php cron task...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.