Advertisement
Guest User

ML dashboard

a guest
Dec 14th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. <?php
  2. /**
  3. * Dashboard `My Account` page template.
  4. *
  5. * @since 2.0
  6. */
  7. if ( ! defined('ABSPATH') ) {
  8. exit;
  9. }
  10.  
  11. // Filter dashboard stats by listing.
  12. if ( ! empty( $_GET['listing'] ) && ( $listing = \MyListing\Src\Listing::get( $_GET['listing'] ) ) && $listing->editable_by_current_user() ) {
  13. return require locate_template( 'templates/dashboard/stats/single-listing.php' );
  14. }
  15.  
  16. // Get logged-in user stats.
  17. $stats = mylisting()->stats()->get_user_stats( get_current_user_id() );
  18. ?>
  19.  
  20. <!-- CAMBIO - if user is Editor or Admin -->
  21. <?php
  22. if ( current_user_can( 'delete_private_posts' ) ): ?>
  23. <!-- Fin Cambio (IF termina más abajo) -->
  24.  
  25. <div class="row">
  26. <div class="col-md-9 mlduo-welcome-message">
  27. <h1>
  28. <?php printf(
  29. _x( 'Hello, %s!', 'Dashboard welcome message', 'my-listing' ),
  30. apply_filters( 'mylisting/dashboard/greeting/username', trim( $current_user->user_firstname ) ? $current_user->user_firstname : $current_user->user_login, $current_user )
  31. ) ?>
  32. </h1>
  33.  
  34. </div>
  35. <div class="col-md-3">
  36. <?php require locate_template( 'templates/dashboard/stats/select-listing.php' ) ?>
  37. </div>
  38. </div>
  39.  
  40. <div class="row">
  41. <?php
  42. // Published listing count.
  43. mylisting_locate_template( 'templates/dashboard/stats/card.php', [
  44. 'icon' => 'icon-window',
  45. 'value' => number_format_i18n( absint( $stats->get( 'listings.published' ) ) ),
  46. 'description' => _x( 'Published Listings', 'Dashboard stats', 'my-listing' ),
  47. 'background' => mylisting()->stats()->color_one,
  48. ] );
  49.  
  50. // Pending listing count (pending_approval + pending_payment).
  51. mylisting_locate_template( 'templates/dashboard/stats/card.php', [
  52. 'icon' => 'icon-pencil-ruler',
  53. 'value' => number_format_i18n( absint( $stats->get( 'listings.pending' ) ) ),
  54. 'description' => _x( 'Pending Listings', 'Dashboard stats', 'my-listing' ),
  55. 'background' => mylisting()->stats()->color_two,
  56. ] );
  57. /* CAMBIO
  58. // Promoted listing count.
  59. mylisting_locate_template( 'templates/dashboard/stats/card.php', [
  60. 'icon' => 'icon-flash',
  61. 'value' => number_format_i18n( absint( $stats->get( 'promotions.count' ) ) ),
  62. 'description' => _x( 'Active Promotions', 'Dashboard stats', 'my-listing' ),
  63. 'background' => mylisting()->stats()->color_three,
  64. ] );
  65. FIN CAMBIO */
  66. // Recent views card.
  67. mylisting_locate_template( 'templates/dashboard/stats/card.php', [
  68. 'icon' => 'mi graphic_eq',
  69. 'value' => number_format_i18n( absint( $stats->get( 'visits.views.lastweek' ) ) ),
  70. 'description' => _x( 'Visits this week', 'Dashboard stats', 'my-listing' ),
  71. 'background' => mylisting()->stats()->color_four,
  72. ] );
  73. ?>
  74. </div>
  75.  
  76. <div class="row">
  77. <div class="col-md-4">
  78. <?php if ( c27()->get_setting( 'stats_views_section_enabled', true ) !== false ): ?>
  79. <?php require locate_template( 'templates/dashboard/stats/widgets/views.php' ) ?>
  80. <?php endif ?>
  81.  
  82. <?php if ( c27()->get_setting( 'stats_unique_views_section_enabled', true ) !== false ): ?>
  83. <?php require locate_template( 'templates/dashboard/stats/widgets/unique-views.php' ) ?>
  84. <?php endif ?>
  85.  
  86. <?php if ( c27()->get_setting( 'stats_devices_enabled', true ) !== false ): ?>
  87. <?php require locate_template( 'templates/dashboard/stats/widgets/devices.php' ) ?>
  88. <?php endif ?>
  89.  
  90. <?php if ( c27()->get_setting( 'stats_countries_enabled', true ) !== false ): ?>
  91. <?php require locate_template( 'templates/dashboard/stats/widgets/countries.php' ) ?>
  92. <?php endif ?>
  93. </div>
  94.  
  95. <div class="col-md-8">
  96.  
  97. <?php if ( c27()->get_setting( 'stats_visits_chart_enabled', true ) !== false ): ?>
  98. <?php require locate_template( 'templates/dashboard/stats/widgets/visits-chart.php' ) ?>
  99. <?php endif ?>
  100.  
  101. <?php if ( c27()->get_setting( 'stats_referrers_enabled', true ) !== false ): ?>
  102. <?php require locate_template( 'templates/dashboard/stats/widgets/referrers.php' ) ?>
  103. <?php endif ?>
  104.  
  105. <div class="row custom-row">
  106. <?php if ( c27()->get_setting( 'stats_platforms_enabled', true ) !== false ): ?>
  107. <div class="col-md-6">
  108. <?php require locate_template( 'templates/dashboard/stats/widgets/platforms.php' ) ?>
  109. </div>
  110. <?php endif ?>
  111.  
  112. <?php if ( c27()->get_setting( 'stats_browsers_enabled', true ) !== false ): ?>
  113. <div class="col-md-6">
  114. <?php require locate_template( 'templates/dashboard/stats/widgets/browsers.php' ) ?>
  115. </div>
  116. <?php endif ?>
  117. </div>
  118. </div>
  119. </div>
  120. <?php endif; // end of user capability check ?>
  121. <!-- Fin cambio -->
  122. <?php
  123. // Support WooCommerce dashboard hooks.
  124. do_action( 'woocommerce_account_dashboard' );
  125. do_action( 'woocommerce_before_my_account' );
  126. do_action( 'woocommerce_after_my_account' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement