• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP BP_Friends_Friendship类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: friends_action_remove_friend

/**
 * Catch and process Remove Friendship requests.
 *
 * @since 1.0.1
 */
function friends_action_remove_friend()
{
    if (!bp_is_friends_component() || !bp_is_current_action('remove-friend')) {
        return false;
    }
    if (!($potential_friend_id = (int) bp_action_variable(0))) {
        return false;
    }
    if ($potential_friend_id == bp_loggedin_user_id()) {
        return false;
    }
    $friendship_status = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $potential_friend_id);
    if ('is_friend' == $friendship_status) {
        if (!check_admin_referer('friends_remove_friend')) {
            return false;
        }
        if (!friends_remove_friend(bp_loggedin_user_id(), $potential_friend_id)) {
            bp_core_add_message(__('Friendship could not be canceled.', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('Friendship canceled', 'buddypress'));
        }
    } elseif ('is_friends' == $friendship_status) {
        bp_core_add_message(__('You are not yet friends with this user', 'buddypress'), 'error');
    } else {
        bp_core_add_message(__('You have a pending friendship request with this user', 'buddypress'), 'error');
    }
    bp_core_redirect(wp_get_referer());
    return false;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:34,代码来源:bp-friends-actions.php


示例2: test_requests_on_request

 /**
  * @group friends_get_friendship_request_user_ids
  * @group friends_add_friend
  */
 public function test_requests_on_request()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $u3 = $this->factory->user->create();
     // request friendship
     friends_add_friend($u2, $u1);
     // Set the time of the earlier friendship for reliable ordering of the results.
     $fid = friends_get_friendship_id($u2, $u1);
     $friendship = new BP_Friends_Friendship($fid, false, false);
     $friendship->date_created = date('Y-m-d H:i:s', time() - 60);
     $friendship->save();
     // get request count for user 1 and assert
     $requests = friends_get_friendship_request_user_ids($u1);
     $this->assertEquals(array($u2), $requests);
     // request another friendship
     friends_add_friend($u3, $u1);
     // refetch request count for user 1 and assert
     $requests = friends_get_friendship_request_user_ids($u1);
     $this->assertEquals(array($u3, $u2), $requests);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:25,代码来源:functions.php


示例3: bp_friends_filter_user_query_populate_extras

/**
 * Filter BP_User_Query::populate_extras to add confirmed friendship status.
 *
 * Each member in the user query is checked for confirmed friendship status
 * against the logged-in user.
 *
 * @since 1.7.0
 *
 * @global WPDB $wpdb WordPress database access object.
 *
 * @param BP_User_Query $user_query   The BP_User_Query object.
 * @param string        $user_ids_sql Comma-separated list of user IDs to fetch extra
 *                                    data for, as determined by BP_User_Query.
 */
function bp_friends_filter_user_query_populate_extras(BP_User_Query $user_query, $user_ids_sql)
{
    global $wpdb;
    // Stop if user isn't logged in.
    if (!($user_id = bp_loggedin_user_id())) {
        return;
    }
    $maybe_friend_ids = wp_parse_id_list($user_ids_sql);
    foreach ($maybe_friend_ids as $friend_id) {
        $status = BP_Friends_Friendship::check_is_friend($user_id, $friend_id);
        $user_query->results[$friend_id]->friendship_status = $status;
        if ('is_friend' == $status) {
            $user_query->results[$friend_id]->is_friend = 1;
        }
    }
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:30,代码来源:bp-friends-filters.php


示例4: example_friends_ajax_addremove_friend

function example_friends_ajax_addremove_friend()
{
    global $bp;
    if ('is_friend' == BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $_POST['fid'])) {
        if (!friends_remove_friend($bp->loggedin_user->id, $_POST['fid'])) {
            echo __('Friendship could not be canceled.', 'bp-component');
        } else {
            echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __('Add Friend', 'bp-component') . '" href="' . $bp->loggedin_user->domain . $bp['friends']['slug'] . '/add-friend/' . $_POST['fid'] . '">' . __('Add Friend', 'bp-component') . '</a>';
        }
    } else {
        if ('not_friends' == BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $_POST['fid'])) {
            if (!friends_add_friend($bp->loggedin_user->id, $_POST['fid'])) {
                echo __('Friendship could not be requested.', 'bp-component');
            } else {
                echo '<a href="' . $bp->loggedin_user->domain . $bp['friends']['slug'] . '" class="requested">' . __('Friendship Requested', 'bp-component') . '</a>';
            }
        } else {
            echo __('Request Pending', 'bp-component');
        }
    }
    return false;
}
开发者ID:natrio,项目名称:buddypress-skeleton-component,代码行数:22,代码来源:bp-example-ajax.php


示例5: wpmudev_chat_buddypress_member_header_actions

function wpmudev_chat_buddypress_member_header_actions()
{
    global $bp, $members_template, $wpmudev_chat, $current_user;
    if ($bp->loggedin_user->id === bp_displayed_user_id()) {
        return;
    }
    //if (!is_object('BP_Friends_Friendship')) return;
    if (!bp_is_active('friends')) {
        return;
    }
    if (!class_exists('BP_Friends_Friendship')) {
        return $is_friend_ret = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), bp_displayed_user_id());
    }
    //echo "is_friend_ret[". $is_friend_ret ."]<br />";
    // Set this so when we get to wp_footer it knows we need to load the JS/CSS for the Friends display.
    $wpmudev_chat->_chat_plugin_settings['blocked_urls']['front'] = false;
    if (BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), bp_displayed_user_id()) == 'is_friend' || $bp->loggedin_user->is_site_admin == true) {
        $content = '';
        $content .= '<div id="wpmudev-chat-now-button-' . bp_displayed_user_id() . '" class="generic-button wpmudev-chat-now-button">';
        $friends_status = wpmudev_chat_get_friends_status($bp->loggedin_user->id, bp_displayed_user_id());
        if (!empty($friends_status[0])) {
            $friends_status = $friends_status[0];
        } else {
            $friends_status = '';
        }
        $friend_data = wpmudev_chat_get_chat_status_data(bp_displayed_user_id(), $friends_status);
        //echo "friend_data<pre>"; print_r($friend_data); echo "</pre>";
        $friend_status_display = $friend_data['icon'] . $friend_data['label'];
        if (!empty($friend_data['href'])) {
            $content .= '<a class="button wpmudev-chat-button ' . $friend_data['href_class'] . '" title="' . $friend_data['href_title'] . '" href="#" rel="' . $friend_data['href'] . '">' . $friend_status_display . '</a>';
        } else {
            $content .= '<a onclick="return false;" disabled="disabled" class="wpmudev-chat-button ' . $friend_data['href_class'] . '" title="' . $friend_data['href_title'] . '" href="#">' . $friend_status_display . '</a>';
        }
        $content .= '</div>';
        echo $content;
    }
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:37,代码来源:wpmudev_chat_buddypress.php


示例6: friends_ajax_addremove_friend

function friends_ajax_addremove_friend()
{
    global $bp;
    if ('is_friend' == BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $_POST['fid'])) {
        check_ajax_referer('friends_remove_friend');
        if (!friends_remove_friend($bp->loggedin_user->id, $_POST['fid'])) {
            echo __("Friendship could not be canceled.", 'buddypress');
        } else {
            echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __('Add Friend', 'buddypress') . '" href="' . wp_nonce_url($bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $_POST['fid'], 'friends_add_friend') . '">' . __('Add Friend', 'buddypress') . '</a>';
        }
    } else {
        if ('not_friends' == BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $_POST['fid'])) {
            check_ajax_referer('friends_add_friend');
            if (!friends_add_friend($bp->loggedin_user->id, $_POST['fid'])) {
                echo __("Friendship could not be requested.", 'buddypress');
            } else {
                echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '" class="requested">' . __('Friendship Requested', 'buddypress') . '</a>';
            }
        } else {
            echo __('Request Pending', 'buddypress');
        }
    }
    return false;
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:24,代码来源:bp-friends-ajax.php


示例7: populate_extras

 function populate_extras()
 {
     global $bp;
     if (function_exists('friends_install')) {
         $this->total_friends = BP_Friends_Friendship::total_friend_count($this->id);
         if ($this->total_friends) {
             if (1 == $this->total_friends) {
                 $this->total_friends .= ' ' . __('friend', 'buddypress');
             } else {
                 $this->total_friends .= ' ' . __('friends', 'buddypress');
             }
             $this->total_friends = '<a href="' . $this->user_url . $bp->friends->slug . '" title="' . sprintf(__("%s's friend list", 'buddypress'), $this->fullname) . '">' . $this->total_friends . '</a>';
         }
     }
     if (function_exists('bp_blogs_install')) {
         if ($this->total_blogs) {
             if (1 == $this->total_blogs) {
                 $this->total_blogs .= ' ' . __('blog', 'buddypress');
             } else {
                 $this->total_blogs .= ' ' . __('blogs', 'buddypress');
             }
             $this->total_blogs = '<a href="' . $this->user_url . $bp->blogs->slug . '" title="' . sprintf(__("%s's blog list", 'buddypress'), $this->fullname) . '">' . $this->total_blogs . '</a>';
         }
     }
     if (function_exists('groups_install')) {
         $this->total_groups = BP_Groups_Member::total_group_count($this->id);
         if ($this->total_groups) {
             if (1 == $this->total_groups) {
                 $this->total_groups .= ' ' . __('group', 'buddypress');
             } else {
                 $this->total_groups .= ' ' . __('groups', 'buddypress');
             }
             $this->total_groups = '<a href="' . $this->user_url . $bp->groups->slug . '" title="' . sprintf(__("%s's group list", 'buddypress'), $this->fullname) . '">' . $this->total_groups . '</a>';
         }
     }
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:36,代码来源:bp-core-classes.php


示例8: delete_all_for_user

 function delete_all_for_user($user_id)
 {
     global $nxtdb, $bp;
     // Get friends of $user_id
     $friend_ids = BP_Friends_Friendship::get_friend_user_ids($user_id);
     // Delete all friendships related to $user_id
     $nxtdb->query($nxtdb->prepare("DELETE FROM {$bp->friends->table_name} WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id));
     // Delete friend request notifications for members who have a notification from this user.
     $nxtdb->query($nxtdb->prepare("DELETE FROM {$bp->core->table_name_notifications} WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id));
     // Loop through friend_ids and update their counts
     foreach ((array) $friend_ids as $friend_id) {
         BP_Friends_Friendship::total_friend_count($friend_id);
     }
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:14,代码来源:bp-friends-classes.php


示例9: friends_remove_data

/**
 * Remove all friends-related data concerning a given user.
 *
 * Removes the following:
 *
 * - Friendships of which the user is a member
 * - Cached friend count for the user
 * - Notifications of friendship requests sent by the user
 *
 * @param int $user_id ID of the user whose friend data is being removed.
 */
function friends_remove_data($user_id)
{
    do_action('friends_before_remove_data', $user_id);
    BP_Friends_Friendship::delete_all_for_user($user_id);
    // Remove usermeta
    bp_delete_user_meta($user_id, 'total_friend_count');
    do_action('friends_remove_data', $user_id);
}
开发者ID:eresyyl,项目名称:mk,代码行数:19,代码来源:bp-friends-functions.php


示例10: bp_friends_random_friends

function bp_friends_random_friends()
{
    global $bp;
    if (!($friend_ids = wp_cache_get('friends_friend_ids_' . $bp->displayed_user->id, 'bp'))) {
        $friend_ids = BP_Friends_Friendship::get_random_friends($bp->displayed_user->id);
        wp_cache_set('friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp');
    }
    ?>
	
	<div class="info-group">
		<h4><?php 
    bp_word_or_name(__("My Friends", 'buddypress'), __("%s's Friends", 'buddypress'));
    ?>
  (<?php 
    echo BP_Friends_Friendship::total_friend_count($bp->displayed_user->id);
    ?>
)  <a href="<?php 
    echo $bp->displayed_user->domain . $bp->friends->slug;
    ?>
"><?php 
    _e('See All', 'buddypress');
    ?>
 &raquo;</a></h4>
		
		<?php 
    if ($friend_ids) {
        ?>
			<ul class="horiz-gallery">
			<?php 
        for ($i = 0; $i < count($friend_ids); $i++) {
            ?>
				<li>
					<a href="<?php 
            echo bp_core_get_userurl($friend_ids[$i]);
            ?>
"><?php 
            echo bp_core_get_avatar($friend_ids[$i], 1);
            ?>
</a>
					<h5><?php 
            echo bp_core_get_userlink($friend_ids[$i]);
            ?>
</h5>
				</li>
			<?php 
        }
        ?>
			</ul>
		<?php 
    } else {
        ?>
			<div id="message" class="info">
				<p><?php 
        bp_word_or_name(__("You haven't added any friend connections yet.", 'buddypress'), __("%s hasn't created any friend connections yet.", 'buddypress'));
        ?>
</p>
			</div>
		<?php 
    }
    ?>
		<div class="clear"></div>
	</div>
<?php 
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:64,代码来源:bp-friends-templatetags.php


示例11: bp_legacy_theme_ajax_messages_autocomplete_results

/**
 * AJAX handler for autocomplete.
 *
 * Displays friends only, unless BP_MESSAGES_AUTOCOMPLETE_ALL is defined.
 *
 * @since BuddyPress (1.2.0)
 *
 * @return string HTML.
 */
function bp_legacy_theme_ajax_messages_autocomplete_results()
{
    // Include everyone in the autocomplete, or just friends?
    if (bp_is_current_component(bp_get_messages_slug())) {
        $autocomplete_all = buddypress()->messages->autocomplete_all;
    }
    $pag_page = 1;
    $limit = (int) $_GET['limit'] ? $_GET['limit'] : apply_filters('bp_autocomplete_max_results', 10);
    $search_terms = isset($_GET['q']) ? $_GET['q'] : '';
    $user_query_args = array('search_terms' => $search_terms, 'page' => intval($pag_page), 'per_page' => intval($limit));
    // If only matching against friends, get an $include param for
    // BP_User_Query
    if (!$autocomplete_all && bp_is_active('friends')) {
        $include = BP_Friends_Friendship::get_friend_user_ids(bp_loggedin_user_id());
        // Ensure zero matches if no friends are found
        if (empty($include)) {
            $include = array(0);
        }
        $user_query_args['include'] = $include;
    }
    $user_query = new BP_User_Query($user_query_args);
    // Backward compatibility - if a plugin is expecting a legacy
    // filter, pass the IDs through the filter and requery (groan)
    if (has_filter('bp_core_autocomplete_ids') || has_filter('bp_friends_autocomplete_ids')) {
        $found_user_ids = wp_list_pluck($user_query->results, 'ID');
        if ($autocomplete_all) {
            $found_user_ids = apply_filters('bp_core_autocomplete_ids', $found_user_ids);
        } else {
            $found_user_ids = apply_filters('bp_friends_autocomplete_ids', $found_user_ids);
        }
        if (empty($found_user_ids)) {
            $found_user_ids = array(0);
        }
        // Repopulate the $user_query variable
        $user_query = new BP_User_Query(array('include' => $found_user_ids));
    }
    if (!empty($user_query->results)) {
        foreach ($user_query->results as $user) {
            if (bp_is_username_compatibility_mode()) {
                // Sanitize for spaces. Use urlencode() rather
                // than rawurlencode() because %20 breaks JS
                $username = urlencode($user->user_login);
            } else {
                $username = $user->user_nicename;
            }
            // Note that the final line break acts as a delimiter for the
            // autocomplete javascript and thus should not be removed
            echo '<span id="link-' . esc_attr($username) . '" href="' . bp_core_get_user_domain($user->ID) . '"></span>' . bp_core_fetch_avatar(array('item_id' => $user->ID, 'type' => 'thumb', 'width' => 15, 'height' => 15, 'alt' => $user->display_name)) . ' &nbsp;' . bp_core_get_user_displayname($user->ID) . ' (' . esc_html($username) . ')' . "\n";
        }
    }
    exit;
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:61,代码来源:buddypress-functions.php


示例12: friends_remove_data

function friends_remove_data($user_id)
{
    BP_Friends_Friendship::delete_all_for_user($user_id);
    /* Remove usermeta */
    delete_usermeta($user_id, 'total_friend_count');
    /* Remove friendship requests FROM user */
    bp_core_delete_notifications_from_user($user_id, $bp->friends->slug, 'friendship_request');
    do_action('friends_remove_data', $user_id);
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:9,代码来源:bp-friends.php


示例13: invite_anyone_group_invite_maybe_filter_invite_message

/**
 * Catch the 'to' email address of sent email notifications, and hook message filter if necessary
 *
 * This function is necessary because the groups_notification_group_invites_message
 * filter doesn't receive easily parsable info about the invitee.
 *
 * @since 1.0.22
 */
function invite_anyone_group_invite_maybe_filter_invite_message($to)
{
    if (!bp_is_active('friends')) {
        return $to;
    }
    $invited_user = get_user_by('email', $to);
    $friendship_status = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $invited_user->ID);
    if ('is_friend' !== $friendship_status) {
        add_action('groups_notification_group_invites_message', 'invite_anyone_group_invite_email_message', 10, 7);
    }
    return $to;
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:20,代码来源:group-invites.php


示例14: bp_dtheme_ajax_addremove_friend

function bp_dtheme_ajax_addremove_friend()
{
    global $bp;
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    if ('is_friend' == BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $_POST['fid'])) {
        check_ajax_referer('friends_remove_friend');
        if (!friends_remove_friend($bp->loggedin_user->id, $_POST['fid'])) {
            echo __("Friendship could not be canceled.", 'buddypress');
        } else {
            echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __('Add Friend', 'buddypress') . '" href="' . nxt_nonce_url($bp->loggedin_user->domain . bp_get_friends_slug() . '/add-friend/' . $_POST['fid'], 'friends_add_friend') . '">' . __('Add Friend', 'buddypress') . '</a>';
        }
    } else {
        if ('not_friends' == BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $_POST['fid'])) {
            check_ajax_referer('friends_add_friend');
            if (!friends_add_friend($bp->loggedin_user->id, $_POST['fid'])) {
                echo __("Friendship could not be requested.", 'buddypress');
            } else {
                echo '<a href="' . $bp->loggedin_user->domain . bp_get_friends_slug() . '/requests" class="requested">' . __('Friendship Requested', 'buddypress') . '</a>';
            }
        } else {
            echo __('Request Pending', 'buddypress');
        }
    }
    return false;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:28,代码来源:ajax.php


示例15: the_invite

 function the_invite()
 {
     global $group_id;
     $this->in_the_loop = true;
     $user_id = $this->next_invite();
     $this->invite = new stdClass();
     $this->invite->user = $this->invite_data[$user_id];
     // This method previously populated the user object with
     // BP_Core_User. We manually configure BP_Core_User data for
     // backward compatibility.
     if (bp_is_active('xprofile')) {
         $this->invite->user->profile_data = BP_XProfile_ProfileData::get_all_for_user($user_id);
     }
     $this->invite->user->avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'full', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
     $this->invite->user->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
     $this->invite->user->avatar_mini = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname), 'width' => 30, 'height' => 30));
     $this->invite->user->email = $this->invite->user->user_email;
     $this->invite->user->user_url = bp_core_get_user_domain($user_id, $this->invite->user->user_nicename, $this->invite->user->user_login);
     $this->invite->user->user_link = "<a href='{$this->invite->user->user_url}' title='{$this->invite->user->fullname}'>{$this->invite->user->fullname}</a>";
     $this->invite->user->last_active = bp_core_get_last_activity($this->invite->user->last_activity, __('active %s', 'buddypress'));
     if (bp_is_active('groups')) {
         $total_groups = BP_Groups_Member::total_group_count($user_id);
         $this->invite->user->total_groups = sprintf(_n('%d group', '%d groups', $total_groups, 'buddypress'), $total_groups);
     }
     if (bp_is_active('friends')) {
         $this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
     }
     if (bp_is_active('friends')) {
         $this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
     }
     $this->invite->user->total_blogs = null;
     $this->invite->group_id = $group_id;
     // Globaled in bp_group_has_invites()
     if (0 == $this->current_invite) {
         // loop has just started
         do_action('loop_start');
     }
 }
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:38,代码来源:bp-groups-template.php


示例16: friends_remove_data

function friends_remove_data($user_id)
{
    global $bp;
    do_action('friends_before_remove_data', $user_id);
    BP_Friends_Friendship::delete_all_for_user($user_id);
    // Remove usermeta
    bp_delete_user_meta($user_id, 'total_friend_count');
    // Remove friendship requests FROM user
    bp_core_delete_notifications_from_user($user_id, $bp->friends->id, 'friendship_request');
    do_action('friends_remove_data', $user_id);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:11,代码来源:bp-friends-functions.php


示例17: mpp_check_friends_access

/**
 * Check if the User Can access Friends only privacy
 * @param type $component_type
 * @param type $component_id
 * @param type $user_id
 * @return type
 */
function mpp_check_friends_access($component_type, $component_id, $user_id = null)
{
    $allow = false;
    if (is_super_admin() || $component_id == $user_id || bp_is_active('friends') && 'is_friend' == BP_Friends_Friendship::check_is_friend($user_id, $component_id)) {
        $allow = true;
    }
    return apply_filters('mpp_check_friends_access', $allow, $component_type, $component_id, $user_id);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:15,代码来源:mpp-permissions.php


示例18: bpdd_import_users_friends

function bpdd_import_users_friends()
{
    $users = bpdd_get_random_users_ids(50);
    for ($con = 0, $i = 0; $i < 100; $i++) {
        $user_one = $users[array_rand($users)];
        $user_two = $users[array_rand($users)];
        if (BP_Friends_Friendship::check_is_friend($user_one, $user_two) == 'not_friends') {
            // make them friends
            if (friends_add_friend($user_one, $user_two, true)) {
                $con++;
            }
        }
    }
    return $con;
}
开发者ID:vsalx,项目名称:rattieinfo,代码行数:15,代码来源:bp-default-data.php


示例19: bp_displayed_user_is_friend

 function bp_displayed_user_is_friend()
 {
     global $bp;
     $friend_privacy_enable = get_option('tn_wpmu_friend_privacy_status');
     $friend_privacy_redirect = get_option('tn_wpmu_friend_privacy_redirect');
     if ($friend_privacy_enable == "enable") {
         if (bp_is_user_activity() || bp_is_user_profile() || bp_is_user()) {
             if ('is_friend' != BP_Friends_Friendship::check_is_friend($bp->loggedin_user->id, $bp->displayed_user->id) && bp_loggedin_user_id() != bp_displayed_user_id()) {
                 if (!is_super_admin(bp_loggedin_user_id())) {
                     if ($friend_privacy_redirect == '') {
                         bp_core_redirect($bp->root_domain);
                     } else {
                         bp_core_redirect($friend_privacy_redirect);
                     }
                 }
             }
         }
     }
     //enable
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:20,代码来源:functions.php


示例20: test_save_method_should_update_existing_row

 /**
  * @group BP6247
  */
 public function test_save_method_should_update_existing_row()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $friendship = new BP_Friends_Friendship();
     $friendship->initiator_user_id = $u1;
     $friendship->friend_user_id = $u2;
     $friendship->is_confirmed = 0;
     $friendship->is_limited = 0;
     $friendship->date_created = bp_core_current_time();
     $friendship->is_confirmed = 1;
     $friendship->save();
     $fid = $friendship->id;
     $f = new BP_Friends_Friendship($fid);
     $f->is_confirmed = 1;
     $f->save();
     $f2 = new BP_Friends_Friendship($fid);
     $this->assertEquals(1, $f2->is_confirmed);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:22,代码来源:class-bp-friends-friendship.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP BP_Groups_Group类代码示例发布时间:2022-05-23
下一篇:
PHP BP_Core_User类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap