function bp_wire_posts_template($item_id, $component_slug, $can_post, $per_page, $max) { global $bp; if ($bp->current_component == $bp->wire->slug) { $this->table_name = $bp->profile->table_name_wire; // If the user is viewing their own wire, delete the notifications. if ('all-posts' == $bp->current_action && bp_is_home()) { bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'xprofile', 'new_wire_post'); } } else { $this->table_name = $bp->{$component_slug}->table_name_wire; } $this->pag_page = isset($_REQUEST['wpage']) ? intval($_REQUEST['wpage']) : 1; $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page; $this->wire_posts = BP_Wire_Post::get_all_for_item($item_id, $this->table_name, $this->pag_page, $this->pag_num); $this->total_wire_post_count = (int) $this->wire_posts['count']; $this->wire_posts = $this->wire_posts['wire_posts']; $this->wire_post_count = count($this->wire_posts); if ((int) get_site_option('non-friend-wire-posting') && ($bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug)) { $this->can_post = 1; } else { $this->can_post = $can_post; } $this->pag_links = paginate_links(array('base' => add_query_arg('wpage', '%#%', $bp->displayed_user->domain), 'format' => '', 'total' => ceil($this->total_wire_post_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1)); }
/** * bp_em_screen_two() * * Sets up and displays the screen output for the sub nav item "em/screen-two" */ function bp_em_my_bookings() { global $bp, $EM_Event; //assume any notifications here are considered viewed via this page bp_core_delete_notifications_for_user_by_type(get_current_user_id(), 'events', 'pending_booking'); bp_core_delete_notifications_for_user_by_type(get_current_user_id(), 'events', 'confirmed_booking'); bp_core_delete_notifications_for_user_by_type(get_current_user_id(), 'events', 'cancelled_booking'); if (!is_object($EM_Event) && !empty($_REQUEST['event_id'])) { $EM_Event = new EM_Event($_REQUEST['event_id']); } /** * If the user has not Accepted or Rejected anything, then the code above will not run, * we can continue and load the template. */ do_action('bp_em_my_bookings'); add_action('bp_template_title', 'bp_em_my_bookings_title'); add_action('bp_template_content', 'bp_em_my_bookings_content'); /* Finally load the plugin template file. */ bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins')); }
function bp_has_message_threads($args = '') { global $bp, $messages_template; $defaults = array('user_id' => $bp->loggedin_user->id, 'box' => 'inbox', 'per_page' => 10, 'max' => false); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if ('notices' == $bp->current_action && !is_site_admin()) { wp_redirect($bp->displayed_user->id); } else { if ('inbox' == $bp->current_action) { bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'messages', 'new_message'); } if ('sentbox' == $bp->current_action) { $box = 'sentbox'; } if ('notices' == $bp->current_action) { $box = 'notices'; } $messages_template = new BP_Messages_Template($user_id, $box, $per_page, $max); } return $messages_template->has_threads(); }
/** * Remove a screen notification for a user. */ function bp_em_remove_screen_notifications() { global $bp; bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, $bp->events->slug, 'attending'); }
/** * xprofile_remove_screen_notifications() * * Removes notifications from the notification menu when a user clicks on them and * is taken to a specific screen. * * @package BuddyPress Core */ function xprofile_remove_screen_notifications() { global $bp; bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'profile', 'new_wire_post'); }
/** * */ function bp_zoneideas_remove_screen_notifications() { global $bp; /** * When clicking on a screen notification, we need to remove it from the menu. * The following command will do so. */ bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, $bp->zoneideas->slug, 'new_high_five'); }
function friends_screen_my_friends() { global $bp; // Delete any friendship acceptance notifications for the user when viewing a profile bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'friends', 'friendship_accepted'); do_action('friends_screen_my_friends'); bp_core_load_template(apply_filters('friends_template_my_friends', 'friends/index')); }
function groups_screen_group_admin_requests() { global $bp; if ( $bp->current_component == $bp->groups->slug && 'membership-requests' == $bp->action_variables[0] ) { /* Ask for a login if the user is coming here via an email notification */ if ( !is_user_logged_in() ) bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . $bp->root_domain . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/membership-requests/' ) ); if ( !$bp->is_item_admin || 'public' == $bp->groups->current_group->status ) return false; // Remove any screen notifications bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->groups->id, 'new_membership_request' ); $request_action = $bp->action_variables[1]; $membership_id = $bp->action_variables[2]; if ( isset($request_action) && isset($membership_id) ) { if ( 'accept' == $request_action && is_numeric($membership_id) ) { /* Check the nonce first. */ if ( !check_admin_referer( 'groups_accept_membership_request' ) ) return false; // Accept the membership request if ( !groups_accept_membership_request( $membership_id ) ) { bp_core_add_message( __( 'There was an error accepting the membership request, please try again.', 'buddypress' ), 'error' ); } else { bp_core_add_message( __( 'Group membership request accepted', 'buddypress' ) ); } } else if ( 'reject' == $request_action && is_numeric($membership_id) ) { /* Check the nonce first. */ if ( !check_admin_referer( 'groups_reject_membership_request' ) ) return false; // Reject the membership request if ( !groups_reject_membership_request( $membership_id ) ) { bp_core_add_message( __( 'There was an error rejecting the membership request, please try again.', 'buddypress' ), 'error' ); } else { bp_core_add_message( __( 'Group membership request rejected', 'buddypress' ) ); } } do_action( 'groups_group_request_managed', $bp->groups->current_group->id, $request_action, $membership_id ); bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/membership-requests/' ); } do_action( 'groups_screen_group_admin_requests', $bp->groups->current_group->id ); bp_core_load_template( apply_filters( 'groups_template_group_admin_requests', 'groups/single/home' ) ); } }
function groups_screen_group_admin_requests() { global $bp, $group_obj; if ($bp->current_component == $bp->groups->slug && 'membership-requests' == $bp->action_variables[0]) { if (!$bp->is_item_admin || 'public' == $group_obj->status) { return false; } // Remove any screen notifications bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, $bp->groups->slug, 'new_membership_request'); $request_action = $bp->action_variables[1]; $membership_id = $bp->action_variables[2]; if (isset($request_action) && isset($membership_id)) { if ('accept' == $request_action && is_numeric($membership_id)) { // Accept the membership request if (!groups_accept_membership_request($membership_id)) { bp_core_add_message(__('There was an error accepting the membership request, please try again.', 'buddypress'), 'error'); } else { bp_core_add_message(__('Group membership request accepted', 'buddypress')); } } else { if ('reject' == $request_action && is_numeric($membership_id)) { // Reject the membership request if (!groups_reject_membership_request($membership_id)) { bp_core_add_message(__('There was an error rejecting the membership request, please try again.', 'buddypress'), 'error'); } else { bp_core_add_message(__('Group membership request rejected', 'buddypress')); } } } do_action('groups_group_request_managed', $group_obj->id, $request_action, $membership_id); bp_core_redirect(site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/membership-requests'); } do_action('groups_screen_group_admin_requests', $group_obj->id); bp_core_load_template(apply_filters('groups_template_group_admin_requests', 'groups/admin/membership-requests')); } }
function social_articles_remove_screen_notifications() { global $bp; bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'social_articles', 'new_high_five'); }
function friends_clear_friend_notifications() { global $bp; if ( isset( $_GET['new'] ) ) bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_accepted' ); }
/** * xprofile_remove_screen_notifications() * * Removes notifications from the notification menu when a user clicks on them and * is taken to a specific screen. * * @package BuddyPress Core */ function xprofile_remove_screen_notifications() { global $bp; bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->profile->id, 'new_at_mention' ); }