Exemplo n.º 1
0
 /**
  * Set customer social profile info
  *
  * @since 1.0
  *
  * @return void
  */
 public function customer_social_profile()
 {
     $this->verify_nonce('wp-erp-crm-customer-social-nonce');
     // @TODO: check permission
     unset($_POST['_wp_http_referer']);
     unset($_POST['_wpnonce']);
     unset($_POST['action']);
     if (!$_POST['customer_id']) {
         $this->send_error(__('No customer found', 'wp-erp'));
     }
     $customer_id = (int) $_POST['customer_id'];
     unset($_POST['customer_id']);
     $customer = new \WeDevs\ERP\CRM\Contact($customer_id);
     $customer->update_meta('crm_social_profile', $_POST);
     $this->send_success(__('Succesfully added social profiles', 'wp-erp'));
 }