2016-04-02, 04:53 PM
(This post was last modified: 2016-04-02, 04:56 PM by Donald_Duck.)
(2016-04-02, 03:35 PM)24Sevn Wrote: Could someone make this for Bitcoins too? Would really appreciate it!
https://github.com/blockchain/receive-pa...master/php
And to move the buyer to specific group:
Replace the following lines (587-589) in inc/plugins/mysubs.php
https://github.com/EthanDelong/MySubscri...#L587-L589
replace with this code, where "999" is the ID of your custom group.
// This is the ID of the custom usergroup which has all of the extra perks (Thread permissions, PM Quota, etc..)
$additional_group = 999;
$gids = explode(',', $user['additionalgroups']);
if (!in_array($additional_group, $gids)) {
$gids[] = $additional_group;
}
$update_data = array(
'usergroup' => intval($item['new_group']),
'additionalgroups' => implode(',', $gids)
);
This will add the custom group to the user who purchases the subscription when the order is processed on your server.
If you want to remove the additional group when the subscription expires:
Replace the following line (33) in inc/tasks/mysubs.php
https://github.com/EthanDelong/MySubscri...bs.php#L33
Replace it with the following code:
$additional_group = 999;
$temp_user = get_user($sub['uid']);
$gids = explode(',', $temp_user['additionalgroups']);
if (($key = array_search($additional_group, $gids)) !== false) {
unset($gids[$key]);
}
$db->update_query('users', array('usergroup' => $sub['old_gid'], 'additionalgroups' => implode(',', $gids)), "`uid` = {$sub['uid']}");
Again, "999" is the same ID of the custom group which will be removed when the subscription is automatically removed.
Developing Plugins 開発プラグイン