2017-11-09 20 views
1

관리자 계정이 로그인되어있는 경우 제출 작업 단계를 생략하도록 조건을 어떻게 설정할 수 있습니까? 이럴 가능성이 있니?Woocommerce 작업 목록 단계에서 관리자 제외 단계 기능

public static function submit_job_steps($steps) { 
    if (self::get_packages() && apply_filters('wcpl_enable_paid_job_listing_submission', true)) { 
     // We need to hijack the preview submission to redirect to WooCommerce and add a step to select a package. 
     // Add a step to allow the user to choose a package. Comes after preview. 
     $steps['wc-choose-package'] = array(
      'name'  => __('Choose a package', 'wp-job-manager-wc-paid-listings'), 
      'view'  => array(__CLASS__, 'choose_package'), 
      'handler' => array(__CLASS__, 'choose_package_handler'), 
      'priority' => 25, 
     ); 
     // If we instead want to show the package selection FIRST, change the priority and add a new handler. 
     if ('before' === get_option('job_manager_paid_listings_flow')) { 
      $steps['wc-choose-package']['priority'] = 5; 
      $steps['wc-process-package'] = array(
       'name'  => '', 
       'view'  => false, 
       'handler' => array(__CLASS__, 'choose_package_handler'), 
       'priority' => 25, 
      ); 
      // If showing the package step after preview, the preview button text should be changed to show this. 
     } elseif ('before' !== get_option('job_manager_paid_listings_flow')) { 
      add_filter('submit_job_step_preview_submit_text', array(__CLASS__, 'submit_button_text'), 10); 
     } 

     // We should make sure new jobs are pending payment and not published or pending. 
     add_filter('submit_job_post_status', array(__CLASS__, 'submit_job_post_status'), 10, 2); 
    } 
    return $steps; 
} 

답변

1

이 함수의 시작 부분에 그냥이 줄을 추가 할 수 있습니다 : 관리자가 로그인 할 때 능력 만 관리자 사용자 역할입니다

if(current_user_can('manage_options')) return $step; 

'manage_options'으로 함수가 처리하지 않고 $step을 반환합니다 ...

또는

if(get_current_user_id() == 'administrator') return $step; 
+0

고맙습니다. –