Skip to:
Content

BuddyPress.org

Changeset 6805


Ignore:
Timestamp:
02/21/2013 12:27:33 AM (14 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

Location:
trunk/bp-templates/bp-legacy
Files:
2 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
  • trunk/bp-templates/bp-legacy/css/buddypress.css

    r6801 r6805  
    507507        clear: both;
    508508}
    509 #buddypress div#message p {
     509#buddypress div#message p,
     510#sitewide-notice p {
    510511        font-size: 90%;
    511512        display: block;
    … …  
    546547        font-weight: bold;
    547548}
    548 
     549#sitewide-notice #message {
     550        left: 2%;
     551        position: fixed;
     552        top: 1em;
     553        width: 96%;
     554        z-index: 9999;
     555}
     556#sitewide-notice.admin-bar-on #message {
     557        top: 3.3em;
     558}
     559#sitewide-notice strong {
     560        display: block;
     561        margin-bottom: -1em;
     562}
    549563
    550564/*--------------------------------------------------------------
    … …  
    10041018        font-weight: bold;
    10051019}
    1006 #buddypress div#message p {
     1020#buddypress div#message p,
     1021#sitewide-notice p {
    10071022        border: 1px solid #e1ca82;
    10081023        -moz-border-radius: 3px;
Note: See TracChangeset for help on using the changeset viewer.