Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Group Subscriptions
Author Message
Dalton
Super Moderator


Posts: 478
Joined: Aug 2008
Reputation: 3
Post: #31
RE: Group Subscriptions

Chicago Bears
4-3

[Image: Dalton23.jpg]
Do NOT P.M. me for help. Create a topic.
10-07-2008 09:15 PM
Mte90
Junior Member


Posts: 21
Joined: Oct 2008
Reputation: 0
Post: #32
RE: Group Subscriptions
Good module!
10-08-2008 05:58 AM
LaptopFreak
Junior Member


Posts: 26
Joined: Sep 2008
Reputation: 0
Post: #33
RE: Group Subscriptions
This is buggy! I activate the plugin, and I can't access UserCP, giving me the page when people get suspended for privillages when I'm the only person in the forum!

10-08-2008 05:22 PM
Dalton
Super Moderator


Posts: 478
Joined: Aug 2008
Reputation: 3
Post: #34
RE: Group Subscriptions
Yeah, don't deactivate though. Because when you reactivate it makes another set of settings. (By general configuration, board offline/online, etc.)

Chicago Bears
4-3

[Image: Dalton23.jpg]
Do NOT P.M. me for help. Create a topic.
10-08-2008 09:37 PM
LaptopFreak
Junior Member


Posts: 26
Joined: Sep 2008
Reputation: 0
Post: #35
RE: Group Subscriptions
If I don't deactivate it, I can't even access UserCP..

10-08-2008 10:38 PM
Nickman
Administrator



Posts: 679
Joined: May 2008
Reputation: 14
Post: #36
RE: Group Subscriptions
Hmmm..Perhaps I forgot to update the main file. Please try the file here



Everything-Network.com Owner || My Blog
10-09-2008 01:34 AM
Dalton
Super Moderator


Posts: 478
Joined: Aug 2008
Reputation: 3
Post: #37
RE: Group Subscriptions
Agh crap. Wrong topic, my bad. Meant for MyBank.. I could've sworn that's what this was..

Chicago Bears
4-3

[Image: Dalton23.jpg]
Do NOT P.M. me for help. Create a topic.
10-09-2008 06:56 AM
Mte90
Junior Member


Posts: 21
Joined: Oct 2008
Reputation: 0
Post: #38
RE: Group Subscriptions
i had the problem that not access to usercp but i have upload the file in this topic and now work but i have a blank page on usercp.php?action=groupsub
(This post was last modified: 10-09-2008 07:47 AM by Mte90.)
10-09-2008 07:46 AM
Nickman
Administrator



Posts: 679
Joined: May 2008
Reputation: 14
Post: #39
RE: Group Subscriptions
And you activated the plugin and setting Enable to on through the settings?



Everything-Network.com Owner || My Blog
10-09-2008 08:28 AM
LaptopFreak
Junior Member


Posts: 26
Joined: Sep 2008
Reputation: 0
Post: #40
RE: Group Subscriptions
(10-09-2008 01:34 AM)Nickman Wrote:  Hmmm..Perhaps I forgot to update the main file. Please try the file here

Go to that link and check out my reply..
(09-10-2008 07:33 AM)Nickman Wrote:  Can you try the attached?

