Quote:
Originally Posted by MarcoH64
Well i don't know the contents of your $case array.
It would really help if you posted a bit more code snippets.
|
Well, you have asked it

This is the real thing, not an example.
In Subscription Tools add a new phrase:
Code:
Varname: forusergroups
Text: Avalaible only for these usergroups
Run this query to add a new definition (forusergroups) in table subscription:
Code:
ALTER TABLE subscription ADD forusergroups varchar(255) NOT NULL AFTER description
In Admincp/subscriptions.php:
FIND:
PHP Code:
print_textarea_row($vbphrase['description'], 'sub[description]', $sub['description']);
And ADD this to can input value of "forusergroups" in "Subscription Manager" of Admin CP:
PHP Code:
print_input_row($vbphrase['forusergroups'], 'sub[forusergroups]', $sub['forusergroups']);
In forum/subscriptions.php, AFTER:
PHP Code:
foreach ($subscriptioncache AS $subscription)
{
$show['will_extend'] = false;
ADD:
PHP Code:
$forusergroups = $subscription['forusergroups'];
------------- ACLARATION BEGINS ----------------
$subscription is got from /includes/functions_subscriptions.php:
PHP Code:
function cache_user_subscriptions()
{
global $DB_site, $subscriptioncache;
if (!is_array($subscriptioncache))
{
$subscriptioncache = array();
$subscriptions = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "subscription");
while ($subscription = $DB_site->fetch_array($subscriptions))
{
$subscriptioncache["$subscription[subscriptionid]"] = $subscription;
}
$DB_site->free_result($subscriptions);
}
}
------------- ACLARATION ENDS -------------------
Now go to template "subscription_availablebit"
BEFORE all the template ADD:
Code:
<if condition="is_member_of($bbuserinfo, $forusergroups)">
And AFTER all the template, ADD:
For each subscription there is a "forusergroups" with the value you want, for example: 3 or 5,6,7 or 2,4 or 2,4,5,6,7,8 etc, this is, the usergroups for which this subscription will be available.
And here we are, it must be work but not, the value in $forusergroups is correct but it is not ok into the conditional; if I put $forusergroups in another place in the template shows the correct value.
Remember I am using the "is_member_of improvement" hack of merk (
http://<br />
https://vborg.vbsuppo...ad.php?t=61149) This hack is working OK as I see changing $forusergroups for "4,5,6" for example.
------------- ACLARATION BEGINS -----------------
I also have tried putting a conditional in /forum/subscriptions.php besides:
Code:
if ($subscription['active'])
but it does not work
*********** CORRECTION 1 ************
It works only if array is of only ONE number, for example: 2 or 6 but nor 2,6
------------- ACLARATION ENDS -------------------
I think this is all the info
Thanks very much.
--- Edited to add the correction 1 ---
---------