Changeset 12063 for sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-route-translation-helpers.php
- Timestamp:
- 09/15/2022 03:13:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-route-translation-helpers.php
r11837 r12063 24 24 $this->helpers = GP_Translation_Helpers::load_helpers(); 25 25 $this->template_path = dirname( __FILE__ ) . '/../templates/'; 26 } 27 28 /** 29 * Loads the 'discussions-dashboard' template. 30 * 31 * @since 0.0.2 32 * 33 * @param string|null $locale_slug Optional. The locale slug. E.g. "es". 34 * 35 * @return void 36 */ 37 public function discussions_dashboard( $locale_slug ) { 38 if ( ! is_user_logged_in() ) { 39 $this->die_with_404(); 40 } 41 $all_comments_count = count( 42 get_comments( 43 array( 44 'meta_key' => 'locale', 45 'meta_value' => $locale_slug, 46 ) 47 ) 48 ); 49 $comments_per_page = 12; 50 $total_pages = (int) ceil( $all_comments_count / $comments_per_page ); 51 $page_num_from_query = get_query_var( 'page' ); 52 $page_number = ( ! empty( $page_num_from_query ) && is_int( $page_num_from_query ) ) ? $page_num_from_query : 1; 53 $gp_locale = GP_Locales::by_slug( $locale_slug ); 54 $args = array( 55 'number' => $comments_per_page, 56 'meta_key' => 'locale', 57 'meta_value' => $locale_slug, 58 'paged' => $page_number, 59 ); 60 61 $comments_query = new WP_Comment_Query( $args ); 62 $comments = $comments_query->comments; 63 64 $this->tmpl( 'discussions-dashboard', get_defined_vars() ); 26 65 } 27 66
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)