add_hook("usercp_start", "groupsub_usercp"); $plugins->add_hook("admin_formcontainer_output_row","groupsub_edit"); $plugins->add_hook("admin_user_groups_edit_commit","groupsub_do_edit"); function groupsub_info() { return array( "name" => "[MyCredits] Group Subscriptions", "description" => "Allows your users to pay (credits) in order to stay in a usergroup", "website" => "http://www.mybbsource.com", "author" => "Nickman", "authorsite" => "http://mybbsource.com", "version" => "1.0" ); } function groupsub_activate() { global $db; $db->query(" INSERT INTO `mybb_tasks` (`tid`, `title`, `description`, `file`, `minute`, `hour`, `day`, `month`, `weekday`, `nextrun`, `lastrun`, `enabled`, `logging`, `locked`) VALUES ('', 'Group Subscriptions', 'For the group subscriptions plugin', 'groupsub', '*', '*', '1', '*', '*', 1222812000, 0, 1, 1, 0);"); $db->query("ALTER TABLE `".TABLE_PREFIX."usergroups` ADD `can_buy_into` INT NOT NULL DEFAULT '0', ADD `initial_price` INT NOT NULL , ADD `per_month` INT NOT NULL ;"); $db->query("CREATE TABLE `".TABLE_PREFIX."groupsubs` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `uid` INT NOT NULL , `bought_into` INT NOT NULL , `charge` INT NOT NULL , `old_gid` INT NOT NULL );"); $groupsub_group = array( 'gid' => 'NULL', 'name' => 'groupsub', 'title' => '[MyCredits] Group Subscriptions', 'description' => 'Settings For The Group Subscriptions Plugin', 'disporder' => 1, 'isdefault' => 'no', ); $db->insert_query('settinggroups', $groupsub_group); $gid = $db->insert_id(); $groupsub_setting_1 = array( 'sid' => 'NULL', 'name' => 'enablegroupsub', 'title' => 'Enable Group Subscriptions plugin', 'description' => 'If set to no, no credits will be taken and no one will be allowed to buy into usergroups', 'optionscode' => 'yesno', 'value' => 'yes', 'disporder' => 1, 'gid' => intval($gid), ); $db->insert_query('settings', $groupsub_setting_1); require MYBB_ROOT."/inc/adminfunctions_templates.php"; find_replace_templatesets("usercp_nav_misc", '##', 'Group Subscription Options'); } function groupsub_deactivate() { global $db; $db->query("DELETE FROM ".TABLE_PREFIX."tasks WHERE title='Group Subscriptions'"); $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='groupsub'"); $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='enablegroupsub'"); $db->query("DROP TABLE `".TABLE_PREFIX."groupsubs`"); $db->query("ALTER TABLE `".TABLE_PREFIX."usergroups` DROP `can_buy_into`, DROP `initial_price`, DROP `per_month`;"); } function groupsub_usercp() { global $mybb,$db,$headerinclude,$header,$usercpnav,$theme,$footer; $name=$mybb->settings['credits_name']; if ($mybb->settings['enablegroupsub'] != '1') { return; } if ($mybb->input['action'] == "groupsub") { $currentsub=$db->fetch_array($db->simple_select("groupsubs","*","uid='{$mybb->user['uid']}'")); if ($currentsub['bought_into'] != '') { $usergroup=$db->fetch_array($db->simple_select("usergroups","title","gid='{$currentsub['bought_into']}'")); $box=<<
Your Current Subscription
You Are Currently Being Charged $currentsub[charge] $name to be apart of the {$usergroup['title']} group. (Unsubscribe)
EOL; } else { $getGroups=$db->simple_select("usergroups","*","gid != '{$mybb->user['usergroup']}' AND can_buy_into='1'"); while ($group = $db->fetch_array($getGroups)) { $options.="$group[title] Costs $group[initial_price] Intially and $group[per_month] monthly"; } if ($options == '') { $options="No Groups Available"; } $box=<<
Buy Access Into A Group
Available Groups:
EOL; } $page= << {$headerinclude} {$header} {$usercpnav}
{$errors} {$box}
{$footer} HERE; output_page($page); } elseif ($mybb->input['action'] == 'do_groupsub') { $group=$db->escape_string($mybb->input['group']); $usergroup=$db->fetch_array($db->simple_select("usergroups",'*',"gid='$group'")); if ($mybb->user['credits'] < $usergroup['initial_price']) { error("You do not have enough $name to buy into this group."); } else { $old=$mybb->user['usergroup']; $new=$mybb->user['credits']-$usergroup['initial_price']; $db->update_query("users",array("credits"=>$new,"usergroup"=>$group),"uid='{$mybb->user['uid']}'"); $db->insert_query("groupsubs",array("uid"=>$mybb->user['uid'],"bought_into"=>$group,"charge"=>$usergroup['per_month'],"old_gid"=>$old)); } redirect("usercp.php?action=groupsub","Successfully Bought Access Into This Usergroup"); } elseif ($mybb->input['action'] == 'groupunsub') { $check=$db->simple_select("groupsubs","*","uid='{$mybb->user['uid']}' AND id='".intval($_GET['id'])."'"); if ($db->num_rows($check) == 1) { $group=$db->fetch_array($check); $db->update_query("users",array("usergroup"=>$group['old_gid']),"uid='{$mybb->user[uid]}'"); $db->query("DELETE FROM ".TABLE_PREFIX."groupsubs WHERE id='".intval($_GET['id'])."'"); redirect("usercp.php?action=groupsub","Successfully Deleted Subscription"); } else { error_no_permission(); } } } function groupsub_edit(&$row) { global $form_container,$module,$form,$mybb; $module=$_GET['module']; if ($module == 'user/groups') { if ($_GET['action'] == 'edit') { if($row['label_for'] == 'description') { $form_container->output_row("Can Buy Access?", "Allow users to buy access into this group?", $form->generate_yes_no_radio('can_buy_into', $mybb->input['can_buy_into'], array('id' => 'can_buy_into')), 'can_buy_into'); $form_container->output_row("Initial Charge", "How much will the user be charged the second he buys access", $form->generate_text_box('initial_price', $mybb->input['initial_price'], array('id' => 'initial_price')), 'initial_price'); $form_container->output_row("Per Month Charge", "How much will the user be charged per month", $form->generate_text_box('per_month', $mybb->input['per_month'], array('id' => 'per_month')), ''); } return; } } } function groupsub_do_edit() { global $db,$mybb,$updated_group; $updated_group['can_buy_into']=intval($mybb->input['can_buy_into']); $updated_group['initial_price']=intval($mybb->input['initial_price']); $updated_group['per_month']=intval($mybb->input['per_month']); return $updated_group; }

(This post was last modified: 10-09-2008 01:10 PM by LaptopFreak.)
10-09-2008 01:10 PM
 


Forum Jump: