How to pull the cost of usergroup subscription


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

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


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.





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




Code (php)
{
$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;
}


query → query_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
- 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.


Chris Graham said
query returns a list of row maps.
query → query_value_if_there
From “Post #4,858”, 19th August 2018, 8:38 pm
That worked, thanks Chris.
I had to remove the LIMIT 1 from the query for it to work as well.