当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_Groups_Member::promote方法代码示例

本文整理汇总了PHP中BP_Groups_Member::promote方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Member::promote方法的具体用法?PHP BP_Groups_Member::promote怎么用?PHP BP_Groups_Member::promote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Groups_Member的用法示例。


在下文中一共展示了BP_Groups_Member::promote方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_group_access_test_friends

 /**
  * @group invite_anyone_group_invite_access_test
  *
  * Using this as a proxy for testing every possible combination
  */
 public function test_group_access_test_friends()
 {
     $settings = bp_get_option('invite_anyone');
     bp_update_option('invite_anyone', array('group_invites_can_admin' => 'friends', 'group_invites_can_group_admin' => 'friends', 'group_invites_can_group_mod' => 'friends', 'group_invites_can_group_member' => 'friends'));
     unset($GLOBALS['iaoptions']);
     $g = $this->factory->group->create();
     $u1 = $this->factory->user->create(array('role' => 'administrator'));
     $this->add_user_to_group($u1, $g);
     $u2 = $this->factory->user->create();
     $this->add_user_to_group($u2, $g);
     $u3 = $this->factory->user->create();
     $this->add_user_to_group($u3, $g);
     $m3 = new BP_Groups_Member($u3, $g);
     $m3->promote('mod');
     $u4 = $this->factory->user->create();
     $this->add_user_to_group($u4, $g);
     $m4 = new BP_Groups_Member($u4, $g);
     $m4->promote('admin');
     $user = new WP_User($u1);
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u1));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u2));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u3));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u4));
     bp_update_option('invite_anyone', $settings);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:30,代码来源:test-sample.php

示例2: bp_group_management_promote_member

