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


PHP groups_get_invites_for_group函数代码示例

本文整理汇总了PHP中groups_get_invites_for_group函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_get_invites_for_group函数的具体用法?PHP groups_get_invites_for_group怎么用?PHP groups_get_invites_for_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: groups_send_invites

/**
 * Send all pending invites by a single user to a specific group.
 *
 * @param int $user_id  ID of the inviting user.
 * @param int $group_id ID of the group.
 */
function groups_send_invites($user_id, $group_id)
{
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Send friend invites.
    $invited_users = groups_get_invites_for_group($user_id, $group_id);
    $group = groups_get_group(array('group_id' => $group_id));
    for ($i = 0, $count = count($invited_users); $i < $count; ++$i) {
        $member = new BP_Groups_Member($invited_users[$i], $group_id);
        // Send the actual invite
        groups_notification_group_invites($group, $member, $user_id);
        $member->invite_sent = 1;
        $member->save();
    }
    /**
     * Fires after the sending of invites for a group.
     *
     * @since 1.0.0
     *
     * @param int   $group_id      ID of the group who's being invited to.
     * @param array $invited_users Array of users being invited to the group.
     */
    do_action('groups_send_invites', $group_id, $invited_users);
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:31,代码来源:bp-groups-functions.php

示例2: bp_get_new_group_invite_friend_list

/**
 * Return a list of friends who can be invited to a group
 *
 * @since 1.0.0
 *
 * @param array $args Array of arguments for friends list output.
 * @return mixed HTML list of checkboxes, or false
 */
function bp_get_new_group_invite_friend_list($args = array())
{
    // Bail if no friends component.
    if (!bp_is_active('friends')) {
        return false;
    }
    // Parse arguments.
    $r = wp_parse_args($args, array('user_id' => bp_loggedin_user_id(), 'group_id' => false, 'separator' => 'li'));
    // No group passed, so look for new or current group ID's.
    if (empty($r['group_id'])) {
        $bp = buddypress();
        $r['group_id'] = !empty($bp->groups->new_group_id) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
    }
    // Setup empty items array.
    $items = array();
    // Get user's friends who are not in this group already.
    $friends = friends_get_friends_invite_list($r['user_id'], $r['group_id']);
    if (!empty($friends)) {
        // Get already invited users.
        $invites = groups_get_invites_for_group($r['user_id'], $r['group_id']);
        for ($i = 0, $count = count($friends); $i < $count; ++$i) {
            $checked = in_array((int) $friends[$i]['id'], (array) $invites);
            $items[] = '<' . $r['separator'] . '><label for="f-' . esc_attr($friends[$i]['id']) . '"><input' . checked($checked, true, false) . ' type="checkbox" name="friends[]" id="f-' . esc_attr($friends[$i]['id']) . '" value="' . esc_attr($friends[$i]['id']) . '" /> ' . esc_html($friends[$i]['full_name']) . '</label></' . $r['separator'] . '>';
        }
    }
    /**
     * Filters the array of friends who can be invited to a group.
     *
     * @since 2.4.0
     *
     * @param array $items Array of friends.
     * @param array $r     Parsed arguments from bp_get_new_group_invite_friend_list()
     * @param array $args  Unparsed arguments from bp_get_new_group_invite_friend_list()
     */
    $invitable_friends = apply_filters('bp_get_new_group_invite_friend_list', $items, $r, $args);
    if (!empty($invitable_friends) && is_array($invitable_friends)) {
        $retval = implode("\n", $invitable_friends);
    } else {
        $retval = false;
    }
    return $retval;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:50,代码来源:bp-groups-template.php

示例3: bp_get_new_group_invite_friend_list

function bp_get_new_group_invite_friend_list($args = '')
{
    global $bp;
    if (!bp_is_active('friends')) {
        return false;
    }
    $defaults = array('group_id' => false, 'separator' => 'li');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (empty($group_id)) {
        $group_id = !empty($bp->groups->new_group_id) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
    }
    if ($friends = friends_get_friends_invite_list(bp_loggedin_user_id(), $group_id)) {
        $invites = groups_get_invites_for_group(bp_loggedin_user_id(), $group_id);
        for ($i = 0, $count = count($friends); $i < $count; ++$i) {
            $checked = '';
            if (!empty($invites)) {
                if (in_array($friends[$i]['id'], $invites)) {
                    $checked = ' checked="checked"';
                }
            }
            $items[] = '<' . $separator . '><input' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . esc_attr($friends[$i]['id']) . '" /> ' . $friends[$i]['full_name'] . '</' . $separator . '>';
        }
    }
    if (!empty($items)) {
        return implode("\n", (array) $items);
    }
    return false;
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:29,代码来源:bp-groups-template.php

示例4: __construct

 function __construct($user_id, $group_id)
 {
     global $bp;
     $this->invites = groups_get_invites_for_group($user_id, $group_id);
     $this->invite_count = count($this->invites);
 }
开发者ID:newington,项目名称:buddypress,代码行数:6,代码来源:bp-groups-template.php

示例5: bp_get_new_group_invite_member_list

function bp_get_new_group_invite_member_list($args = '')
{
    global $bp;
    $defaults = array('group_id' => false, 'separator' => 'li');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (!$group_id) {
        $group_id = isset($bp->groups->new_group_id) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
    }
    $items = array();
    $friends = get_members_invite_list($bp->loggedin_user->id, $group_id);
    if ($friends) {
        $invites = groups_get_invites_for_group($bp->loggedin_user->id, $group_id);
        for ($i = 0; $i < count($friends); $i++) {
            $checked = '';
            if ($invites) {
                if (in_array($friends[$i]['id'], $invites)) {
                    $checked = ' checked="checked"';
                }
            }
            $items[] = '<' . $separator . '><input' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . esc_html($friends[$i]['id']) . '" /> ' . $friends[$i]['full_name'] . '</' . $separator . '>';
        }
    }
    return implode("\n", (array) $items);
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:25,代码来源:group-invites.php

示例6: bp_groups_invite_template

	function bp_groups_invite_template( $user_id, $group_id ) {
		global $bp;

		$this->invites = groups_get_invites_for_group( $user_id, $group_id );
		$this->invite_count = count( $this->invites );
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:6,代码来源:bp-groups-templatetags.php

示例7: groups_send_invites

function groups_send_invites($user_id, $group_id)
{
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Send friend invites.
    $invited_users = groups_get_invites_for_group($user_id, $group_id);
    $group = groups_get_group(array('group_id' => $group_id));
    for ($i = 0, $count = count($invited_users); $i < $count; ++$i) {
        $member = new BP_Groups_Member($invited_users[$i], $group_id);
        // Send the actual invite
        groups_notification_group_invites($group, $member, $user_id);
        $member->invite_sent = 1;
        $member->save();
    }
    do_action('groups_send_invites', $group_id, $invited_users);
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:17,代码来源:bp-groups-functions.php

示例8: kleo_bp_get_new_group_invite_friend_list

function kleo_bp_get_new_group_invite_friend_list($args = '')
{
    global $bp;
    if (!bp_is_active('friends')) {
        return false;
    }
    $defaults = array('group_id' => false, 'separator' => 'li');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (empty($group_id)) {
        $group_id = !empty($bp->groups->new_group_id) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
    }
    if ($friends = friends_get_friends_invite_list(bp_loggedin_user_id(), $group_id)) {
        $invites = groups_get_invites_for_group(bp_loggedin_user_id(), $group_id);
        for ($i = 0, $count = count($friends); $i < $count; ++$i) {
            $checked = '';
            if (!empty($invites)) {
                if (in_array($friends[$i]['id'], $invites)) {
                    $checked = ' checked="checked"';
                }
            }
            $items[] = '<' . $separator . '>' . '<label class="mark-item">' . '<input class="checkbox-cb"' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . esc_attr($friends[$i]['id']) . '" /> ' . '<span class="checkbox-mark"></span>' . '</label>' . '<div class="item-avatar rounded">' . get_avatar($friends[$i]['id']) . '</div>' . '<div class="invite-list-content"><h4>' . bp_core_get_userlink($friends[$i]['id']) . '</h4>' . '<span class="activity">' . bp_get_last_activity($friends[$i]['id']) . '</span>' . '<span class="group-invites-status"></span></div>' . '</' . $separator . '>';
        }
    }
    if (!empty($items)) {
        return implode("\n", (array) $items);
    }
    return false;
}
开发者ID:6226,项目名称:wp,代码行数:29,代码来源:buddypress-functions.php

示例9: groups_send_invites

function groups_send_invites($user_id, $group_id)
{
    global $bp;
    if (!$user_id) {
        $user_id = $bp->loggedin_user->id;
    }
    // Send friend invites.
    $invited_users = groups_get_invites_for_group($user_id, $group_id);
    $group = new BP_Groups_Group($group_id);
    for ($i = 0, $count = count($invited_users); $i < $count; ++$i) {
        $member = new BP_Groups_Member($invited_users[$i], $group_id);
        // Send the actual invite
        groups_notification_group_invites($group, $member, $user_id);
        $member->invite_sent = 1;
        $member->save();
    }
    do_action('groups_send_invites', $group_id, $invited_users);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:18,代码来源:bp-groups-functions.php

示例10: groups_send_invites

function groups_send_invites( $user_id, $group_id ) {
	global $bp;

	require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );

	if ( !$user_id )
		$user_id = $bp->loggedin_user->id;

	// Send friend invites.
	$invited_users = groups_get_invites_for_group( $user_id, $group_id );
	$group = new BP_Groups_Group( $group_id );

	for ( $i = 0; $i < count( $invited_users ); $i++ ) {
		$member = new BP_Groups_Member( $invited_users[$i], $group_id );

		// Send the actual invite
		groups_notification_group_invites( $group, $member, $user_id );

		$member->invite_sent = 1;
		$member->save();
	}

	do_action( 'groups_send_invites', $bp->groups->current_group->id, $invited_users );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:24,代码来源:bp-groups.php

示例11: groups_send_invites

function groups_send_invites($group_obj, $skip_check = false)
{
    global $bp;
    if (!$skip_check) {
        if (!check_admin_referer('groups_send_invites', '_wpnonce_send_invites')) {
            return false;
        }
    }
    require_once BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php';
    // Send friend invites.
    $invited_users = groups_get_invites_for_group($bp->loggedin_user->id, $group_obj->id);
    for ($i = 0; $i < count($invited_users); $i++) {
        $member = new BP_Groups_Member($invited_users[$i], $group_obj->id);
        // Send the actual invite
        groups_notification_group_invites($group_obj, $member, $bp->loggedin_user->id);
        $member->invite_sent = 1;
        $member->save();
    }
    do_action('groups_send_invites', $group_obj->id, $invited_users);
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:20,代码来源:bp-groups.php

示例12: bp_group_send_invite_form

function bp_group_send_invite_form($group = false)
{
    global $bp, $groups_template, $invites;
    if (!$group) {
        $group =& $groups_template->group;
    }
    ?>
	<div class="left-menu">
		<h4><?php 
    _e('Select Friends', 'buddypress');
    ?>
 <img id="ajax-loader" src="<?php 
    echo $bp->groups->image_base;
    ?>
/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4>
		<?php 
    bp_group_list_invite_friends();
    ?>
		<?php 
    wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user');
    ?>
		<input type="hidden" name="group_id" id="group_id" value="<?php 
    echo attribute_escape($group->id);
    ?>
" />
	</div>

	<div class="main-column">
		
		<div id="message" class="info">
			<p><?php 
    _e('Select people to invite from your friends list.', 'buddypress');
    ?>
</p>
		</div>

		<?php 
    $invites = groups_get_invites_for_group($bp->loggedin_user->id, $group_obj->id);
    ?>
		
		<ul id="friend-list" class="item-list">
			<?php 
    for ($i = 0; $i < count($invites); $i++) {
        if (!($user = wp_cache_get('bp_user_' . $invites[$i], 'bp'))) {
            $user = new BP_Core_User($invites[$i]);
            wp_cache_set('bp_user_' . $invites[$i], $user, 'bp');
        }
        ?>
				<li id="uid-<?php 
        echo $user->id;
        ?>
">
					<?php 
        echo $user->avatar_thumb;
        ?>
					<h4><?php 
        echo $user->user_link;
        ?>
</h4>
					<span class="activity"><?php 
        echo $user->last_active;
        ?>
</span>
					<div class="action">
						<a class="remove" href="<?php 
        echo wp_nonce_url(site_url($bp->groups->slug . '/' . $group->id . '/invites/remove/' . $user->id), 'groups_invite_uninvite_user');
        ?>
" id="uid-<?php 
        echo $user->id;
        ?>
"><?php 
        _e('Remove Invite', 'buddypress');
        ?>
</a> 
					</div>
				</li>
			<?php 
    }
    // end for
    ?>
		</ul>
		
		<?php 
    wp_nonce_field('groups_send_invites', '_wpnonce_send_invites');
    ?>
	</div>
<?php 
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:88,代码来源:bp-groups-templatetags.php


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