Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/07/2013 05:15:51 PM (13 years ago)
Author:
johnjamesjacoby
Message:

First pass at bp-notifications component. Includes:

  • Backwards compatibility for old core functions.
  • Screens, functions, classes, and actions for Notifications.
  • Improved class methods for getting, updating, and deleting notifications.
  • Template parts in bp-legacy for theme compatibility.
  • A few basic unit tests.

@todo's:

  • Improve template output with dedicated functions, markup, classes, et all.
  • More unit tests.
  • Pagination links.
  • Auto-activate on update, so existing installations do not lose previously core functionality.

See #5148. Props johnjamesjacoby, boonebgorges, r-a-y.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-buddybar.php

    r6760 r7521  
    1818function bp_adminbar_notifications_menu() {
    1919
    20         if ( !is_user_logged_in() )
     20        // Bail if notifications is not active
     21        if ( ! bp_is_active( 'notifications' ) ) {
    2122                return false;
    22 
    23         echo '<li id="bp-adminbar-notifications-menu"><a href="' . bp_loggedin_user_domain() . '">';
    24         _e( 'Notifications', 'buddypress' );
    25 
    26         if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() ) ) { ?>
    27                 <span><?php echo count( $notifications ) ?></span>
    28         <?php
    2923        }
    3024
    31         echo '</a>';
    32         echo '<ul>';
    33 
    34         if ( $notifications ) {
    35                 $counter = 0;
    36                 for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
    37                         $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
    38 
    39                         <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
    40 
    41                         <?php $counter++;
    42                 }
    43         } else { ?>
    44 
    45                 <li><a href="<?php echo bp_loggedin_user_domain() ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
    46 
    47         <?php
    48         }
    49 
    50         echo '</ul>';
    51         echo '</li>';
     25        bp_notifications_buddybar_menu();
    5226}
    5327add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
Note: See TracChangeset for help on using the changeset viewer.