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


PHP bp_notifications_delete_notifications_by_item_id函数代码示例

本文整理汇总了PHP中bp_notifications_delete_notifications_by_item_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_notifications_delete_notifications_by_item_id函数的具体用法?PHP bp_notifications_delete_notifications_by_item_id怎么用?PHP bp_notifications_delete_notifications_by_item_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_notifications_delete_notifications_by_item_id函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_follow_notifications_remove_on_unfollow

/**
 * Removes notification when a user unfollows another user.
 *
 * @since 1.2.1
 *
 * @param object $follow The BP_Follow object.
 */
function bp_follow_notifications_remove_on_unfollow(BP_Follow $follow)
{
    // BP 1.9+
    if (bp_is_active('notifications')) {
        bp_notifications_delete_notifications_by_item_id($follow->leader_id, $follow->follower_id, buddypress()->follow->id, 'new_follow');
        // BP < 1.9 - delete notifications the old way
    } elseif (!class_exists('BP_Core_Login_Widget')) {
        global $bp;
        bp_core_delete_notifications_by_item_id($follow->leader_id, $follow->follower_id, $bp->follow->id, 'new_follow');
    }
}
开发者ID:vikramshaw,项目名称:buddypress-followers,代码行数:18,代码来源:notifications.php

示例2: bp_messages_message_delete_notifications

/**
 * When a message is deleted, delete corresponding notifications.
 *
 * @since BuddyPress (2.0.0)
 *
 * @param int   $thread_id   ID of the thread.
 * @param array $message_ids IDs of the messages.
 */
