Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/22/2015 06:02:55 AM (11 years ago)
Author:
tw2113
Message:

More docs cleanup for Notifications component.

See #6404.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-notifications/bp-notifications-loader.php

    r10138 r10303  
    1313defined( 'ABSPATH' ) || exit;
    1414
     15/**
     16 * Extends the component class to set up the Notifications component.
     17 */
    1518class BP_Notifications_Component extends BP_Component {
    1619
     
    6669                $bp = buddypress();
    6770
    68                 // Define a slug, if necessary
     71                // Define a slug, if necessary.
    6972                if ( ! defined( 'BP_NOTIFICATIONS_SLUG' ) ) {
    7073                        define( 'BP_NOTIFICATIONS_SLUG', $this->id );
    7174                }
    7275
    73                 // Global tables for the notifications component
     76                // Global tables for the notifications component.
    7477                $global_tables = array(
    7578                        'table_name'      => $bp->table_prefix . 'bp_notifications',
     
    103106        public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    104107
    105                 // Determine user to use
     108                // Determine user to use.
    106109                if ( bp_displayed_user_domain() ) {
    107110                        $user_domain = bp_displayed_user_domain();
     
    116119                $notifications_link = trailingslashit( $user_domain . $slug );
    117120
    118                 // Only grab count if we're on a user page and current user has access
     121                // Only grab count if we're on a user page and current user has access.
    119122                if ( bp_is_user() && bp_user_has_access() ) {
    120123                        $count    = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
     
    125128                }
    126129
    127                 // Add 'Notifications' to the main navigation
     130                // Add 'Notifications' to the main navigation.
    128131                $main_nav = array(
    129132                        'name'                    => $nav_name,
     
    136139                );
    137140
    138                 // Add the subnav items to the notifications nav item
     141                // Add the subnav items to the notifications nav item.
    139142                $sub_nav[] = array(
    140143                        'name'            => _x( 'Unread', 'Notification screen nav', 'buddypress' ),
     
    174177        public function setup_admin_bar( $wp_admin_nav = array() ) {
    175178
    176                 // Menus for logged in user
     179                // Menus for logged in user.
    177180                if ( is_user_logged_in() ) {
    178181
    179                         // Setup the logged in user variables
     182                        // Setup the logged in user variables.
    180183                        $notifications_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() );
    181184
    182                         // Pending notification requests
     185                        // Pending notification requests.
    183186                        $count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
    184187                        if ( ! empty( $count ) ) {
     
    190193                        }
    191194
    192                         // Add the "My Account" sub menus
     195                        // Add the "My Account" sub menus.
    193196                        $wp_admin_nav[] = array(
    194197                                'parent' => buddypress()->my_account_menu_id,
     
    198201                        );
    199202
    200                         // Unread
     203                        // Unread.
    201204                        $wp_admin_nav[] = array(
    202205                                'parent' => 'my-account-' . $this->id,
     
    206209                        );
    207210
    208                         // Read
     211                        // Read.
    209212                        $wp_admin_nav[] = array(
    210213                                'parent' => 'my-account-' . $this->id,
     
    225228        public function setup_title() {
    226229
    227                 // Adjust title
     230                // Adjust title.
    228231                if ( bp_is_notifications_component() ) {
    229232                        $bp = buddypress();
     
    251254        public function setup_cache_groups() {
    252255
    253                 // Global groups
     256                // Global groups.
    254257                wp_cache_add_global_groups( array(
    255258                        'bp_notifications',
Note: See TracChangeset for help on using the changeset viewer.