Beispiel #1
0
 /**
  * Add vendor action link in user dashboard
  *
  * @access public
  * @return array
  */
 function vendor_action_links($actions, $user_object)
 {
     global $WCMp;
     if (is_user_wcmp_vendor($user_object)) {
         $vendor = get_wcmp_vendor($user_object->ID);
         if ($vendor) {
             $actions['view_vendor'] = "<a target=_blank class='view_vendor' href='" . $vendor->permalink . "'>" . __('View', $WCMp->text_domain) . "</a>";
         }
     }
     if (is_user_wcmp_pending_vendor($user_object)) {
         $vendor = get_wcmp_vendor($user_object->ID);
         $actions['activate'] = "<a class='activate_vendor' data-id='" . $user_object->ID . "'href=#>" . __('Approve', $WCMp->text_domain) . "</a>";
         $actions['reject'] = "<a class='reject_vendor' data-id='" . $user_object->ID . "'href=#>" . __('Reject', $WCMp->text_domain) . "</a>";
     }
     if (is_user_wcmp_rejected_vendor($user_object)) {
         $vendor = get_wcmp_vendor($user_object->ID);
         $actions['activate'] = "<a class='activate_vendor' data-id='" . $user_object->ID . "'href=#>" . __('Approve', $WCMp->text_domain) . "</a>";
     }
     return $actions;
 }
Beispiel #2
0
 /**
  * Initialize plugin on WP init
  */
 function init()
 {
     if (is_user_wcmp_pending_vendor(get_current_user_id()) || is_user_wcmp_rejected_vendor(get_current_user_id()) || is_user_wcmp_vendor(get_current_user_id())) {
         show_admin_bar(false);
     }
     // Init Text Domain
     $this->load_plugin_textdomain();
     // Init library
     $this->load_class('library');
     $this->library = new WCMp_Library();
     // Init ajax
     if (defined('DOING_AJAX')) {
         $this->load_class('ajax');
         $this->ajax = new WCMp_Ajax();
     }
     // Init main admin action class
     if (is_admin()) {
         $this->load_class('admin');
         $this->admin = new WCMp_Admin();
     }
     if (!is_admin() || defined('DOING_AJAX')) {
         // Init main frontend action class
         $this->load_class('frontend');
         $this->frontend = new WCMp_Frontend();
         // Init shortcode
         $this->load_class('shortcode');
         $this->shortcode = new WCMp_Shortcode();
         // Init templates
         $this->load_class('template');
         $this->template = new WCMp_Template();
         add_filter('template_include', array($this, 'template_loader'));
     }
     // Init Calculate commission class
     $this->load_class('calculate-commission');
     new WCMp_Calculate_Commission();
     // Init vendor action class
     $this->load_class('vendor-details');
     // Init product vendor taxonomies
     $this->init_taxonomy();
     // Init product action class
     $this->load_class('product');
     $this->product = new WCMp_Product();
     // Init email activity action class
     $this->load_class('email');
     $this->email = new WCMp_Email();
     // WCMp Fields Lib
     $this->wcmp_wp_fields = $this->library->load_wp_fields();
     // Init custom capabilities
     $this->init_custom_capabilities();
     // Init user roles
     $this->init_user_roles();
     // Init product vendor custom post types
     $this->init_custom_post();
     // Init custom reports
     $this->init_custom_reports();
     // Init paypal masspay
     $this->init_paypal_masspay();
     // Init vendor dashboard
     $this->init_vendor_dashboard();
     // Init vendor coupon
     $this->init_vendor_coupon();
     // WCMp plugins loaded
     $this->wcmp_plugins_loaded();
     do_action('wcmp_init');
 }