function bp_messages_message_delete_notifications($thread_id, $message_ids)
{
    if (!bp_is_active('notifications')) {
        return;
    }
    // For each recipient, delete notifications corresponding to each message.
    $thread = new BP_Messages_Thread($thread_id);
    foreach ($thread->get_recipients() as $recipient) {
        foreach ($message_ids as $message_id) {
            bp_notifications_delete_notifications_by_item_id($recipient->user_id, (int) $message_id, buddypress()->messages->id, 'new_message');
        }
    }
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:21,代码来源:bp-messages-notifications.php

示例3: bp_groups_delete_promotion_notifications

/**
 * When a demotion takes place, delete any corresponding promotion notifications.
 *
 * @since 2.0.0
 *
 * @param int $user_id  ID of the user.
 * @param int $group_id ID of the group.
 */
function bp_groups_delete_promotion_notifications($user_id = 0, $group_id = 0)
{
    if (bp_is_active('notifications') && !empty($group_id) && !empty($user_id)) {
        bp_notifications_delete_notifications_by_item_id($user_id, $group_id, buddypress()->groups->id, 'member_promoted_to_admin');
        bp_notifications_delete_notifications_by_item_id($user_id, $group_id, buddypress()->groups->id, 'member_promoted_to_mod');
    }
}
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:15,代码来源:bp-groups-notifications.php

示例4: wp_idea_stream_buddypress_rates_delete_notification

/**
 * Delete a notification in case a the vote was removed
 *
 * @package WP Idea Stream
 * @subpackage buddypress/notifications
 *
 * @since  2.0.0
 *
 * @param  int $idea_id the ID of the idea
 * @param  int $user_id the ID of the user who rated the idea
 * @uses   get_post_field() to get the author of the idea
 * @uses   bp_notifications_delete_notifications_by_item_id() to delete the notification
 * @uses   buddypress() to get BuddyPress instance
 * @uses   wp_idea_stream_get_post_type() to get the ideas post type identifier
 */
function wp_idea_stream_buddypress_rates_delete_notification($idea_id = 0, $user_id = 0)
{
    if (empty($idea_id)) {
        return;
    }
    $author = get_post_field('post_author', $idea_id);
    // Bail, if no author or no user id or if both are same
    if (empty($author) || empty($user_id) || $author == $user_id) {
        return;
    }
    // Remove the notification.
    bp_notifications_delete_notifications_by_item_id($author, $idea_id, buddypress()->ideastream->id, 'new_' . wp_idea_stream_get_post_type() . '_rate', $user_id);
}
开发者ID:mrjarbenne,项目名称:wp-idea-stream,代码行数:28,代码来源:notifications.php

示例5: new_rsvp

 /**
  * Process new event RSVPs
  * @version 2.0
  */
 function new_rsvp()
 {
     $rsvps = $this->rsvps;
     $new_rsvp = array();
     // Clean each field individually
     if (!isset($_POST['attendance'])) {
         $error = 'You must select your expected attendance!';
     } else {
         $new_rsvp['rsvp'] = $_POST['attendance'];
     }
     if ($this->req_role && empty($_POST['rsvp-role']) && $_POST['attendance'] != 'no') {
         $error = 'You must select your preferred role!';
     } elseif ($this->req_role) {
         $new_rsvp['role'] = $_POST['rsvp-role'];
     }
     if (isset($_POST['rsvp-comment'])) {
         $new_rsvp['comment'] = sanitize_text_field($_POST['rsvp-comment']);
     }
     // If there are no errors, we can save the stuff
     if (!isset($error)) {
         // Update the postmeta
         $user_id = get_current_user_id();
         $rsvps[$user_id] = $new_rsvp;
         update_post_meta($this->post_id, 'event_rsvps', $rsvps);
         bp_core_add_message('Thank you for responding!');
         // Clear notifications on each group calendar
         foreach ($this->calendars as $calendar) {
             if (is_group_calendar($calendar->term_id)) {
                 global $bp;
                 $group_id = groups_get_id($calendar->slug);
                 bp_notifications_delete_notifications_by_item_id($user_id, $group_id, $bp->groups->id, 'new_calendar_event', $this->post_id);
             }
         }
         // Redirect
         wp_redirect(get_the_permalink());
         // Otherwise, throw the error message
     } else {
         bp_core_add_message($error, 'error');
     }
 }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:44,代码来源:events.php

示例6: delete_notification_by_item_id

 /**
  * deletes existing media notification of a perticular user
  *
  * @param   int $post_author_id Author of post
  * @param   int $post_id ID of a post to delete related notification
  */
 function delete_notification_by_item_id($post_author_id, $post_id)
 {
     bp_notifications_delete_notifications_by_item_id($post_author_id, $post_id, $this->component_id, $this->component_action . $post_id);
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:10,代码来源:RTMediaNotification.php

示例7: bp_core_delete_notifications_by_item_id

/**
 * Delete notifications for an item ID
 *
 * Used when clearing out notifications for a specific component when the user
 * has visited that component.
 *
 * @deprecated Deprecated since BuddyPress 1.9.0. Use
 *  bp_notifications_delete_notifications_by_item_id() instead.
 *
 * @since BuddyPress (1.0)
 * @param int $user_id
 * @param string $component_name
 * @param string $component_action
 * @return boolean True on success, false on fail
 */
function bp_core_delete_notifications_by_item_id($user_id, $item_id, $component_name, $component_action, $secondary_item_id = false)
{
    // Bail if notifications is not active
    if (!bp_is_active('notifications')) {
        return false;
    }
    // Trigger the deprecated function notice
    _deprecated_function(__FUNCTION__, '1.9', 'bp_notifications_delete_notifications_by_item_id()');
    return bp_notifications_delete_notifications_by_item_id($user_id, $item_id, $component_name, $component_action, $secondary_item_id);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:25,代码来源:bp-members-notifications.php

示例8: bp_friends_mark_friendship_withdrawn_notifications_by_item_id

/**
 * Remove friend request notice when a member withdraws their friend request.
 *
 * @since 1.9.0
 *
 * @param int    $friendship_id Friendship ID (not used).
 * @param object $friendship    Friendship Object.
 */
function bp_friends_mark_friendship_withdrawn_notifications_by_item_id($friendship_id, $friendship)
{
    if (bp_is_active('notifications')) {
        bp_notifications_delete_notifications_by_item_id($friendship->friend_user_id, $friendship->initiator_user_id, buddypress()->friends->id, 'friendship_request');
    }
}
开发者ID:sourabh-mehra,项目名称:ASVYS-Charity-Foundation,代码行数:14,代码来源:bp-friends-notifications.php

示例9: bp_messages_message_delete_notifications

/**
 * When a message is deleted, delete corresponding notifications.
 *
 * @since BuddyPress (2.0.0)
 *
 * @param int $message_id ID of the message.
 */
function bp_messages_message_delete_notifications($message_id = 0)
{
    if (bp_is_active('notifications') && !empty($message_id)) {
        bp_notifications_delete_notifications_by_item_id(bp_loggedin_user_id(), (int) $message_id, buddypress()->messages->id, 'new_message');
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:13,代码来源:bp-messages-notifications.php


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