Changeset 6542 for trunk/src/includes/admin/metaboxes.php
- Timestamp:
- 06/14/2017 02:14:39 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/metaboxes.php
r6438 r6542 20 20 function bbp_filter_dashboard_glance_items( $elements = array() ) { 21 21 22 // Bail if user cannot spectate 23 if ( ! current_user_can( 'spectate' ) ) { 24 return $elements; 25 } 26 22 27 // Get the statistics 23 $r = bbp_get_statistics(); 28 $r = bbp_get_statistics( array( 29 'count_pending_topics' => false, 30 'count_private_topics' => false, 31 'count_spammed_topics' => false, 32 'count_trashed_topics' => false, 33 'count_pending_replies' => false, 34 'count_private_replies' => false, 35 'count_spammed_replies' => false, 36 'count_trashed_replies' => false, 37 'count_empty_tags' => false 38 )); 39 40 // Users 41 if ( isset( $r['user_count'] ) ) { 42 $link = admin_url( 'users.php' ); 43 $text = sprintf( _n( '%s User', '%s Users', $r['user_count_int'], 'bbpress' ), $r['user_count'] ); 44 $elements[] = current_user_can( 'edit_users' ) 45 ? '<a href="' . esc_url( $link ) . '" class="bbp-glance-users">' . esc_html( $text ) . '</a>' 46 : esc_html( $text ); 47 } 24 48 25 49 // Forums 26 if ( current_user_can( 'publish_forums') ) {27 $link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), get_admin_url( null,'edit.php' ) );50 if ( isset( $r['forum_count'] ) ) { 51 $link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), admin_url( 'edit.php' ) ); 28 52 $text = sprintf( _n( '%s Forum', '%s Forums', $r['forum_count_int'], 'bbpress' ), $r['forum_count'] ); 29 $elements[] = '<a href="' . esc_url( $link ) . '" class="bbp-glance-forums">' . esc_html( $text ) . '</a>'; 53 $elements[] = current_user_can( 'publish_forums' ) 54 ? '<a href="' . esc_url( $link ) . '" class="bbp-glance-forums">' . esc_html( $text ) . '</a>' 55 : esc_html( $text ); 30 56 } 31 57 32 58 // Topics 33 if ( current_user_can( 'publish_topics') ) {34 $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), get_admin_url( null,'edit.php' ) );59 if ( isset( $r['topic_count'] ) ) { 60 $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ); 35 61 $text = sprintf( _n( '%s Topic', '%s Topics', $r['topic_count_int'], 'bbpress' ), $r['topic_count'] ); 36 $elements[] = '<a href="' . esc_url( $link ) . '" class="bbp-glance-topics">' . esc_html( $text ) . '</a>'; 62 $elements[] = current_user_can( 'publish_topics' ) 63 ? '<a href="' . esc_url( $link ) . '" class="bbp-glance-topics">' . esc_html( $text ) . '</a>' 64 : esc_html( $text ); 37 65 } 38 66 39 67 // Replies 40 if ( current_user_can( 'publish_replies') ) {41 $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), get_admin_url( null,'edit.php' ) );68 if ( isset( $r['reply_count'] ) ) { 69 $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ); 42 70 $text = sprintf( _n( '%s Reply', '%s Replies', $r['reply_count_int'], 'bbpress' ), $r['reply_count'] ); 43 $elements[] = '<a href="' . esc_url( $link ) . '" class="bbp-glance-replies">' . esc_html( $text ) . '</a>'; 71 $elements[] = current_user_can( 'publish_replies' ) 72 ? '<a href="' . esc_url( $link ) . '" class="bbp-glance-replies">' . esc_html( $text ) . '</a>' 73 : esc_html( $text ); 44 74 } 45 75 46 76 // Topic Tags 47 if ( bbp_allow_topic_tags() && current_user_can( 'manage_topic_tags') ) {48 $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), get_admin_url( null,'edit-tags.php' ) );77 if ( bbp_allow_topic_tags() && isset( $r['topic_tag_count'] ) ) { 78 $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit-tags.php' ) ); 49 79 $text = sprintf( _n( '%s Topic Tag', '%s Topic Tags', $r['topic_tag_count_int'], 'bbpress' ), $r['topic_tag_count'] ); 50 $elements[] = '<a href="' . esc_url( $link ) . '" class="bbp-glance-topic-tags">' . esc_html( $text ) . '</a>'; 80 $elements[] = current_user_can( 'manage_topic_tags' ) 81 ? '<a href="' . esc_url( $link ) . '" class="bbp-glance-topic-tags">' . esc_html( $text ) . '</a>' 82 : esc_html( $text ); 51 83 } 52 84 … … 97 129 $text = _n( 'Forum', 'Forums', $r['forum_count_int'], 'bbpress' ); 98 130 if ( current_user_can( 'publish_forums' ) ) { 99 $link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), get_admin_url( null,'edit.php' ) );131 $link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), admin_url( 'edit.php' ) ); 100 132 $num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>'; 101 133 $text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>'; … … 114 146 $text = _n( 'Topic', 'Topics', $r['topic_count_int'], 'bbpress' ); 115 147 if ( current_user_can( 'publish_topics' ) ) { 116 $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), get_admin_url( null,'edit.php' ) );148 $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ); 117 149 $num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>'; 118 150 $text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>'; … … 131 163 $text = _n( 'Reply', 'Replies', $r['reply_count_int'], 'bbpress' ); 132 164 if ( current_user_can( 'publish_replies' ) ) { 133 $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), get_admin_url( null,'edit.php' ) );165 $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ); 134 166 $num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>'; 135 167 $text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>'; … … 150 182 $text = _n( 'Topic Tag', 'Topic Tags', $r['topic_tag_count_int'], 'bbpress' ); 151 183 if ( current_user_can( 'manage_topic_tags' ) ) { 152 $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), get_admin_url( null,'edit-tags.php' ) );184 $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit-tags.php' ) ); 153 185 $num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>'; 154 186 $text = '<a href="' . esc_url( $link ) . '">' . $text . '</a>'; … … 182 214 $text = _n( 'User', 'Users', $r['user_count_int'], 'bbpress' ); 183 215 if ( current_user_can( 'edit_users' ) ) { 184 $link = get_admin_url( null,'users.php' );216 $link = admin_url( 'users.php' ); 185 217 $num = '<a href="' . $link . '">' . $num . '</a>'; 186 218 $text = '<a href="' . $link . '">' . $text . '</a>'; … … 200 232 $num = $r['topic_count_hidden']; 201 233 $text = _n( 'Hidden Topic', 'Hidden Topics', $r['topic_count_hidden_int'], 'bbpress' ); 202 $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), get_admin_url( null,'edit.php' ) );234 $link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ); 203 235 if ( '0' !== $num ) { 204 236 $link = add_query_arg( array( 'post_status' => bbp_get_spam_status_id() ), $link ); … … 222 254 $num = $r['reply_count_hidden']; 223 255 $text = _n( 'Hidden Reply', 'Hidden Replies', $r['reply_count_hidden_int'], 'bbpress' ); 224 $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), get_admin_url( null,'edit.php' ) );256 $link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ); 225 257 if ( '0' !== $num ) { 226 258 $link = add_query_arg( array( 'post_status' => bbp_get_spam_status_id() ), $link ); … … 244 276 $num = $r['empty_topic_tag_count']; 245 277 $text = _n( 'Empty Topic Tag', 'Empty Topic Tags', $r['empty_topic_tag_count_int'], 'bbpress' ); 246 $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), get_admin_url( null,'edit-tags.php' ) );278 $link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit-tags.php' ) ); 247 279 $num = '<a href="' . esc_url( $link ) . '">' . $num . '</a>'; 248 280 $text = '<a class="waiting" href="' . esc_url( $link ) . '">' . $text . '</a>';
Note: See TracChangeset
for help on using the changeset viewer.