Changeset 10303 for trunk/src/bp-notifications/bp-notifications-loader.php
- Timestamp:
- 10/22/2015 06:02:55 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-notifications/bp-notifications-loader.php
r10138 r10303 13 13 defined( 'ABSPATH' ) || exit; 14 14 15 /** 16 * Extends the component class to set up the Notifications component. 17 */ 15 18 class BP_Notifications_Component extends BP_Component { 16 19 … … 66 69 $bp = buddypress(); 67 70 68 // Define a slug, if necessary 71 // Define a slug, if necessary. 69 72 if ( ! defined( 'BP_NOTIFICATIONS_SLUG' ) ) { 70 73 define( 'BP_NOTIFICATIONS_SLUG', $this->id ); 71 74 } 72 75 73 // Global tables for the notifications component 76 // Global tables for the notifications component. 74 77 $global_tables = array( 75 78 'table_name' => $bp->table_prefix . 'bp_notifications', … … 103 106 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 104 107 105 // Determine user to use 108 // Determine user to use. 106 109 if ( bp_displayed_user_domain() ) { 107 110 $user_domain = bp_displayed_user_domain(); … … 116 119 $notifications_link = trailingslashit( $user_domain . $slug ); 117 120 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. 119 122 if ( bp_is_user() && bp_user_has_access() ) { 120 123 $count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() ); … … 125 128 } 126 129 127 // Add 'Notifications' to the main navigation 130 // Add 'Notifications' to the main navigation. 128 131 $main_nav = array( 129 132 'name' => $nav_name, … … 136 139 ); 137 140 138 // Add the subnav items to the notifications nav item 141 // Add the subnav items to the notifications nav item. 139 142 $sub_nav[] = array( 140 143 'name' => _x( 'Unread', 'Notification screen nav', 'buddypress' ), … … 174 177 public function setup_admin_bar( $wp_admin_nav = array() ) { 175 178 176 // Menus for logged in user 179 // Menus for logged in user. 177 180 if ( is_user_logged_in() ) { 178 181 179 // Setup the logged in user variables 182 // Setup the logged in user variables. 180 183 $notifications_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); 181 184 182 // Pending notification requests 185 // Pending notification requests. 183 186 $count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); 184 187 if ( ! empty( $count ) ) { … … 190 193 } 191 194 192 // Add the "My Account" sub menus 195 // Add the "My Account" sub menus. 193 196 $wp_admin_nav[] = array( 194 197 'parent' => buddypress()->my_account_menu_id, … … 198 201 ); 199 202 200 // Unread 203 // Unread. 201 204 $wp_admin_nav[] = array( 202 205 'parent' => 'my-account-' . $this->id, … … 206 209 ); 207 210 208 // Read 211 // Read. 209 212 $wp_admin_nav[] = array( 210 213 'parent' => 'my-account-' . $this->id, … … 225 228 public function setup_title() { 226 229 227 // Adjust title 230 // Adjust title. 228 231 if ( bp_is_notifications_component() ) { 229 232 $bp = buddypress(); … … 251 254 public function setup_cache_groups() { 252 255 253 // Global groups 256 // Global groups. 254 257 wp_cache_add_global_groups( array( 255 258 'bp_notifications',
Note: See TracChangeset
for help on using the changeset viewer.