本文整理汇总了PHP中bp_activity_clear_new_mentions函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_activity_clear_new_mentions函数的具体用法?PHP bp_activity_clear_new_mentions怎么用?PHP bp_activity_clear_new_mentions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_activity_clear_new_mentions函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_dtheme_activity_template_loader
function bp_dtheme_activity_template_loader()
{
global $bp;
$scope = '';
if (!empty($_POST['scope'])) {
$scope = $_POST['scope'];
}
// We need to calculate and return the feed URL for each scope
switch ($scope) {
case 'friends':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/friends/feed/';
break;
case 'groups':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/groups/feed/';
break;
case 'favorites':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/favorites/feed/';
break;
case 'mentions':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/';
bp_activity_clear_new_mentions($bp->loggedin_user->id);
break;
default:
$feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
break;
}
/* Buffer the loop in the template to a var for JS to spit out. */
ob_start();
gconnect_locate_template(array('activity/activity-loop.php'), true);
$result['contents'] = ob_get_contents();
$result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
ob_end_clean();
echo json_encode($result);
}
示例2: bp_legacy_theme_activity_template_loader
/**
* Load the activity loop template when activity is requested via AJAX,
*
* @return string JSON object containing 'contents' (output of the template loop
* for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
*
* @since BuddyPress (1.2)
*/
function bp_legacy_theme_activity_template_loader()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
$scope = '';
if (!empty($_POST['scope'])) {
$scope = $_POST['scope'];
}
// We need to calculate and return the feed URL for each scope
switch ($scope) {
case 'friends':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/';
break;
case 'groups':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/';
break;
case 'favorites':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
break;
case 'mentions':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
bp_activity_clear_new_mentions(bp_loggedin_user_id());
break;
default:
$feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
break;
}
// Buffer the loop in the template to a var for JS to spit out.
ob_start();
bp_get_template_part('activity/activity-loop');
$result['contents'] = ob_get_contents();
/**
* Filters the feed URL for when activity is requested via AJAX.
*
* @since BuddyPress (1.7.0)
*
* @param string $feed_url URL for the feed to be used.
* @param string $scope Scope for the activity request.
*/
$result['feed_url'] = apply_filters('bp_legacy_theme_activity_feed_url', $feed_url, $scope);
ob_end_clean();
exit(json_encode($result));
}
示例3: bp_activity_reset_my_new_mentions
/**
* Reset the logged-in user's new mentions data when he visits his mentions screen.
*
* @since 1.5.0
*
* @uses bp_is_my_profile()
* @uses bp_activity_clear_new_mentions()
* @uses bp_loggedin_user_id()
*/
function bp_activity_reset_my_new_mentions()
{
if (bp_is_my_profile()) {
bp_activity_clear_new_mentions(bp_loggedin_user_id());
}
}
示例4: bp_dtheme_activity_template_loader
/**
* Load the activity loop template when activity is requested via AJAX,
*
* @return string JSON object containing 'contents' (output of the template loop for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
* @since BuddyPress (1.2)
*/
function bp_dtheme_activity_template_loader()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
$scope = '';
if (!empty($_POST['scope'])) {
$scope = $_POST['scope'];
}
// We need to calculate and return the feed URL for each scope
switch ($scope) {
case 'friends':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/';
break;
case 'groups':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/';
break;
case 'favorites':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
break;
case 'mentions':
$feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
bp_activity_clear_new_mentions(bp_loggedin_user_id());
break;
default:
$feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
break;
}
// Buffer the loop in the template to a var for JS to spit out.
ob_start();
locate_template(array('activity/activity-loop.php'), true);
$result['contents'] = ob_get_contents();
$result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
ob_end_clean();
exit(json_encode($result));
}
示例5: bpcustom_activity_template_loader
function bpcustom_activity_template_loader()
{
global $bp;
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
bpcustom_setup_components();
$action = bpcustom_get_current_action();
$scope = $action;
// We need to calculate and return the feed URL for each scope
switch ($scope) {
case 'friends':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/friends/feed/';
break;
case 'groups':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/groups/feed/';
break;
case 'favorites':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/favorites/feed/';
break;
case 'mentions':
$feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/';
bp_activity_clear_new_mentions($bp->loggedin_user->id);
break;
default:
$feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
break;
}
/* Buffer the loop in the template to a var for JS to spit out. */
ob_start();
locate_template(array('members/single/activity.php'), true);
$result = array();
$result['contents'] = ob_get_contents();
$result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
ob_end_clean();
echo json_encode($result);
}
示例6: test_bp_activity_remove_screen_notifications_on_new_mentions_cleared
/**
* @group bp_activity_remove_screen_notifications
* @group mentions
* @ticket BP6687
*/
public function test_bp_activity_remove_screen_notifications_on_new_mentions_cleared()
{
$this->create_notifications();
$notifications = BP_Notifications_Notification::get(array('item_id' => $this->a1));
// Double check it's there
$this->assertEquals(array($this->a1), wp_list_pluck($notifications, 'item_id'));
$this->assertEquals(1, bp_get_total_mention_count_for_user($this->u1));
// Clear notifications for $this->u1
bp_activity_clear_new_mentions($this->u1);
$notifications = BP_Notifications_Notification::get(array('item_id' => $this->a1));
$this->assertEmpty($notifications, 'Notifications should be cleared when new mention metas are removed');
$this->assertEmpty(bp_get_total_mention_count_for_user($this->u1));
}