本文整理汇总了PHP中bp_activity_remove_user_favorite函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_activity_remove_user_favorite函数的具体用法?PHP bp_activity_remove_user_favorite怎么用?PHP bp_activity_remove_user_favorite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_activity_remove_user_favorite函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_dtheme_unmark_activity_favorite
function bp_dtheme_unmark_activity_favorite()
{
global $bp;
bp_activity_remove_user_favorite($_POST['id']);
_e('Favorite', 'buddypress');
}
示例2: bp_dtheme_unmark_activity_favorite
/**
* Un-favourite an activity via a POST request.
*
* @return string HTML
* @since BuddyPress (1.2)
*/
function bp_dtheme_unmark_activity_favorite()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
if (bp_activity_remove_user_favorite($_POST['id'])) {
_e('Favorite', 'logicalboneshug');
} else {
_e('Remove Favorite', 'logicalboneshug');
}
exit;
}
示例3: bp_dtheme_unmark_activity_favorite
function bp_dtheme_unmark_activity_favorite()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
bp_activity_remove_user_favorite($_POST['id']);
_e('Favorite', 'buddypress');
}
示例4: bp_activity_action_remove_favorite
/**
* Remove activity from favorites.
*
* @since 1.2.0
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses check_admin_referer()
* @uses bp_activity_remove_user_favorite()
* @uses bp_action_variable()
* @uses bp_core_add_message()
* @uses bp_core_redirect()
* @uses wp_get_referer()
*
* @return bool False on failure.
*/
function bp_activity_action_remove_favorite()
{
if (!is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action('unfavorite')) {
return false;
}
// Check the nonce.
check_admin_referer('unmark_favorite');
if (bp_activity_remove_user_favorite(bp_action_variable(0))) {
bp_core_add_message(__('Activity removed as favorite.', 'buddypress'));
} else {
bp_core_add_message(__('There was an error removing that activity as a favorite. Please try again.', 'buddypress'), 'error');
}
bp_core_redirect(wp_get_referer() . '#activity-' . bp_action_variable(0));
}
示例5: bp_legacy_theme_unmark_activity_favorite
/**
* Un-favourite an activity via a POST request.
*
* @since 1.2.0
*
* @return string HTML
*/
function bp_legacy_theme_unmark_activity_favorite()
{
// Bail if not a POST action.
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
if (bp_activity_remove_user_favorite($_POST['id'])) {
_e('Favorite', 'buddypress');
} else {
_e('Remove Favorite', 'buddypress');
}
exit;
}
示例6: catch_unmark_favorite
/**
* Screen function for grabbing an unfavorite request
*
* If redirect_to is found, it comes from a single blog post page, so
* we handle it. Otherwise fall through to the BP native function
*/
public function catch_unmark_favorite()
{
// Let BP handle regular favoriting
if (!isset($_GET['redirect_to'])) {
return;
}
if (!is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action('unfavorite')) {
return false;
}
remove_action('bp_actions', 'bp_activity_action_remove_favorite');
// Check the nonce
check_admin_referer('unmark_favorite');
bp_activity_remove_user_favorite(bp_action_variable(0));
wp_redirect(stripslashes(urldecode($_GET['redirect_to'])));
}
示例7: test_remove_user_favorite_bad_activity_id
/**
* @group favorites
* @group bp_activity_remove_user_favorite
*/
public function test_remove_user_favorite_bad_activity_id()
{
$u1 = $this->factory->user->create();
$u2 = $this->factory->user->create();
$a = $this->factory->activity->create();
// bp_activity_add_user_favorite() requires a logged-in user.
$current_user = bp_loggedin_user_id();
$this->set_current_user($u1);
// Only favorite for user 1
bp_activity_add_user_favorite($a, $u1);
// Removing for user 2 should fail
$this->assertFalse(bp_activity_remove_user_favorite($a, $u2));
$this->assertEquals(1, bp_activity_get_meta($a, 'favorite_count'));
$this->set_current_user($current_user);
}
示例8: bp_activity_action_remove_favorite
function bp_activity_action_remove_favorite() {
global $bp;
if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unfavorite' )
return false;
/* Check the nonce */
check_admin_referer( 'unmark_favorite' );
if ( bp_activity_remove_user_favorite( $bp->action_variables[0] ) )
bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
else
bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
}
示例9: buddyboss_unmark_activity_favorite
/**
* Un-favourite an activity via a POST request.
*
* @return string HTML
* @since BuddyBoss 3.0
*/
function buddyboss_unmark_activity_favorite()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
if (bp_activity_remove_user_favorite($_POST['id'])) {
$resp['but_text'] = __('Like', 'buddyboss');
} else {
$resp['but_text'] = __('Unlike', 'buddyboss');
}
$resp['num_likes'] = get_wall_add_likes_comments((int) $_POST['id']);
$resp['like_count'] = (int) bp_activity_get_meta((int) $_POST['id'], 'favorite_count');
echo json_encode($resp);
exit;
}
示例10: bp_dtheme_unmark_activity_favorite_product
function bp_dtheme_unmark_activity_favorite_product()
{
global $bp;
bp_activity_remove_user_favorite($_POST['id']);
_e('Favorite', 'product');
}