示例#1
0
 /**
  * Update a customer record
  *
  * @since  1.0
  * @access public
  *
  * @param  array $data Array of data attributes for a customer (checked via whitelist).
  *
  * @return bool        If the update was successful or not.
  */
 public function update($data = array())
 {
     if (empty($data)) {
         return false;
     }
     $data = $this->sanitize_columns($data);
     do_action('give_customer_pre_update', $this->id, $data);
     $updated = false;
     if ($this->db->update($this->id, $data)) {
         $customer = $this->db->get_customer_by('id', $this->id);
         $this->setup_customer($customer);
         $updated = true;
     }
     do_action('give_customer_post_update', $updated, $this->id, $data);
     return $updated;
 }