Skip to:
Content

bbPress.org


Ignore:
Timestamp:
08/18/2012 07:47:06 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Admin:

  • First pass at WordPress core style about and credits UI.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-admin.php

    r4139 r4159  
    123123        /** Filters ***********************************************************/
    124124
    125         // Add link to settings page
    126         add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
     125        // Modify bbPress's admin links
     126        add_filter( 'plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 );
    127127
    128128        /** Network Admin *****************************************************/
     
    207207            );
    208208        }
     209
     210        // These are later removed in admin_head
     211        if ( bbp_current_user_can_see( 'bbp_about_page' ) ) {
     212
     213            // About
     214            add_dashboard_page(
     215                __( 'Welcome to bbPress',  'bbpress' ),
     216                __( 'Welcome to bbPress',  'bbpress' ),
     217                $this->minimum_capability,
     218                'bbp-about',
     219                array( $this, 'about_screen' )
     220            );
     221
     222            // Credits
     223            add_dashboard_page(
     224                __( 'Welcome to bbPress',  'bbpress' ),
     225                __( 'Welcome to bbPress',  'bbpress' ),
     226                $this->minimum_capability,
     227                'bbp-credits',
     228                array( $this, 'credits_screen' )
     229            );
     230        }
    209231    }
    210232
     
    230252     *
    231253     * @since bbPress (r3767)
    232      * @return type 
     254     * @return type
    233255     */
    234256    public static function new_install() {
     
    339361     * @return array Processed links
    340362     */
    341     public static function add_settings_link( $links, $file ) {
    342 
    343         if ( plugin_basename( bbpress()->file ) == $file ) {
    344             $settings_link = '<a href="' . add_query_arg( array( 'page' => 'bbpress' ), admin_url( 'options-general.php' ) ) . '">' . __( 'Settings', 'bbpress' ) . '</a>';
    345             array_unshift( $links, $settings_link );
    346         }
    347 
    348         return $links;
     363    public static function modify_plugin_action_links( $links, $file ) {
     364
     365        // Return normal links if not bbPress
     366        if ( plugin_basename( bbpress()->file ) != $file )
     367            return $links;
     368
     369        // Add a few links to the existing links array
     370        return array_merge( $links, array(
     371            'settings' => '<a href="' . add_query_arg( array( 'page' => 'bbpress'   ), admin_url( 'options-general.php' ) ) . '">' . __( 'Settings', 'bbpress' ) . '</a>',
     372            'about'    => '<a href="' . add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php'           ) ) . '">' . __( 'About',    'bbpress' ) . '</a>'
     373        ) );
    349374    }
    350375
     
    377402        remove_submenu_page( 'tools.php', 'bbp-converter' );
    378403        remove_submenu_page( 'tools.php', 'bbp-reset'     );
     404        remove_submenu_page( 'index.php', 'bbp-about'     );
     405        remove_submenu_page( 'index.php', 'bbp-credits'   );
    379406
    380407        // The /wp-admin/images/ folder
     
    387414        $menu_icon_url_2x = $this->images_url . 'menu-2x.png?ver='    . $version;
    388415        $icon32_url_2x    = $this->images_url . 'icons32-2x.png?ver=' . $version;
     416        $badge_url        = $this->images_url . 'badge.png?ver='      . $version;
     417        $badge_url_2x     = $this->images_url . 'badge-2x.png?ver='   . $version;
    389418
    390419        // Top level menu classes
     
    395424        <style type="text/css" media="screen">
    396425        /*<![CDATA[*/
     426
     427            /* Version Badge */
     428
     429            .bbp-badge {
     430                padding-top: 142px;
     431                height: 50px;
     432                width: 173px;
     433                color: #fafafa;
     434                font-weight: bold;
     435                font-size: 14px;
     436                text-align: center;
     437                margin: 0 -5px;
     438                background: url('<?php echo $badge_url; ?>') no-repeat;
     439            }
     440
     441            .about-wrap .bbp-badge {
     442                position: absolute;
     443                top: 0;
     444                right: 0;
     445            }
    397446
    398447            #bbp-dashboard-right-now p.sub,
     
    561610            #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
    562611
    563             #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,             
     612            #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,
    564613            #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image,
    565614            #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
     
    601650                #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
    602651
    603                 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,             
     652                #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,
    604653                #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image,
    605654                #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
     
    607656                    background-size: 100px 64px;
    608657                }
     658
     659                .bbp-badge {
     660                    background-image: url('<?php echo $badge_url_2x; ?>');
     661                    background-size: 173px 194px;
     662                }
    609663            }
    610664
     
    612666
    613667                /* Green Scheme Images */
    614                
     668
    615669                .post-com-count {
    616670                    background-image: url('<?php echo $wp_admin_url; ?>bubble_bg.gif');
     
    9531007                    background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
    9541008                }
    955                
     1009
    9561010                @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
    9571011                    .icon32.icon-post,
     
    10411095    }
    10421096
     1097    /** About *****************************************************************/
     1098
     1099    /**
     1100     * Output the about screen
     1101     *
     1102     * @since bbPress (r4159)
     1103     */
     1104    public function about_screen() {
     1105
     1106        $display_version = bbp_get_version(); ?>
     1107
     1108        <div class="wrap about-wrap">
     1109            <h1><?php printf( __( 'Welcome to bbPress %s' ), $display_version ); ?></h1>
     1110            <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! bbPress %s is ready to make your community a safer, faster, and better looking place to hang out!' ), $display_version ); ?></div>
     1111            <div class="bbp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
     1112
     1113            <h2 class="nav-tab-wrapper">
     1114                <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>">
     1115                    <?php _e( 'What&#8217;s New' ); ?>
     1116                </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>">
     1117                    <?php _e( 'Credits' ); ?>
     1118                </a>
     1119            </h2>
     1120
     1121            <div class="return-to-dashboard">
     1122                <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-settings' ), 'index.php' ) ) ); ?>"><?php _e( 'Go to Forum Settings' ); ?></a>
     1123            </div>
     1124
     1125        </div>
     1126
     1127        <?php
     1128    }
     1129
     1130    /**
     1131     * Output the credits screen
     1132     *
     1133     * @since bbPress (r4159)
     1134     */
     1135    public function credits_screen() {
     1136
     1137        $display_version = bbp_get_version(); ?>
     1138
     1139        <div class="wrap about-wrap">
     1140            <h1><?php printf( __( 'Welcome to bbPress %s' ), $display_version ); ?></h1>
     1141            <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! bbPress %s is ready to make your community a safer, faster, and better looking place to hang out!' ), $display_version ); ?></div>
     1142            <div class="bbp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
     1143
     1144            <h2 class="nav-tab-wrapper">
     1145                <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
     1146                    <?php _e( 'What&#8217;s New' ); ?>
     1147                </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
     1148                    <?php _e( 'Credits' ); ?>
     1149                </a>
     1150            </h2>
     1151
     1152            <div class="return-to-dashboard">
     1153                <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-settings' ), 'index.php' ) ) ); ?>"><?php _e( 'Go to Forum Settings' ); ?></a>
     1154            </div>
     1155
     1156        </div>
     1157
     1158        <?php
     1159    }
     1160
    10431161    /** Updaters **************************************************************/
    10441162
     
    10851203
    10861204                ?>
    1087            
     1205
    10881206                <p><?php _e( 'All done!', 'bbpress' ); ?></p>
    10891207                <a class="button" href="index.php?page=bbpress-update"><?php _e( 'Go Back', 'bbpress' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.