本文整理汇总了PHP中UserGroup::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::initialize方法的具体用法?PHP UserGroup::initialize怎么用?PHP UserGroup::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::initialize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_groupcp
function load_groupcp()
{
global $mybb, $db, $cache, $templates, $title, $header, $headerinclude, $footer, $theme, $group;
if ($mybb->settings['rpgsuite_groupmanagecp'] && $mybb->input['action'] == "managegroup") {
// Get group id
if ($mybb->input['gid'] && $mybb->usergroup['issupermod']) {
$gid = intval($mybb->input['gid']);
$groupnav = '&gid=' . $gid;
} else {
$gid = $mybb->user['displaygroup'];
$groupnav = '';
}
$cpcontent = "";
if ($mybb->settings['rpgsuite_groupranks_custom']) {
$customranklink = '<a href="modcp.php?action=managegroup§ion=customranks' . $groupnav . '">Manage Custom Ranks</a>';
} else {
$customranklink = '';
}
$usergroup = new UserGroup($mybb, $db, $cache);
if ($usergroup->initialize($gid)) {
$group = $usergroup->get_info();
if (handle_form($usergroup)) {
$url = "modcp.php?action=managegroup&gid=" . $gid;
if ($mybb->input['section']) {
$url .= "§ion=" . $mybb->input['section'];
}
redirect($url, "Your pack settings were successfully updated.");
}
if ($mybb->input['section'] == 'groupoptions') {
$title = 'Manage Options';
add_breadcrumb('Manage Options');
$cpcontent = load_groupmod_options($usergroup);
} else {
if ($mybb->input['section'] == 'groupmembers') {
$title = 'Manage Members';
add_breadcrumb('Manage Members');
$cpcontent = load_groupmod_members($usergroup);
} else {
if ($mybb->input['section'] == 'customranks' && $mybb->settings['rpgsuite_groupranks_custom']) {
$ttile = 'Manage Custom Ranks';
add_breadcrumb('Manage Custom Ranks');
$cpcontent = load_groupmod_customranks($usergroup);
} else {
$title = 'Manage Ranks';
add_breadcrumb('Manage Ranks');
$cpcontent = load_groupmod_ranks($usergroup);
}
}
}
// Add group styling
eval("\$headerinclude .= \"" . $templates->get('rpgmisc_groupstyle') . "\";");
} else {
$cpcontent = "Invalid Group";
}
eval("\$groupmanagecp = \"" . $templates->get('rpggroupmanagecp_full') . "\";");
output_page($groupmanagecp);
exit;
}
}
示例2: update_display_group
function update_display_group($uid, $gid)
{
global $mybb, $db, $cache;
$usergroup = new UserGroup($mybb, $db, $cache);
if ($usergroup->initialize($gid)) {
$usergroup->add_member($uid);
}
}
示例3: rankview_bit
function rankview_bit($gid)
{
global $db, $mybb, $cache;
$usergroup = new UserGroup($mybb, $db, $cache);
if ($usergroup->initialize($gid)) {
$group = $usergroup->get_info();
if ($group['hasranks']) {
return "Viewing <a href='index.php?action=showranks&gid=" . $gid . "'>" . $group['title'] . " Ranks</a>";
} else {
return "Viewing <a href='index.php?action=showranks&gid=" . $gid . "'>" . $group['title'] . " Members</a>";
}
} else {
return "Viewing <a href='index.php?action=showranks'>Group Members</a>";
}
}
示例4: deny
function deny($userid, $username)
{
global $mybb, $db, $cache;
$group = new UserGroup($mybb, $db, $cache);
$group->initialize(Groups::MEMBER);
$group->add_member($userid);
if (!empty($mybb->settings['rpgsuite_approval_denypm'])) {
$pm_handler = new PMDataHandler();
$pm_handler->admin_override = true;
$pm = array("subject" => $mybb->settings['rpgsuite_approval_denypm_subj'], "message" => $mybb->settings['rpgsuite_approval_denypm'], "fromid" => Accounts::ADMIN, "options" => array("savecopy" => "0"));
$pm['to'] = array($username);
$pm_handler->set_data($pm);
if (!$pm_handler->validate_pm()) {
//bad pm. oops. lol
} else {
$pm_handler->insert_pm();
}
}
}
示例5: viewranks_init
function viewranks_init()
{
global $mybb, $db, $cache, $templates, $header, $footer, $headerinclude, $title, $theme, $parser;
if ($mybb->settings['rpgsuite_groupranks'] && $mybb->input['action'] == "showranks") {
// Get group id
if ($mybb->input['gid'] != '') {
$gid = intval($mybb->input['gid']);
} else {
$gid = $mybb->user['displaygroup'];
}
$usergroup = new UserGroup($mybb, $db, $cache);
if ($usergroup->initialize($gid)) {
$group = $usergroup->get_info();
// Add Group Styling
eval("\$headerinclude .= \"" . $templates->get('rpgmisc_groupstyle') . "\";");
if ($group['hasranks']) {
$title = $group['title'] . " Ranks";
if ($group['fid']) {
add_breadcrumb($group['title'] . ' Forum', 'forumdisplay.php?fid=' . (int) $group['fid']);
}
add_breadcrumb($group['title'] . ' Ranks');
$tierlist = build_ranks($usergroup);
$unrankedlist = build_unranked($usergroup);
eval("\$rankpage = \"" . $templates->get('rpggroupview_ranks_full') . "\";");
output_page($rankpage);
} else {
$title = $group['title'] . " Members";
if ($group['fid']) {
add_breadcrumb($group['title'] . ' Forum', 'forumdisplay.php?fid=' . (int) $group['fid']);
}
add_breadcrumb($group['title'] . ' Members');
// set up the pager
$multipage = setup_viewgroup_pages($group['gid'], $usergroup->get_member_count(), $start);
$memberlist = build_members($usergroup, $start);
eval("\$memberpage = \"" . $templates->get('rpggroupview_noranks_full') . "\";");
output_page($memberpage);
}
exit;
}
}
}
示例6: create_icgroup
/**
Create a new IC Group from given list of attributes
*/
public function create_icgroup($settings)
{
// Get array of all current groups
$othergroups = array();
$groupquery = $this->db->simple_select('usergroups g left join ' . TABLE_PREFIX . 'icgroups i on g.gid = i.gid', '*, g.gid');
while ($og = $this->db->fetch_array($groupquery)) {
$othergroups[] = $og;
}
// Create the group
$group = Creation::USERGROUP;
$group['title'] = $settings['title'];
$group['description'] = $settings['description'];
$group['namestyle'] = $settings['namestyle'];
$group['image'] = $settings['image'];
$this->db->insert_query('usergroups', $group);
$gid = $this->db->insert_id();
// Set permissions on other MO forums to noread
$mopermissions = Creation::FORUM_PERM_NOREAD;
$mopermissions['gid'] = $gid;
foreach ($othergroups as $othergroup) {
if (!empty($othergroup['mo_fid'])) {
$mopermissions['fid'] = $othergroup['mo_fid'];
$this->db->insert_query('forumpermissions', $mopermissions);
}
}
// Set staff forums to noread
$mopermissions['fid'] = Forums::STAFFCATEGORY;
$this->db->insert_query('forumpermissions', $mopermissions);
$fid = $mofid = 0;
if (!empty($settings['region'])) {
$fid_array = $this->create_groupforums($gid, $settings);
$fid = $fid_array['fid'];
$mofid = $fid_array['mofid'];
}
//Create IC group entry
$icgroup = Creation::ICGROUP;
$icgroup['gid'] = $gid;
$icgroup['fid'] = $fid;
$icgroup['mo_fid'] = $mofid;
$icgroup['founded'] = time();
$this->db->insert_query('icgroups', $icgroup);
//Create group customfield entry
$this->db->insert_query('groupfield_values', array('gid' => $gid));
$usergroup = new UserGroup($this->mybb, $this->db, $this->cache);
$usergroup->initialize($gid);
//Add Members
$members = explode(',', $settings['members']);
$pms = explode(',', $settings['pms']);
foreach (array_merge($members, $pms) as $mname) {
if (!empty($mname)) {
$usergroup->add_member_byname($mname);
}
}
//Add & Promote moderators
foreach ($pms as $pm) {
if (!empty($pm)) {
$usergroup->promote_member_byname($pm);
}
}
$this->cache->update_usergroups();
}
示例7: hard_remove_member
/**
Remove a member in an ooc capacity (move to default OOC group)
*/
public function hard_remove_member($uid)
{
$this->demote_member($uid);
$defaultgroup = new UserGroup($this->mybb, $this->db, $this->cache);
if ($defaultgroup->initialize(Groups::MEMBER)) {
$defaultgroup->add_member($uid);
}
}
示例8: die
<?php
// Disallow direct access to this file for security reasons
if (!defined("IN_MYBB")) {
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
require_once MYBB_ROOT . "/inc/plugins/rpg_suite/models/class_UserGroup.php";
require_once MYBB_ROOT . "/inc/plugins/rpg_suite/models/class_RPGSuite.php";
$plugins->run_hooks("admin_rpgsuite_group_begin");
$page->add_breadcrumb_item('Manage Packs', 'index.php?module=rpgsuite-groups');
// Ensure we have a valid group id
$usergroup = new UserGroup($mybb, $db, $cache);
if ($usergroup->initialize((int) $mybb->input['gid'])) {
$group = $usergroup->get_info();
$page->add_breadcrumb_item('Pack: ' . $group['title']);
// Play with group settings! :)
$sub_tabs['settings'] = array('title' => "Settings", 'link' => "index.php?module=rpgsuite-group&action=settings&gid=" . $group['gid'], 'description' => 'Group settings');
$sub_tabs['members'] = array('title' => "Manage Pack Members", 'link' => "index.php?module=rpgsuite-group&action=members&gid=" . $group['gid'], 'description' => "The group's current members");
$sub_tabs['ranks'] = array('title' => "Custom Ranks", 'link' => "index.php?module=rpgsuite-group&action=ranks&gid=" . $group['gid'], 'description' => "The group's custom ranks (can be set even if disallowed, only by admin)");
$sub_tabs['disband'] = array('title' => "Disband Pack", 'link' => "index.php?module=rpgsuite-group&action=disband&gid=" . $group['gid'], 'description' => "Disband this group");
$sub_tabs['relocate'] = array('title' => "Relocate Pack", 'link' => "index.php?module=rpgsuite-group&action=relocate&gid=" . $group['gid'], 'description' => "Relocate to another territory.");
// define this variable so our forms get updated
$ranktable = $usergroup->get_ranks(1);
// FIRST let's handle any submits....
if ($mybb->request_method == "post") {
if ($mybb->input['action'] == 'relocate') {
$settings = array('title' => $db->escape_string($mybb->input['title']), 'region' => $db->escape_string($mybb->input['region']), 'prefix' => $db->escape_string($mybb->input['prefix']));
$usergroup->relocate($settings);
flash_message("Group Relocated", "success");
admin_redirect("index.php?module=rpgsuite-group&action=settings&gid=" . $group['gid']);
} else {