How to pull the cost of usergroup subscription

Post

Posted
Rating:
#4848 (In Topic #1064)
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’

...using Tempcode

Is this at all possible? I don't want to hard code a specific price in my templates in the event I change the price of the subscription, then I'd have to change too many templates. If there was a way using Tempcode to get the set price for a subscription, I'd like to do it this way.
Online now: No Back to the top

Post

Posted
Rating:
#4850
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
You don't need to make a symbol, unless this is a template specifically associated with the subscriptions (in which case there may be a parameter with it in).

Last edit: by Chris Graham



Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#4851
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
Chris,

Sorry, but I don't understand your reply.

Let me elaborate what I've done:

My usergroup subscription price is set at 19.99 USD monthly. I've created a custom template file, which is referenced on many Comcode pages throughout my site and details features included with subscribing. And, in some areas, when a user tries to access a subscription-required feature, I have configured the template to show upgrade options to the user, which also displays the current price for the subscription.

Instead of hard coding the price into the template, I'd like get the price dynamically from what is configured inside the usergroup subscription itself.
Online now: No Back to the top

Post

Posted
Rating:
#4852
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
To clarify, if I ever change the price of the subscription from within the usergroup subscription settings, it would automatically be updated in the template without the need to go back and hard code a new price. :thumbs:
Online now: No Back to the top

Post

Posted
Rating:
#4853
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Right, you'd need to program a symbol to get this data. It's doesn't exist currently.

I did make a typo in my post though, I'm editing it.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#4854
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
Oh I see now. I'll see if I can figure this out.
Online now: No Back to the top

Post

Posted
Rating:
#4855
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
I thought this would work, but it just leaves me with a lengthy stack trace. Any ideas where I'm going wrong?

Code (php)

function ecv_SUBSCRIPTION_INFO($lang, $escaped, $param)
{
    $db = $GLOBALS['FORUM_DB'];
    $value = $db->query('SELECT s_cost FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_usergroup_subs WHERE id=1 limit 1');
   
    if ($GLOBALS['XSS_DETECT']) {
        ocp_mark_as_escaped($value);
    }
    return $value;
}
Online now: No Back to the top

Post

Posted
Rating:
#4858
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
query returns a list of row maps.

queryquery_value_if_there


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#4859
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’

Chris Graham said

query returns a list of row maps.

queryquery_value_if_there

That worked, thanks Chris.

I had to remove the LIMIT 1 from the query for it to work as well.
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Forum statistics:
  • 2,052 topics, 7,195 posts, 10,827 members
  • Our newest member is LowfareMart
Back to Top