Ejemplo n.º 1
0
			<?php 
    bp_members_pagination_links();
    ?>

		</div>

	</div>

	<?php 
    do_action('bp_before_group_members_list');
    ?>

	<ul id="member-list" class="item-list" role="main">

		<?php 
    while (bp_group_members()) {
        bp_group_the_member();
        ?>

			<li>
				<a href="<?php 
        bp_group_member_domain();
        ?>
">

					<?php 
        bp_group_member_avatar_thumb();
        ?>

				</a>
Ejemplo n.º 2
0
/**
 * Fetch a list of site members eligible to be invited to a group.
 *
 * The list is essentially a list of everyone on the site, minus the logged in user and members
 * of the current group.
 *
 * @package Invite Anyone
 * @since 1.0
 *
 * @param int $group_id The group_id you want to exclude
 * @param str $search_terms If you want to search on username/display name
 * @return array $users An array of located users
 */
function invite_anyone_invite_query($group_id = false, $search_terms = false, $fields = 'all')
{
    // Get a list of group members to be excluded from the main query
    $group_members = array();
    $args = array('group_id' => $group_id, 'exclude_admins_mods' => false);
    if ($search_terms) {
        $args['search'] = $search_terms;
    }
    if (bp_group_has_members($args)) {
        while (bp_group_members()) {
            bp_group_the_member();
            $group_members[] = bp_get_group_member_id();
        }
    }
    // Don't include the logged-in user, either
    $group_members[] = bp_loggedin_user_id();
    $fields = 'ID' == $fields ? 'ID' : 'all';
    // Now do a user query
    // Pass a null blog id so that the capabilities check is skipped. For BP blog_id doesn't
    // matter anyway
    $user_query = new Invite_Anyone_User_Query(array('blog_id' => NULL, 'exclude' => $group_members, 'search' => $search_terms, 'fields' => $fields));
    return $user_query->results;
}
Ejemplo n.º 3
0
 function user_list_html($html, $selected)
 {
     if (bp_group_has_members(array('exclude_admins_mods' => false, 'per_page' => false, 'max' => false))) {
         global $members_template;
         usort($members_template->members, array(&$this, 'sort_by_display_name_cb'));
         $html = '<select name="cp-task-assign" id="cp-task-assign">';
         while (bp_group_members()) {
             bp_group_the_member();
             $html .= '<option value="' . bp_get_group_member_id() . '" ' . selected(bp_get_group_member_id(), $selected, false) . '>' . bp_get_group_member_name() . '</option>';
         }
         $html .= '</select>';
     }
     return $html;
 }
Ejemplo n.º 4
0
/**
 * bp_groupblog_member_join( $group_id )
 *
 * Runs whenever member permissions are changed and saved - by Boone
 */
function bp_groupblog_member_join($group_id)
{
    $params = array('exclude_admins_mods' => 0, 'per_page' => 10000, 'group_id' => $group_id);
    if (bp_group_has_members($params)) {
        $blog_id = groups_get_groupmeta($group_id, 'groupblog_blog_id');
        $group = groups_get_group(array('group_id' => $group_id));
        while (bp_group_members()) {
            bp_group_the_member();
            $user_id = bp_get_group_member_id();
            if ($group->creator_id != $user_id) {
                bp_groupblog_upgrade_user($user_id, $group_id, $blog_id);
            }
        }
    }
}
Ejemplo n.º 5
0
function groups_ajax_member_admin_list()
{
    global $bp;
    ?>
	
	<?php 
    if (bp_group_has_members('group_id=' . $_REQUEST['group_id'] . '&per_page=' . $_REQUEST['num'])) {
        ?>
	
		<?php 
        if (bp_group_member_needs_pagination()) {
            ?>
			<div id="member-count" class="pag-count">
				<?php 
            bp_group_member_pagination_count();
            ?>
			</div>

			<div id="member-admin-pagination" class="pagination-links">
				<?php 
            bp_group_member_admin_pagination();
            ?>
			</div>
		<?php 
        }
        ?>
	
		<ul id="members-list" class="item-list single-line">
		<?php 
        while (bp_group_members()) {
            bp_group_the_member();
            ?>
			<?php 
            if (bp_group_member_is_banned()) {
                ?>
				<li class="banned-user">
					<?php 
                bp_group_member_avatar_mini();
                ?>

					<h5><?php 
                bp_group_member_link();
                ?>
 <?php 
                _e('(banned)', 'buddypress');
                ?>
 <span class="small"> &mdash; <a href="<?php 
                bp_group_member_unban_link();
                ?>
" title="<?php 
                _e('Kick and ban this member', 'buddypress');
                ?>
"><?php 
                _e('Remove Ban', 'buddypress');
                ?>
</a> </h5>
			<?php 
            } else {
                ?>
				<li>
					<?php 
                bp_group_member_avatar_mini();
                ?>
					<h5><?php 
                bp_group_member_link();
                ?>
  <span class="small"> &mdash; <a href="<?php 
                bp_group_member_ban_link();
                ?>
" title="<?php 
                _e('Kick and ban this member', 'buddypress');
                ?>
"><?php 
                _e('Kick &amp; Ban', 'buddypress');
                ?>
</a> | <a href="<?php 
                bp_group_member_promote_link();
                ?>
" title="<?php 
                _e('Promote this member', 'buddypress');
                ?>
"><?php 
                _e('Promote to Moderator', 'buddypress');
                ?>
</a></span></h5>

			<?php 
            }
            ?>
				</li>
		<?php 
        }
        ?>
		</ul>
	<?php 
    } else {
        ?>

		<div id="message" class="info">
			<p><?php 
        _e('This group has no members.', 'buddypress');
        ?>
</p>
		</div>

	<?php 
    }
    ?>
	<input type="hidden" name="group_id" id="group_id" value="<?php 
    echo attribute_escape($_REQUEST['group_id']);
    ?>
" />
<?php 
}
function bp_group_management_admin_edit()
{
    ?>
	<div class="wrap">
<?php 
    $id = (int) $_GET['id'];
    $group = new BP_Groups_Group($id, true);
    $member_action = isset($_GET['member_action']) ? $_GET['member_action'] : false;
    $member_id = isset($_GET['member_id']) ? $_GET['member_id'] : false;
    switch ($member_action) {
        case "kick":
            if (!check_admin_referer('bp-group-management-action_kick')) {
                return false;
            }
            if (!bp_group_management_ban_member($member_id, $id)) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>';
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Member kicked and banned', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            do_action('groups_banned_member', $member_id, $id);
            break;
        case "unkick":
            if (!check_admin_referer('bp-group-management-action_unkick')) {
                return false;
            }
            if (!bp_group_management_unban_member($member_id, $id)) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Member unbanned', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            do_action('groups_banned_member', $member_id, $id);
            break;
        case "demote":
            if (!check_admin_referer('bp-group-management-action_demote')) {
                return false;
            }
            if (!groups_demote_member($member_id, $id)) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Member demoted', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            do_action('groups_demoted_member', $member_id, $id);
            break;
        case "mod":
            if (!check_admin_referer('bp-group-management-action_mod')) {
                return false;
            }
            if (!bp_group_management_promote_member($member_id, $id, 'mod')) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Member promoted to moderator', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            do_action('groups_promoted_member', $member_id, $id);
            break;
        case "admin":
            if (!check_admin_referer('bp-group-management-action_admin')) {
                return false;
            }
            if (!bp_group_management_promote_member($member_id, $id, 'admin')) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Member promoted to admin', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            break;
        case "add":
            if (!check_admin_referer('bp-group-management-action_add')) {
                return false;
            }
            if (!bp_group_management_join_group($id, $member_id)) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('User added to group', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            break;
        case "remove":
            if (!check_admin_referer('bp-group-management-action_remove')) {
                return false;
            }
            if (!groups_leave_group($id, $_GET['member_id'])) {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('Sorry, there was an error.', 'bp-group-management');
                ?>
</p></div>
			<?php 
            } else {
                ?>
				<div id="message" class="updated fade"><p><?php 
                _e('User removed from group', 'bp-group-management');
                ?>
</p></div>
			<?php 
            }
            break;
        default:
            do_action('bp_gm_member_action', $group, $id, $member_action, $member_id);
            break;
    }
    ?>


	    <h2><?php 
    _e('Group Management', 'bp-group-management');
    ?>
 : <?php 
    echo bp_get_group_name($group);
    ?>
</h2>

	    <a href="admin.php?page=bp-group-management">&larr; <?php 
    _e('Group index', 'bp-group-management');
    ?>
</a>

		<div class="bp-gm-group-actions">
	    <h3><?php 
    _e('Group actions', 'bp-group-management');
    ?>
</h3>

	    <?php 
    bp_group_management_group_action_buttons($id, $group);
    ?>

	    </div>


		<div class="bp-gm-group-members">

		<?php 
    if (bp_group_has_members('group_id=' . $id . '&exclude_admins_mods=0&exclude_banned=0')) {
        ?>
	    <h3><?php 
        _e('Manage current and banned group members', 'bp-group-management');
        ?>
</h3>

			<?php 
        if (bp_group_member_needs_pagination()) {
            ?>

				<div class="pagination no-ajax">

					<div id="member-count" class="pag-count">
						<?php 
            bp_group_member_pagination_count();
            ?>
					</div>

					<div id="member-admin-pagination" class="pagination-links">
						<?php 
            bp_group_member_admin_pagination();
            ?>
					</div>

				</div>

			<?php 
        }
        ?>

			<ul id="members-list" class="item-list single-line">
				<?php 
        while (bp_group_members()) {
            bp_group_the_member();
            ?>

					<?php 
            if (bp_get_group_member_is_banned()) {
                ?>

						<li class="banned-user">
							<?php 
                bp_group_member_avatar_mini();
                ?>
							<?php 
                $unkicklink = "admin.php?page=bp-group-management&amp;action=edit&amp;id=" . $id . "&amp;member_id=" . bp_get_group_member_id() . "&amp;member_action=unkick";
                $unkicklink = function_exists('wp_nonce_url') ? wp_nonce_url($unkicklink, 'bp-group-management-action_unkick') : $unkicklink;
                ?>
							<?php 
                bp_group_member_link();
                ?>
 <?php 
                _e('(banned)', 'bp-group-management');
                ?>
 <span class="small"> - <a href="<?php 
                echo $unkicklink;
                ?>
" class="confirm" title="<?php 
                _e('Remove Ban', 'bp-group-management');
                ?>
"><?php 
                _e('Remove Ban', 'bp-group-management');
                ?>
</a>

					<?php 
            } else {
                ?>

						<li>
							<?php 
                bp_group_member_avatar_mini();
                ?>

							<?php 
                $kicklink = "admin.php?page=bp-group-management&amp;action=edit&amp;id=" . $id . "&amp;member_id=" . bp_get_group_member_id() . "&amp;member_action=kick";
                $kicklink = function_exists('wp_nonce_url') ? wp_nonce_url($kicklink, 'bp-group-management-action_kick') : $kicklink;
                $removelink = "admin.php?page=bp-group-management&amp;action=edit&amp;id=" . $id . "&amp;member_id=" . bp_get_group_member_id() . "&amp;member_action=remove";
                $removelink = function_exists('wp_nonce_url') ? wp_nonce_url($removelink, 'bp-group-management-action_remove') : $removelink;
                $modlink = "admin.php?page=bp-group-management&amp;action=edit&amp;id=" . $id . "&amp;member_id=" . bp_get_group_member_id() . "&amp;member_action=mod";
                $modlink = function_exists('wp_nonce_url') ? wp_nonce_url($modlink, 'bp-group-management-action_mod') : $modlink;
                $demotelink = "admin.php?page=bp-group-management&amp;action=edit&amp;id=" . $id . "&amp;member_id=" . bp_get_group_member_id() . "&amp;member_action=demote";
                $demotelink = function_exists('wp_nonce_url') ? wp_nonce_url($demotelink, 'bp-group-management-action_demote') : $demotelink;
                $adminlink = "admin.php?page=bp-group-management&amp;action=edit&amp;id=" . $id . "&amp;member_id=" . bp_get_group_member_id() . "&amp;member_action=admin";
                $adminlink = function_exists('wp_nonce_url') ? wp_nonce_url($adminlink, 'bp-group-management-action_admin') : $adminlink;
                ?>
							<strong><?php 
                bp_group_member_link();
                ?>
</strong>
							<span class="small"> -
								<a href="<?php 
                echo $removelink;
                ?>
" title="<?php 
                _e('Remove Member', 'bp-group-management');
                ?>
"><?php 
                _e('Remove', 'bp-group-management');
                ?>
</a> |
								<a href="<?php 
                echo $kicklink;
                ?>
" class="confirm" title="<?php 
                _e('Kick and ban this member', 'bp-group-management');
                ?>
"><?php 
                _e('Kick &amp; Ban', 'bp-group-management');
                ?>
</a> |
								<?php 
                if (groups_is_user_admin(bp_get_group_member_id(), $id)) {
                    ?>
									<a href="<?php 
                    echo $demotelink;
                    ?>
" class="confirm" title="<?php 
                    _e('Demote to Member', 'bp-group-management');
                    ?>
"><?php 
                    _e('Demote to Member', 'bp-group-management');
                    ?>
</a>
								<?php 
                } elseif (groups_is_user_mod(bp_get_group_member_id(), $id)) {
                    ?>
									<a href="<?php 
                    echo $demotelink;
                    ?>
" class="confirm" title="<?php 
                    _e('Demote to Member', 'bp-group-management');
                    ?>
"><?php 
                    _e('Demote to Member', 'bp-group-management');
                    ?>
</a> | <a href="<?php 
                    echo $adminlink;
                    ?>
" class="confirm" title="<?php 
                    _e('Promote to Admin', 'bp-group-management');
                    ?>
"><?php 
                    _e('Promote to Admin', 'bp-group-management');
                    ?>
</a></span>
								<?php 
                } else {
                    ?>
									<a href="<?php 
                    echo $modlink;
                    ?>
" class="confirm" title="<?php 
                    _e('Promote to Moderator', 'bp-group-management');
                    ?>
"><?php 
                    _e('Promote to Moderator', 'bp-group-management');
                    ?>
</a> | <a href="<?php 
                    echo $adminlink;
                    ?>
" class="confirm" title="<?php 
                    _e('Promote to Admin', 'bp-group-management');
                    ?>
"><?php 
                    _e('Promote to Admin', 'bp-group-management');
                    ?>
</a></span>
								<?php 
                }
                ?>

					<?php 
            }
            ?>

							<?php 
            do_action('bp_group_manage_members_admin_item');
            ?>
						</li>

				<?php 
        }
        ?>
			</ul>

		<?php 
    }
    ?>

		</div>

		<?php 
    bp_group_management_add_member_list($id);
    ?>

		<?php 
    do_action('bp_gm_more_group_actions');
    ?>

	</div>
<?php 
}
Ejemplo n.º 7
0
function bp_gtm_filter_users($resps = null)
{
    global $bp;
    if (bp_group_has_members(array('per_page' => 1000, 'exclude_admins_mods' => 0))) {
        $check = array();
        if (!empty($resps) && !empty($bp->action_variables[1]) && $bp->action_variables[1] == 'edit') {
            $check = $resps;
        }
        ?>
        <div class="wrap-roles">
            <?php 
        do_action('bp_before_group_members_list');
        ?>
            <ul id="member-list" class="item-list" role="main">
                <?php 
        while (bp_group_members()) {
            bp_group_the_member();
            ?>
                    <?php 
            $member = bp_get_member_user_login();
            ?>
                    <li  <?php 
            echo in_array($member, $check) ? 'class="red"' : '';
            ?>
 ><input type="checkbox" name="user_ids[<?php 
            esc_attr(bp_member_user_login());
            ?>
]" class="check-user" value="<?php 
            esc_attr(bp_member_user_login());
            ?>
" <?php 
            echo in_array($member, $check) ? 'checked="checked"' : '';
            ?>
 />
                        <?php 
            bp_group_member_avatar_thumb();
            ?>
                        <h5><?php 
            echo $member;
            ?>
</h5>
                        <?php 
            if (bp_is_active('friends')) {
                ?>
                            <div class="action">
                                <?php 
                do_action('bp_directory_members_actions_loop', bp_get_member_user_login());
                ?>
                            </div>
                        <?php 
            }
            ?>
                    </li>
                <?php 
        }
        ?>
            </ul>
            <?php 
        do_action('bp_after_group_members_list');
        ?>
        </div>
    <?php 
    } else {
        ?>
        <div id="message" class="info">
            <p><?php 
        _e("Sorry, no members were found.", 'buddypress');
        ?>
</p>
        </div>
    <?php 
    }
}