Would this type of code work with 3.6.8.pl2?
With this hack you can specify which usergroups can access to each paid subscription. If you don?t specify at least one usergroup the subscription will not be avalaible. Remember to edit your previous subscriptions or they will be unavailable.
1 query to run
1 phrase to add
2 files to edit
-------- PHRASE-----------
In Subscription Tools add a new phrase:
---------------------------------------------------------------
Varname: forusergroups
Text: Avalaible for usergroups. Example: 2,5,6,7
---------------------------------------------------------------
-------- QUERY -----------
Run this query to add a new definition (forusergroups) in table subscription:
---------------------------------------------------------------
ALTER TABLE subscription ADD forusergroups MEDIUMTEXT NOT NULL AFTER description;
---------------------------------------------------------------
-------- EDITIONS ----------
In Admincp/subscriptions.php
AFTER:
---------------------------------------------------------------
print_textarea_row($vbphrase['description'], 'sub[description]', $sub['description']);
---------------------------------------------------------------
ADD this to can input value of "forusergroups" in "Subscription Manager" of Admin CP:
---------------------------------------------------------------
print_input_row($vbphrase['forusergroups'], 'sub[forusergroups]', $sub['forusergroups']);
---------------------------------------------------------------
In forum/subscriptions.php
AFTER:
----------------------------------------------------------------
foreach ($subscriptioncache AS $subscription)
{
$show['will_extend'] = false;
----------------------------------------------------------------
ADD:
----------------------------------------------------------------
$forusergroups = $subscription['forusergroups'];
$forusergroupsarray = explode(",", $forusergroups);
----------------------------------------------------------------
FIND:
----------------------------------------------------------------
if ($subscription['active']
----------------------------------------------------------------
and REPLACE with:
----------------------------------------------------------------
if ($subscription['active'] AND in_array($bbuserinfo['usergroupid'], $forusergroupsarray))
----------------------------------------------------------------
#####################################
Remember to edit the previous subscription or they will not be available.
coded by
https://vborg.vbsupport.ru/showthread.php?t=81854