function bp_group_management_promote_member($user_id, $group_id, $status)
{
    global $bp;
    $member = new BP_Groups_Member($user_id, $group_id);
    do_action('groups_promote_member', $group_id, $user_id, $status);
    return $member->promote($status);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:7,代码来源:bp-group-management-aux.php

示例3: groups_promote_member

/**
 * Promote a member to a new status within a group.
 *
 * @param int    $user_id  ID of the user.
 * @param int    $group_id ID of the group.
 * @param string $status   The new status. 'mod' or 'admin'.
 *
 * @return bool True on success, false on failure.
 */
function groups_promote_member($user_id, $group_id, $status)
{
    if (!bp_is_item_admin()) {
        return false;
    }
    $member = new BP_Groups_Member($user_id, $group_id);
    // Don't use this action. It's deprecated as of BuddyPress 1.6.
    do_action('groups_premote_member', $group_id, $user_id, $status);
    /**
     * Fires before the promotion of a user to a new status.
     *
     * @since 1.6.0
     *
     * @param int    $group_id ID of the group being promoted in.
     * @param int    $user_id  ID of the user being promoted.
     * @param string $status   New status being promoted to.
     */
    do_action('groups_promote_member', $group_id, $user_id, $status);
    return $member->promote($status);
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:29,代码来源:bp-groups-functions.php

示例4: test_user_can_dissociate_from_group_within_group_mod

 /**
  * @group map_meta_cap
  * @group dissociate_from_group
  */
 public function test_user_can_dissociate_from_group_within_group_mod()
 {
     $g = $this->factory->group->create();
     $old_current_user = get_current_user_id();
     $u1 = $this->factory->user->create();
     $gm1 = new BP_Groups_Member($u1, $g);
     $gm1->promote('admin');
     $this->set_current_user($u1);
     $this->go_to(bp_get_group_permalink(groups_get_group(array('group_id' => $g))));
     // $this->go_to( bp_docs_get_doc_link( $post_id ) );
     $this->assertTrue(current_user_can('bp_docs_dissociate_from_group'));
 }
开发者ID:Apatrid,项目名称:buddypress-docs,代码行数:16,代码来源:test-permissions.php

示例5: groups_promote_member

function groups_promote_member($user_id, $group_id, $status)
{
    if (!bp_is_item_admin()) {
        return false;
    }
    $member = new BP_Groups_Member($user_id, $group_id);
    // Don't use this action. It's deprecated as of BuddyPress 1.6.
    do_action('groups_premote_member', $group_id, $user_id, $status);
    // Use this action instead.
    do_action('groups_promote_member', $group_id, $user_id, $status);
    return $member->promote($status);
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:12,代码来源:bp-groups-functions.php

示例6: test_with_group_role_member_mod_admin_banned

 public function test_with_group_role_member_mod_admin_banned()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $u3 = $this->factory->user->create();
     $u4 = $this->factory->user->create();
     $g = $this->factory->group->create(array('creator_id' => $u1));
     $time = time();
     $this->add_user_to_group($u1, $g, array('date_modified' => gmdate('Y-m-d H:i:s', $time - 100)));
     $this->add_user_to_group($u2, $g, array('date_modified' => gmdate('Y-m-d H:i:s', $time - 200)));
     $this->add_user_to_group($u3, $g, array('date_modified' => gmdate('Y-m-d H:i:s', $time - 300)));
     $this->add_user_to_group($u4, $g, array('date_modified' => gmdate('Y-m-d H:i:s', $time - 300)));
     $m1 = new BP_Groups_Member($u1, $g);
     $m1->promote('admin');
     $m2 = new BP_Groups_Member($u2, $g);
     $m2->promote('mod');
     $m3 = new BP_Groups_Member($u3, $g);
     $m3->ban();
     $query_members = new BP_Group_Member_Query(array('group_id' => $g, 'group_role' => array('member', 'mod', 'admin', 'banned')));
     $ids = wp_parse_id_list(array_keys($query_members->results));
     $this->assertEquals(array($u1, $u2, $u3, $u4), $ids);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:22,代码来源:class-bp-group-member-query.php

示例7: test_groups_leave_group_multiple_admins_allow_leave

 /**
  * @group groups_leave_group
  * @group group_membership
  */
 public function test_groups_leave_group_multiple_admins_allow_leave()
 {
     $old_current_user = get_current_user_id();
     $u1 = $this->factory->user->create();
     $g = $this->factory->group->create(array('creator_id' => $u1));
     $u2 = $this->factory->user->create();
     $this->add_user_to_group($u2, $g);
     $m2 = new BP_Groups_Member($u2, $g);
     $m2->promote('admin');
     $before = groups_get_total_member_count($g);
     $this->set_current_user($u1);
     groups_leave_group($g, $u1);
     $after = groups_get_total_member_count($g);
     $this->assertEquals($before - 1, $after);
     $this->set_current_user($old_current_user);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:20,代码来源:class-bp-groups-member.php

示例8: groups_promote_member

function groups_promote_member($user_id, $group_id, $status)
{
    global $bp;
    if (!$bp->is_item_admin) {
        return false;
    }
    $member = new BP_Groups_Member($user_id, $group_id);
    do_action('groups_premote_member', $group_id, $user_id, $status);
    return $member->promote($status);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:10,代码来源:bp-groups-functions.php

示例9: groups_promote_member

function groups_promote_member($user_id, $group_id)
{
    global $bp;
    /* Check the nonce first. */
    if (!check_admin_referer('groups_promote_member')) {
        return false;
    }
    if (!$bp->is_item_admin) {
        return false;
    }
    $member = new BP_Groups_Member($user_id, $group_id);
    do_action('groups_premote_member', $user_id, $group_id);
    return $member->promote();
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:14,代码来源:bp-groups.php

示例10: test_user_can_see_nav_item_explicit_for_group_admin

 /**
  * @group user_can_see_nav_item
  */
 public function test_user_can_see_nav_item_explicit_for_group_admin()
 {
     $g = $this->factory->group->create(array('status' => 'public'));
     $g_obj = groups_get_group(array('group_id' => $g));
     $u = $this->factory->user->create();
     $old_current_user = get_current_user_id();
     $this->set_current_user($u);
     $this->add_user_to_group($u, $g);
     $gm = new BP_Groups_Member($u, $g);
     $gm->promote('admin');
     $this->go_to(bp_get_group_permalink($g_obj));
     $e1 = new BPTest_Group_Extension_ShowTab_Anyone();
     $e1->_register();
     $this->assertTrue($e1->user_can_see_nav_item());
     $e2 = new BPTest_Group_Extension_ShowTab_Loggedin();
     $e2->_register();
     $this->assertTrue($e2->user_can_see_nav_item());
     $e3 = new BPTest_Group_Extension_ShowTab_Member();
     $e3->_register();
     $this->assertTrue($e3->user_can_see_nav_item());
     $e4 = new BPTest_Group_Extension_ShowTab_AdminMod();
     $e4->_register();
     $this->assertTrue($e4->user_can_see_nav_item());
     $e5 = new BPTest_Group_Extension_ShowTab_Admin();
     $e5->_register();
     $this->assertTrue($e5->user_can_see_nav_item());
     $e6 = new BPTest_Group_Extension_ShowTab_Noone();
     $e6->_register();
     $this->assertFalse($e6->user_can_see_nav_item());
     $this->set_current_user($old_current_user);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:34,代码来源:class-bp-group-extension.php

示例11: test_bp_group_has_members_with_exclude_admins_mods_0

 /**
  * @group bp_group_has_members
  */
 public function test_bp_group_has_members_with_exclude_admins_mods_0()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $u3 = $this->factory->user->create();
     $g = $this->factory->group->create(array('creator_id' => $u1));
     $now = time();
     $this->add_user_to_group($u2, $g, array('date_modified' => date('Y-m-d H:i:s', $now - 60)));
     $this->add_user_to_group($u3, $g, array('date_modified' => date('Y-m-d H:i:s', $now - 60 * 60)));
     $m1 = new BP_Groups_Member($u1, $g);
     $m1->promote('admin');
     $m2 = new BP_Groups_Member($u2, $g);
     $m2->promote('mod');
     global $members_template;
     bp_group_has_members(array('group_id' => $g, 'exclude_admins_mods' => 0));
     $ids = wp_parse_id_list(wp_list_pluck($members_template->members, 'user_id'));
     $this->assertEquals(array($u1, $u2, $u3), $ids);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:21,代码来源:template.php

示例12:

 function settings_screen_save($group_id = NULL)
 {
     global $bp;
     // Make sure we have the group ID
     $group_id = $_POST['group_id'];
     if (!$group_id) {
         $group_id = $bp->groups->current_group->id;
     }
     // Set error redirect based on save method
     $redirect_url = $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $this->slug;
     // Email cannot be empty
     if (empty($_POST['editable-guild-leader'])) {
         bp_core_add_message('You must enter a valid email address.', 'error');
         bp_core_redirect($redirect_url);
         exit;
     }
     // Make sure the nonce checks
     check_admin_referer('groups_create_save_' . $this->slug);
     // Get the leader by email
     $leader_email = sanitize_email($_POST['editable-guild-leader']);
     $leader = get_user_by('email', $leader_email);
     // If we don't recognize the email, bail out
     if (empty($leader)) {
         bp_core_add_message('This email address is not recognized.', 'error');
         bp_core_redirect($redirect_url);
         exit;
     }
     // Otherwise, set the group leader, and remove the creator
     $leader_id = $leader->ID;
     if ($leader_id != get_current_user_id()) {
         groups_accept_invite($leader_id, $group_id);
         $member = new BP_Groups_Member($leader_id, $group_id);
         $member->promote('admin');
         groups_leave_group($group_id, $creator_id);
     }
 }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:36,代码来源:groups.php

示例13: test_associate_with_group_admin

 /**
  * @group user_can_associate_doc_with_group
  * @expectedDeprecated user_can_associate_doc_with_group
  */
 public function test_associate_with_group_admin()
 {
     $g = $this->factory->group->create();
     $d = $this->factory->doc->create(array('group' => $g));
     groups_update_groupmeta($g, 'bp-docs', array('can-create' => 'admin'));
     $u1 = $this->create_user();
     $this->add_user_to_group($u1, $g);
     $this->assertFalse(BP_Docs_Groups_Integration::user_can_associate_doc_with_group($u1, $g));
     $u2 = $this->create_user();
     $this->add_user_to_group($u2, $g);
     $gm2 = new BP_Groups_Member($u2, $g);
     $gm2->promote('mod');
     $this->assertFalse(BP_Docs_Groups_Integration::user_can_associate_doc_with_group($u2, $g));
     $u3 = $this->create_user();
     $this->add_user_to_group($u3, $g);
     $gm3 = new BP_Groups_Member($u3, $g);
     $gm3->promote('admin');
     $this->assertTrue(BP_Docs_Groups_Integration::user_can_associate_doc_with_group($u3, $g));
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:23,代码来源:test-permissions.php


注:本文中的BP_Groups_Member::promote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。