Inbox screen. * * @since 1.0.0 */ function messages_screen_inbox() { if ( bp_action_variables() ) { bp_do_404(); return; } /** * Fires right before the loading of the Messages inbox screen template file. * * @since 1.0.0 */ do_action( 'messages_screen_inbox' ); /** * Filters the template to load for the Messages inbox screen. * * @since 1.0.0 * * @param string $template Path to the messages template to load. */ bp_core_load_template( apply_filters( 'messages_template_inbox', 'members/single/home' ) ); } /** * Load the Messages > Sent screen. * * @since 1.0.0 */ function messages_screen_sentbox() { if ( bp_action_variables() ) { bp_do_404(); return; } /** * Fires right before the loading of the Messages sentbox screen template file. * * @since 1.0.0 */ do_action( 'messages_screen_sentbox' ); /** * Filters the template to load for the Messages sentbox screen. * * @since 1.0.0 * * @param string $template Path to the messages template to load. */ bp_core_load_template( apply_filters( 'messages_template_sentbox', 'members/single/home' ) ); } /** * Load the Messages > Compose screen. * * @since 1.0.0 */ function messages_screen_compose() { if ( bp_action_variables() ) { bp_do_404(); return; } // Remove any saved message data from a previous session. messages_remove_callback_values(); /** * Fires right before the loading of the Messages compose screen template file. * * @since 1.0.0 */ do_action( 'messages_screen_compose' ); /** * Filters the template to load for the Messages compose screen. * * @since 1.0.0 * * @param string $template Path to the messages template to load. */ bp_core_load_template( apply_filters( 'messages_template_compose', 'members/single/home' ) ); } /** * Load an individual conversation screen. * * @since 1.0.0 * * @return false|null False on failure. */ function messages_screen_conversation() { // Bail if not viewing a single message. if ( ! bp_is_messages_component() || ! bp_is_current_action( 'view' ) ) { return false; } $thread_id = (int) bp_action_variable( 0 ); if ( empty( $thread_id ) || ! messages_is_valid_thread( $thread_id ) ) { if ( is_user_logged_in() ) { bp_core_add_message( __( 'The conversation you tried to access is no longer available', 'buddypress' ), 'error' ); } bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ) ); } // No access. if ( ! messages_check_thread_access( $thread_id ) && ! bp_current_user_can( 'bp_moderate' ) ) { // If not logged in, prompt for login. if ( ! is_user_logged_in() ) { bp_core_no_access(); return; // Redirect away. } else { bp_core_add_message( __( 'You do not have access to that conversation.', 'buddypress' ), 'error' ); bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ) ); } } // Load up BuddyPress one time. $bp = buddypress(); // Decrease the unread count in the nav before it's rendered. $count = bp_get_total_unread_messages_count(); $class = ( 0 === $count ) ? 'no-count' : 'count'; $nav_name = sprintf( __( 'Messages %s', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) ); // Edit the Navigation name. $bp->members->nav->edit_nav( array( 'name' => $nav_name, ), $bp->messages->slug ); /** * Fires right before the loading of the Messages view screen template file. * * @since 1.7.0 */ do_action( 'messages_screen_conversation' ); /** * Filters the template to load for the Messages view screen. * * @since 1.0.0 * * @param string $template Path to the messages template to load. */ bp_core_load_template( apply_filters( 'messages_template_view_message', 'members/single/home' ) ); } add_action( 'bp_screens', 'messages_screen_conversation' ); /** * Load the Messages > Notices screen. * * @since 1.0.0 * * @return false|null False on failure. */ function messages_screen_notices() { if ( bp_action_variables() ) { bp_do_404(); return; } /** * Fires right before the loading of the Messages notices screen template file. * * @since 1.0.0 */ do_action( 'messages_screen_notices' ); /** * Filters the template to load for the Messages notices screen. * * @since 1.0.0 * * @param string $template Path to the messages template to load. */ bp_core_load_template( apply_filters( 'messages_template_notices', 'members/single/home' ) ); } /** * Render the markup for the Messages section of Settings > Notifications. * * @since 1.0.0 */ function messages_screen_notification_settings() { if ( bp_action_variables() ) { bp_do_404(); return; } if ( !$new_messages = bp_get_user_meta( bp_displayed_user_id(), 'notification_messages_new_message', true ) ) { $new_messages = 'yes'; } ?>
/> | /> |