Making WordPress.org

Changeset 6303


Ignore:
Timestamp:
12/21/2017 05:46:33 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Add moderator views as "My Account" submenu items in admin bar for quick access:

  • All topics
  • Topics with no replies
  • Unresolved topics
  • Tagged modlook

See #2951.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-users.php

    r6159 r6303  
    174174                        'href'   => bbp_get_favorites_permalink( $user_id ),
    175175                ) );
     176
     177                if ( current_user_can( 'moderate' ) ) {
     178                        $wp_admin_bar->add_group( array(
     179                                'parent' => 'my-account',
     180                                'id'     => 'moderator-views',
     181                                'meta'   => array(
     182                                        'class' => 'ab-sub-secondary',
     183                                ),
     184                        ) );
     185
     186                        $moderator_views = array(
     187                                'all-topics',
     188                                'no-replies',
     189                                'support-forum-no',
     190                                'taggedmodlook',
     191                        );
     192
     193                        foreach ( $moderator_views as $view ) {
     194                                if ( ! bbp_get_view_id( $view ) ) {
     195                                        continue;
     196                                }
     197
     198                                $wp_admin_bar->add_menu( array(
     199                                        'parent' => 'moderator-views',
     200                                        'id'     => $view,
     201                                        'title'  => bbp_get_view_title( $view ),
     202                                        'href'   => bbp_get_view_url( $view ),
     203                                ) );
     204                        }
     205                }
    176206        }
    177207
Note: See TracChangeset for help on using the changeset viewer.