vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   paid subscription info (https://vborg.vbsupport.ru/showthread.php?t=188238)

katwomanofsteel 08-15-2008 05:03 PM

paid subscription info
 
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

1 Attachment(s)
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/attachmen...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/attachmen...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 [DATE]1219017788[/DATE] at [TIME]1219017788[/TIME] ---------------

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:
Code:

<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 [DATE]1219020711[/DATE] at [TIME]1219020711[/TIME] ---------------

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):
Code:

<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

Quote:

Originally Posted by katwomanofsteel (Post 1602468)
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:

Code:

<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 />&nbsp;</if>
    </if>
</if>

but that didn't work...

I did put this hack back into showthread.php:
Code:

$posts = $db->query_read("SELECT sublog.status AS active_sub,sub.subscriptionid as sub_id, post.*, post.username...
and then this additionally:
Code:

... 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

Quote:

Originally Posted by katwomanofsteel (Post 1603180)
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 [DATE]1219363529[/DATE] at [TIME]1219363529[/TIME] ---------------

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...


All times are GMT. The time now is 03:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01161 seconds
  • Memory Usage 1,745KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete