Advertisement
ShafterP

Untitled

Apr 8th, 2020
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.42 KB | None | 0 0
  1. <?php
  2. /*
  3.     Template Name: My Profile
  4. */
  5.  
  6.  
  7.                                    
  8.  
  9.    
  10.  
  11.  
  12. if( !is_user_logged_in() ){
  13.     wp_redirect( home_url() );
  14. }
  15.  
  16. get_header();
  17. the_post();
  18. get_template_part( 'includes/title' );
  19. global $current_user;
  20. $current_user = wp_get_current_user();
  21.  
  22. $permalink = couponxl_get_permalink_by_tpl( 'page-tpl_my_profile' );
  23. $theme_usage = couponxl_get_option( 'theme_usage' );
  24. if( $theme_usage == 'coupons' && $subpage == 'my_deals' ){
  25.     $subpage = '';
  26. }
  27. if( $theme_usage == 'deals' && $subpage == 'my_coupons' ){
  28.     $subpage = '';
  29. }  
  30. ?>
  31.  
  32. <section>
  33.     <div class="container">
  34.         <?php if( pbs_is_demo() ) :?>
  35.         <div class="row">
  36.             <div class="col-sm-12">
  37.                 <div class="white-block demo-notice"><?php _e( 'This is demo. Image uploading and offer submitting is not possible.','couponxl' ); ?></div>
  38.             </div>
  39.         </div>
  40.         <?php endif; ?>
  41.  
  42.         <div class="row">
  43.             <div class="col-sm-12">
  44.                 <div class="white-block top-border">
  45.  
  46.                     <div class="white-block-title clearfix">
  47.                         <i class="fa fa-user"></i>
  48.                         <h2><?php the_title(); ?></h2>
  49.                         <div class="pull-right">
  50.                             <ul class="list-unstyled list-inline">
  51.                                
  52.                                 <?php $user = wp_get_current_user();
  53.                                 if ( in_array('administrator', (array) $user->roles) || in_array('parceiro', (array) $user->roles) || in_array('mauro', (array) $user->roles) ) {
  54.                                    }else{
  55. ?>                             <li>
  56.                                
  57.                                    
  58.                                     <?= do_shortcode('[plugin_delete_me /]') ?>
  59.                                    
  60.                                 </li>
  61.                                 <?php } ?>
  62.                                
  63.                                
  64.                                 <li>
  65.                                     <a href="<?php echo wp_logout_url( home_url() ); ?>" class="log-out">
  66.                                         <i class="fa fa-sign-out"></i>
  67.                                     </a>
  68.                                 </li>
  69.                                 <li>
  70.                                     <p><?php echo esc_html( $current_user->display_name ); ?></p>
  71.                                 </li>
  72.                                 <li>
  73.                                     <?php
  74.                                     $avatar_url = couponxl_get_avatar_url( get_avatar( $current_user->ID, 55 ) );
  75.                                     ?>
  76.                                     <img src="<?php echo esc_url( $avatar_url ); ?>" class="img-responsive img-user-avatar" alt="avatar" />
  77.                                 </li>
  78.                             </ul>
  79.                         </div>
  80.                     </div>
  81.  
  82.                     <div class="white-block-content">
  83.                         <div class="row">
  84.                             <div class="col-sm-4">
  85.                                 <ul class="list-unstyled">
  86.                                     <?php
  87.                                    
  88. $user = wp_get_current_user();
  89. if ( in_array('administrator', (array) $user->roles) || in_array('parceiro', (array) $user->roles) || in_array('mauro', (array) $user->roles) ) {
  90.  
  91.                                    
  92.                                     ?>
  93.                                    
  94.                                    
  95.                                     <?php if( $theme_usage == 'all' || $theme_usage == 'coupons' ): ?>
  96.                                         <li class="<?php echo 'my_coupons' == $subpage ? 'active' : '' ?>">
  97.                                             <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_coupons' ), array( 'all' ) ) ); ?>">
  98.                                                 <h4><?php _e( 'My Coupons', 'couponxl' ) ?></h4>
  99.                                                 <p><small><?php _e( 'Check here coupons you have submitted or add new one', 'couponxl' ) ?></small></p>
  100.                                             </a>
  101.                                         </li>
  102.                                     <?php endif; ?>
  103.                                     <?php if( $theme_usage == 'all' || $theme_usage == 'deals' ): ?>
  104.                                    
  105.                                         <li class="<?php echo 'vendas' == $subpage ? 'active' : '' ?>">
  106.                                             <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'vendas' ), array( 'all' ) ) ); ?>">
  107.                                                 <h4>Minhas vendas</h4>
  108.                                                 <p><small>Lance e consultes as suas vendas.</small></p>
  109.                                             </a>
  110.                                         </li>
  111.  
  112.                                        
  113.                                    
  114.                                         <li class="<?php echo 'my_deals' == $subpage ? 'active' : '' ?>">
  115.                                             <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_deals' ), array( 'all' ) ) ); ?>">
  116.                                                 <h4><?php _e( 'My Deals', 'couponxl' ) ?></h4>
  117.                                                 <p><small><?php _e( 'Check here deals you have submitted or add new one', 'couponxl' ) ?></small></p>
  118.                                             </a>
  119.                                         </li>
  120.                                        
  121.                                     <?php endif; ?>
  122.                                    
  123.                                     <li class="<?php echo empty( $subpage ) ? 'active' : '' ?>">
  124.                                         <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'dashboard' ), array( 'all' ) ) ); ?>">
  125.                                             <h4><?php _e( 'My Dashboard', 'couponxl' ) ?></h4>
  126.                                             <p><small><?php _e( 'Quick informations about your profile', 'couponxl' ) ?></small></p>
  127.                                         </a>
  128.                                     </li>
  129.                                     <li class="<?php echo 'edit_profile' == $subpage ? 'active' : '' ?>">
  130.                                         <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'edit_profile' ), array( 'all' ) ) ); ?>">
  131.                                             <h4><?php _e( 'Edit Profile', 'couponxl' ) ?></h4>
  132.                                             <p><small><?php _e( 'Change your profile details here', 'couponxl' ) ?></small></p>
  133.                                         </a>
  134.                                     </li>
  135.                                     <li class="<?php echo 'mu_purchases' == $subpage ? 'active' : '' ?>">
  136.                                         <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_purchases' ), array( 'all' ) ) ); ?>">
  137.                                             <h4><?php _e( 'My Purchases', 'couponxl' ) ?></h4>
  138.                                             <p><small><?php _e( 'Check here deals you have purchased', 'couponxl' ) ?></small></p>
  139.                                         </a>
  140.                                     </li>
  141.                                         <li class="<?php echo 'edit_profile' == $subpage ? 'active' : '' ?>">
  142.                                         <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'edit_profile' ), array( 'all' ) ) ); ?>">
  143.                                             <h4><?php _e( 'Edit Profile', 'couponxl' ) ?></h4>
  144.                                             <p><small><?php _e( 'Change your profile details here', 'couponxl' ) ?></small></p>
  145.                                         </a>
  146.                                     </li>
  147.                                     <?php
  148.                                    
  149.     }else{
  150.         ?>
  151.        
  152.                              <?php if( $theme_usage == 'all' || $theme_usage == 'coupons' ): ?>
  153.                                         <li class="<?php echo 'my_coupons' == $subpage ? 'active' : '' ?>">
  154.                                             <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_coupons' ), array( 'all' ) ) ); ?>">
  155.                                                 <h4><?php _e( 'My Coupons', 'couponxl' ) ?></h4>
  156.                                                 <p><small><?php _e( 'Check here coupons you have submitted or add new one', 'couponxl' ) ?></small></p>
  157.                                             </a>
  158.                                         </li>
  159.                                     <?php endif; ?>
  160.                                     <?php if( $theme_usage == 'all' || $theme_usage == 'deals' ): ?>
  161.                                    
  162.                                         <li class="<?php echo empty( $subpage ) ? 'active' : '' ?>">
  163.                                         <a href="<?php echo esc_url( $permalink ); ?>">
  164.                                             <h4><?php _e( 'My Dashboard', 'couponxl' ) ?></h4>
  165.                                             <p><small><?php _e( 'Quick informations about your profile', 'couponxl' ) ?></small></p>
  166.                                         </a>
  167.                                     </li>
  168.                                    
  169.                                     <li class="<?php echo 'edit_profile' == $subpage ? 'active' : '' ?>">
  170.                                         <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'edit_profile' ), array( 'all' ) ) ); ?>">
  171.                                             <h4><?php _e( 'Edit Profile', 'couponxl' ) ?></h4>
  172.                                             <p><small><?php _e( 'Change your profile details here', 'couponxl' ) ?></small></p>
  173.                                         </a>
  174.                                     </li>
  175.                                         <li class="<?php echo 'mu_purchases' == $subpage ? 'active' : '' ?>">
  176.                                         <a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_purchases' ), array( 'all' ) ) ); ?>">
  177.                                             <h4><?php _e( 'My Purchases', 'couponxl' ) ?></h4>
  178.                                             <p><small><?php _e( 'Check here deals you have purchased', 'couponxl' ) ?></small></p>
  179.                                         </a>
  180.                                     </li>
  181.                                        
  182.                                     <?php endif; ?>
  183.                                    
  184.                                
  185.                                    
  186.                                
  187.        
  188.         <?php
  189.        
  190.         }
  191.         ?>                         
  192.                                    
  193.                     <?php              
  194.                                     if ( in_array('subscriber', (array) $user->roles)) {
  195.         echo "<style>.col-sm-4 ul li:nth-child(5) {display: none;}</style>";        }   ?>
  196.                                    
  197.                                    
  198.                                 </ul>
  199.                             </div>
  200.                             <div class="col-sm-8">
  201.                                 <?php                              
  202.                                 switch( $subpage ){
  203.                                     case 'dashboard' : include( locate_template( 'includes/profile-pages/dashboard.php' ) ); break;
  204.                                     case 'edit_profile' : include( locate_template( 'includes/profile-pages/edit-profile.php' ) ); break;
  205.                                     case 'my_purchases' : include( locate_template( 'includes/profile-pages/my-purchases.php' ) ); break;
  206.                                     case 'my_coupons' : include( locate_template( 'includes/profile-pages/my-coupons.php' ) ); break;
  207.                                     case 'my_deals' : include( locate_template( 'includes/profile-pages/my-deals.php' ) ); break;
  208.                                     case 'vendas' : include( locate_template( 'includes/profile-pages/vendas.php' ) ); break;
  209.                                     default:
  210.                                         $user = wp_get_current_user();
  211.                                         if ( in_array('administrator', (array) $user->roles) || in_array('parceiro', (array) $user->roles) || in_array('mauro', (array) $user->roles) ) {
  212.                                             include(locate_template('includes/profile-pages/dashboard.php'));
  213.                                         } else {
  214.                                             include(locate_template('includes/profile-pages/vendas.php'));
  215.                                         }
  216.                                         break;
  217.                                 }
  218.                                 ?>
  219.                             </div>
  220.                         </div>
  221.                     </div>
  222.                 </div>
  223.             </div>
  224.         </div>
  225.     </div>
  226. </section>
  227.  
  228. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement