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

PHP friends_withdraw_friendship函数代码示例

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

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



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

示例1: friends_screen_requests

/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    do_action('friends_screen_requests');
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:36,代码来源:bp-friends-screens.php


示例2: friends_screen_requests

/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    /**
     * Fires before the loading of template for the friends requests page.
     *
     * @since BuddyPress (1.0.0)
     */
    do_action('friends_screen_requests');
    /**
     * Filters the template used to display the My Friends page.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param string $template Path to the friends request template to load.
     */
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:48,代码来源:bp-friends-screens.php


示例3: test_requests_on_withdraw

 /**
  * @group friends_get_friendship_request_user_ids
  * @group friends_add_friend
  * @group friends_withdraw_friendship
  */
 public function test_requests_on_withdraw()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     // request friendship
     friends_add_friend($u2, $u1);
     // get request count for user 1 and assert
     $requests = friends_get_friendship_request_user_ids($u1);
     $this->assertEquals(array($u2), $requests);
     // user 2 withdraws friendship
     $old_user = get_current_user_id();
     $this->set_current_user($u2);
     friends_withdraw_friendship($u2, $u1);
     // refetch request count for user 1 and assert
     $requests = friends_get_friendship_request_user_ids($u1);
     $this->assertEquals(array(), $requests);
     $this->set_current_user($old_user);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:23,代码来源:functions.php


示例4: bp_legacy_theme_ajax_addremove_friend

/**
 * Friend/un-friend a user via a POST request.
 *
 * @return string HTML
 * @since BuddyPress (1.2)
 */
function bp_legacy_theme_ajax_addremove_friend()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Cast fid as an integer
    $friend_id = (int) $_POST['fid'];
    // Trying to cancel friendship
    if ('is_friend' == BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $friend_id)) {
        check_ajax_referer('friends_remove_friend');
        if (!friends_remove_friend(bp_loggedin_user_id(), $friend_id)) {
            echo __('Friendship could not be canceled.', 'buddypress');
        } else {
            echo '<a id="friend-' . esc_attr($friend_id) . '" class="add" rel="add" title="' . __('Add Friend', 'buddypress') . '" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $friend_id, 'friends_add_friend') . '">' . __('Add Friend', 'buddypress') . '</a>';
        }
        // Trying to request friendship
    } elseif ('not_friends' == BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $friend_id)) {
        check_ajax_referer('friends_add_friend');
        if (!friends_add_friend(bp_loggedin_user_id(), $friend_id)) {
            echo __(' Friendship could not be requested.', 'buddypress');
        } else {
            echo '<a id="friend-' . esc_attr($friend_id) . '" class="remove" rel="remove" title="' . __('Cancel Friendship Request', 'buddypress') . '" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $friend_id . '/', 'friends_withdraw_friendship') . '" class="requested">' . __('Cancel Friendship Request', 'buddypress') . '</a>';
        }
        // Trying to cancel pending request
    } elseif ('pending' == BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $friend_id)) {
        check_ajax_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), $friend_id)) {
            echo '<a id="friend-' . esc_attr($friend_id) . '" class="add" rel="add" title="' . __('Add Friend', 'buddypress') . '" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $friend_id, 'friends_add_friend') . '">' . __('Add Friend', 'buddypress') . '</a>';
        } else {
            echo __("Friendship request could not be cancelled.", 'buddypress');
        }
        // Request already pending
    } else {
        echo __('Request Pending', 'buddypress');
    }
    exit;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:44,代码来源:buddypress-functions.php


示例5: bp_dtheme_ajax_addremove_friend

/**
 * Friend/un-friend a user via a POST request.
 *
 * @return string HTML
 * @since BuddyPress (1.2)
 */
function bp_dtheme_ajax_addremove_friend()
{
    // 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.', 'logicalboneshug');
        } else {
            echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __('Add Friend', 'logicalboneshug') . '" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $_POST['fid'], 'friends_add_friend') . '">' . __('Add Friend', 'logicalboneshug') . '</a>';
        }
    } elseif ('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.', 'logicalboneshug');
        } else {
            echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __('Cancel Friendship Request', 'logicalboneshug') . '" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . (int) $_POST['fid'] . '/', 'friends_withdraw_friendship') . '" class="requested">' . __('Cancel Friendship Request', 'logicalboneshug') . '</a>';
        }
    } elseif ('pending' == BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), (int) $_POST['fid'])) {
        check_ajax_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), (int) $_POST['fid'])) {
            echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __('Add Friend', 'logicalboneshug') . '" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $_POST['fid'], 'friends_add_friend') . '">' . __('Add Friend', 'logicalboneshug') . '</a>';
        } else {
            echo __("Friendship request could not be cancelled.", 'logicalboneshug');
        }
    } else {
        echo __('Request Pending', 'logicalboneshug');
    }
    exit;
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:38,代码来源:ajax.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP frmElements函数代码示例发布时间:2022-05-15
下一篇:
PHP friends_remove_friend函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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