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


PHP bp_activity_remove_user_favorite函数代码示例

本文整理汇总了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');
}
开发者ID:hscale,项目名称:webento,代码行数:6,代码来源:ajax.php

示例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;
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:19,代码来源:ajax.php

示例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');
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:9,代码来源:ajax.php

示例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));
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:31,代码来源:bp-activity-actions.php

示例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;
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:20,代码来源:buddypress-functions.php

示例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'])));
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:21,代码来源:thatcamp-favorites.php

示例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);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:19,代码来源:functions.php

示例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] );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:16,代码来源:bp-activity.php

示例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;
}
开发者ID:tvolmari,项目名称:hammydowns,代码行数:22,代码来源:buddyboss-wall-loader.php

示例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');
}
开发者ID:JeffreyBue,项目名称:jb,代码行数:6,代码来源:ajax.php


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