Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2013 12:27:33 AM (13 years ago)
Author:
boonebgorges
Message:

Display sitewide notices in theme compat by hooking to wp_footer.

This accounts for the fact that the theme compat layer no longer handles
sidebars, and bp-default had the notices hardcoded in its sidebar.

See #4802

Props r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-templates/bp-legacy/buddypress-functions.php

    r6790 r6805  
    125125                                add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
    126126
     127                }
     128
     129                /** Notices ***********************************************************/
     130
     131                if ( bp_is_active( 'messages' ) ) {
     132                        add_action( 'wp_footer', array( $this, 'sitewide_notices' ), 9999 );
    127133                }
    128134
     
    294300         */
    295301        public function localize_scripts() {
    296 
     302        }
     303
     304        /**
     305         * Outputs sitewide notices markup in the footer.
     306         *
     307         * @since BuddyPress (1.7)
     308         *
     309         * @see https://buddypress.trac.wordpress.org/ticket/4802
     310         */
     311        public function sitewide_notices() {
     312                // Do not show notices if user is not logged in
     313                if ( ! is_user_logged_in() )
     314                        return;
     315
     316                // add a class to determine if the admin bar is on or not
     317                $class = did_action( 'admin_bar_menu' ) ? 'admin-bar-on' : 'admin-bar-off';
     318
     319                echo '<div id="sitewide-notice" class="' . $class . '">';
     320                bp_message_get_notices();
     321                echo '</div>';
    297322        }
    298323
Note: See TracChangeset for help on using the changeset viewer.