/**
 * Mark group join requests read when an admin or moderator visits the group administration area.
 *
 * @since 1.9.0
 */
function bp_groups_screen_group_admin_requests_mark_notifications()
{
    if (bp_is_active('notifications')) {
        bp_notifications_mark_notifications_by_type(bp_loggedin_user_id(), buddypress()->groups->id, 'new_membership_request');
    }
}
/**
 * Mark at-mention notifications as read when users visit their Mentions page.
 *
 * @since 1.5.0
 *
 * @uses bp_notifications_mark_all_notifications_by_type()
 */
function bp_activity_remove_screen_notifications()
{
    if (!bp_is_active('notifications')) {
        return;
    }
    // Only mark read if you're looking at your own mentions.
    if (!bp_is_my_profile()) {
        return;
    }
    bp_notifications_mark_notifications_by_type(bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention');
}
/**
 * Mark notification(s) as read
 *
 * @package WP Idea Stream
 * @subpackage buddypress/notifications
 *
 * @since  2.0.0
 *
 * @uses   wp_idea_stream_is_single_idea() to check if viewing the single template of an idea
 * @uses   bp_notifications_mark_notifications_by_item_id() to mark notifications as read
 * @uses   bp_loggedin_user_id() to get the logged in user ID
 * @uses   wp_idea_stream_get_single_idea_id() to get the ID of the idea being viewed
 * @uses   buddypress() to get BuddyPress instance
 * @uses   wp_idea_stream_get_post_type() to get the ideas post type identifier
 * @uses   bp_is_user() to check a user's profile is displayed
 * @uses   bp_is_current_component( 'ideastream' ) to check it's an IdeaStream part of the profile
 * @uses   bp_notifications_mark_notifications_by_type() to mark notifications as read
 */
function wp_idea_stream_buddypress_comments_mark_notifications_read()
{
    if (!empty($_GET['notif'])) {
        if (wp_idea_stream_is_single_idea()) {
            bp_notifications_mark_notifications_by_item_id(bp_loggedin_user_id(), wp_idea_stream_get_single_idea_id(), buddypress()->ideastream->id, 'new_' . wp_idea_stream_get_post_type() . '_comment');
            bp_notifications_mark_notifications_by_item_id(bp_loggedin_user_id(), wp_idea_stream_get_single_idea_id(), buddypress()->ideastream->id, 'new_' . wp_idea_stream_get_post_type() . '_rate');
        }
        if (bp_is_user() && bp_is_current_component('ideastream')) {
            bp_notifications_mark_notifications_by_type(bp_loggedin_user_id(), buddypress()->ideastream->id, 'new_' . wp_idea_stream_get_post_type() . '_comment');
            bp_notifications_mark_notifications_by_type(bp_loggedin_user_id(), buddypress()->ideastream->id, 'new_' . wp_idea_stream_get_post_type() . '_rate');
        }
    }
}
Beispiel #4
0
 /**
  * mark related notification as read once media is visit by user
  *
  * @param   int $media_id ID of media to mark notification as read
  */
 function mark_notification_unread($media_id)
 {
     $post_id = rtmedia_media_id($media_id);
     $user_id = get_current_user_id();
     bp_notifications_mark_notifications_by_type($user_id, $this->component_id, $this->component_action . $post_id, $is_new = false);
 }
/**
 * Delete any friendship acceptance notifications for the logged in user.
 *
 * @since 1.9.0
 */
function bp_friends_mark_friendship_accepted_notifications_by_type()
{
    if (bp_is_active('notifications')) {
        bp_notifications_mark_notifications_by_type(bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted');
    }
}
/**
 * Mark at-mention notifications as read when users visit their Mentions page.
 *
 * @since 1.5.0
 * @since 2.5.0 Add the $user_id parameter
 *
 * @param int $user_id The id of the user whose notifications are marked as read.
 * @uses bp_notifications_mark_all_notifications_by_type()
 */
function bp_activity_remove_screen_notifications($user_id = 0)
{
    if (!bp_is_active('notifications')) {
        return;
    }
    // Only mark read if the current user is looking at his own mentions.
    if (empty($user_id) || (int) $user_id !== (int) bp_loggedin_user_id()) {
        return;
    }
    bp_notifications_mark_notifications_by_type($user_id, buddypress()->activity->id, 'new_at_mention');
}
/**
 * Mark notifications
 *
 * @package Rendez Vous
 * @subpackage Notifications
 *
 * @since Rendez Vous (1.0.0)
 */
function rendez_vous_remove_all_schedule_notifications()
{
    if (!isset($_GET['n'])) {
        return;
    }
    $bp = buddypress();
    /**
     * Would be nice if BuddyPress allowed marking notifications for an array of actions..
     */
    bp_notifications_mark_notifications_by_type(bp_loggedin_user_id(), buddypress()->rendez_vous->id, 'rendez_vous_schedule');
}