本文整理汇总了PHP中friends_reject_friendship函数的典型用法代码示例。如果您正苦于以下问题:PHP friends_reject_friendship函数的具体用法?PHP friends_reject_friendship怎么用?PHP friends_reject_friendship使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了friends_reject_friendship函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friends_screen_requests
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(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(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
}
do_action('friends_screen_requests');
if (isset($_GET['new'])) {
bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
}
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例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()));
}
do_action('friends_screen_requests');
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例3: 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'));
}
示例4: bp_dtheme_ajax_reject_friendship
function bp_dtheme_ajax_reject_friendship()
{
check_admin_referer('friends_reject_friendship');
if (!friends_reject_friendship($_POST['id'])) {
echo "-1<div id='message' class='error'><p>" . __('There was a problem rejecting that request. Please try again.', 'buddypress') . '</p></div>';
}
return true;
}
示例5: bp_dtheme_ajax_reject_friendship
function bp_dtheme_ajax_reject_friendship()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
check_admin_referer('friends_reject_friendship');
if (!friends_reject_friendship($_POST['id'])) {
echo "-1<div id='message' class='error'><p>" . __('There was a problem rejecting that request. Please try again.', 'buddypress') . '</p></div>';
}
return true;
}
示例6: test_requests_on_reject
/**
* @group friends_get_friendship_request_user_ids
* @group friends_add_friend
* @group friends_reject_friendship
*/
public function test_requests_on_reject()
{
$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 1 rejects friendship
$old_user = get_current_user_id();
$this->set_current_user($u1);
friends_reject_friendship(friends_get_friendship_id($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);
}
示例7: friends_screen_requests
function friends_screen_requests()
{
global $bp;
if (isset($bp->action_variables) && 'accept' == $bp->action_variables[0] && is_numeric($bp->action_variables[1])) {
if (friends_accept_friendship($bp->action_variables[1])) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect($bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);
} else {
if (isset($bp->action_variables) && 'reject' == $bp->action_variables[0] && is_numeric($bp->action_variables[1])) {
if (friends_reject_friendship($bp->action_variables[1])) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect($bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);
}
}
do_action('friends_screen_requests');
bp_core_load_template(apply_filters('friends_template_requests', 'friends/requests'));
}
示例8: bp_dtheme_ajax_reject_friendship
/**
* Reject a user friendship request via a POST request.
*
* @return mixed String on error, void on success
* @since BuddyPress (1.2)
*/
function bp_dtheme_ajax_reject_friendship()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
check_admin_referer('friends_reject_friendship');
if (!friends_reject_friendship((int) $_POST['id'])) {
echo "-1<div class='clearfix'></div><div id='message' class='error alert alert-danger'><p>" . __('There was a problem rejecting that request. Please try again.', 'firmasite') . '</p></div>';
}
exit;
}
示例9: friends_screen_requests
function friends_screen_requests() {
global $bp;
if ( isset($bp->action_variables) && 'accept' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
/* Check the nonce */
check_admin_referer( 'friends_accept_friendship' );
if ( friends_accept_friendship( $bp->action_variables[1] ) ) {
bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) );
} else {
bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' );
}
bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
} else if ( isset($bp->action_variables) && 'reject' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
/* Check the nonce */
check_admin_referer( 'friends_reject_friendship' );
if ( friends_reject_friendship( $bp->action_variables[1] ) ) {
bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) );
} else {
bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' );
}
bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
}
do_action( 'friends_screen_requests' );
if ( isset( $_GET['new'] ) )
bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_request' );
bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
}