How to pull the cost of usergroup subscription
Posted
#4566
(In Topic #920)
...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.
Posted
Last edit: by Chris Graham
Posted
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.
Posted
Posted
I did make a typo in my post though, I'm editing it.
Posted
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;
}
{
$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;
}
Posted
query → query_value_if_there
Posted
Chris Graham said
That worked, thanks Chris.
I had to remove the LIMIT 1 from the query for it to work as well.
1 guest and 0 members have recently viewed this.
