コード例 #1
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;
}
コード例 #2
0
function bp_group_member_id()
{
    echo bp_get_group_member_id();
}
コード例 #3
0
ファイル: events.php プロジェクト: tamriel-foundry/apoc2
 /**
  * Save or update a new event
  * @version 2.0
  */
 function save_event($post_id, $post = '')
 {
     // Don't do anything if it's not an event
     if ('event' != $post->post_type) {
         return;
     }
     // Verify the nonce before proceeding.
     if (!isset($_POST['event-details-box']) || !wp_verify_nonce($_POST['event-details-box'], basename(__FILE__))) {
         return $post_id;
     }
     /* -----------------------------------
     			SAVE EVENT TIME 
     		------------------------------------*/
     // Retrieve the event time
     $event_time = date('Y-m-d H:i:s', strtotime($_POST['event-time']));
     $prior_time = $post->post_date;
     // Update the post object
     $post->post_date = $event_time;
     remove_action('save_post', array($this, 'save_event'));
     wp_update_post($post);
     add_action('save_post', array($this, 'save_event'), 10, 2);
     /* -----------------------------------
     			SAVE META INFORMATION 
     		------------------------------------ */
     // Define the meta to look for
     $meta = array('event_duration' => $_POST['event-duration'], 'event_capacity' => $_POST['event-capacity'], 'event_rsvp' => $_POST['event-rsvp'], 'event_role' => $_POST['event-role']);
     // Loop through each meta, saving it to the database
     foreach ($meta as $meta_key => $new_meta_value) {
         // Get the meta value of the custom field key.
         $meta_value = get_post_meta($post_id, $meta_key, true);
         // If there is no new meta value but an old value exists, delete it.
         if (current_user_can('delete_post_meta', $post_id, $meta_key) && '' == $new_meta_value && $meta_value) {
             delete_post_meta($post_id, $meta_key, $meta_value);
         } elseif (current_user_can('add_post_meta', $post_id, $meta_key) && $new_meta_value && '' == $meta_value) {
             add_post_meta($post_id, $meta_key, $new_meta_value, true);
         } elseif (current_user_can('edit_post_meta', $post_id, $meta_key) && $new_meta_value && $new_meta_value != $meta_value) {
             update_post_meta($post_id, $meta_key, $new_meta_value);
         }
     }
     // Delete the RSVP meta if the date has changed
     if ($event_time != $prior_time) {
         delete_post_meta($post_id, 'event_rsvps');
     }
     /* -----------------------------------
     			BUDDYPRESS NOTIFICATION
     		------------------------------------ */
     // Get event data
     global $bp, $wpdb;
     if (!$user_id) {
         $user_id = $post->post_author;
     }
     // Figure out which calendars this event belongs to
     $calendars = wp_get_post_terms($post_id, 'calendar');
     $group_slugs = array();
     // For each calendar, check if it's a group calendar
     foreach ($calendars as $calendar) {
         if (is_group_calendar($calendar->term_id)) {
             $groups[] = $calendar;
         }
     }
     // If this event does not belong to a group, we can stop here
     if (empty($groups)) {
         return $post_id;
     }
     // Only register notifications for future or published events
     if (!in_array($post->post_status, array('publish', 'future'))) {
         return $post_id;
     }
     // Loop through each group, adding an activity entry for each one
     foreach ($groups as $group) {
         // Get the group data
         $group_id = groups_get_id($group->slug);
         $group_name = $group->name;
         // Configure the activity entry
         $post_permalink = get_permalink($post_id);
         $activity_action = sprintf('%1$s added the event %2$s to the %3$s.', bp_core_get_userlink($post->post_author), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', $group_name . ' <a href="' . SITEURL . '/calendar/' . $group->slug . '">group calendar</a>');
         $activity_content = $post->post_content;
         // Check for existing entry
         $activity_id = bp_activity_get_activity_id(array('user_id' => $user_id, 'component' => $bp->groups->id, 'type' => 'new_calendar_event', 'item_id' => $group_id, 'secondary_item_id' => $post_id));
         // Record the entry
         groups_record_activity(array('id' => $activity_id, 'user_id' => $user_id, 'action' => $activity_action, 'content' => $activity_content, 'primary_link' => $post_permalink, 'type' => 'new_calendar_event', 'item_id' => $group_id, 'secondary_item_id' => $post_id));
         // Update the group's last activity meta
         groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
         // Maybe notify every group member
         if ($_POST['event-rsvp']) {
             if (bp_group_has_members($args = array('group_id' => $group_id, 'exclude_admins_mods' => false, 'per_page' => 99999))) {
                 while (bp_members()) {
                     bp_the_member();
                     // Remove any existing notifications ( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false )
                     bp_notifications_delete_notifications_by_item_id(bp_get_group_member_id(), $group_id, $bp->groups->id, 'new_calendar_event', $post_id);
                     // Send a notification ( itemid , groupid , component, action , secondary )
                     bp_notifications_add_notification(array('user_id' => bp_get_group_member_id(), 'item_id' => $group_id, 'secondary_item_id' => $post_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_calendar_event'));
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: members.php プロジェクト: Juni4567/meritscholarship
        bp_group_member_joined_since();
        ?>
</span>

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

				<?php 
        if (bp_is_active('friends')) {
            ?>

					<div class="action">

						<?php 
            bp_add_friend_button(bp_get_group_member_id(), bp_get_group_member_is_friend());
            ?>

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

					</div>

				<?php 
        }
        ?>
			</li>

		<?php 
    }
コード例 #5
0
ファイル: cp-bp-groups.php プロジェクト: clarkewd/CollabPress
 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;
 }
コード例 #6
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);
            }
        }
    }
}
コード例 #7
0
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 
}
コード例 #8
0
}
?>
 -->
											
											
											
												<?php 
if (bp_group_has_members("group_id={$buddypress_id}&exclude_admins_mods=1")) {
    ?>
												
												 	<ul id="member-list" class="item-list" role="main">

														<?php 
    while (bp_group_members()) {
        bp_group_the_member();
        if (get_user_by('id', bp_get_group_member_id())->user_status == 2) {
            continue;
        }
        ?>

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

																	<?php 
        bp_group_member_avatar_thumb();
        ?>

																</a>
コード例 #9
0
ファイル: admin.php プロジェクト: buddydev/bp-magic
				<?php 
        while (bp_group_members()) {
            bp_group_the_member();
            ?>

					<li class="<?php 
            bp_group_member_css_class();
            ?>
">
						<div class="item-avatar">
                                                <a href="<?php 
            bp_group_member_url();
            ?>
">
                                                    <?php 
            echo bp_core_fetch_avatar(array('item_id' => bp_get_group_member_id(), 'type' => 'thumb', 'width' => 50, 'height' => 50, 'alt' => sprintf(__('Profile picture of %s', 'bp-magic'), bp_get_group_member_name())));
            ?>
                                                </a>  
                                            </div>
                                             <div class="item">
                                                <div class="item-title">
                                                        <?php 
            bp_group_member_link();
            ?>
                                                </div>
                                          </div>
                                           <div class="action">

							<?php 
            if (bp_get_group_member_is_banned()) {
                _e('(banned)', 'bp-magic');