Exemple #1
0
 /**
  * Get the user info as an array
  *
  * @return array
  */
 public function to_array()
 {
     $fields = array('id' => 0, 'user_id' => '', 'first_name' => '', 'last_name' => '', 'company' => '', 'avatar' => array('id' => 0, 'url' => ''), 'life_stage' => '', 'email' => '', 'phone' => '', 'mobile' => '', 'website' => '', 'fax' => '', 'street_1' => '', 'street_2' => '', 'city' => '', 'country' => '', 'state' => '', 'postal_code' => '', 'type' => '', 'notes' => '', 'other' => '', 'social' => []);
     $social_field = erp_crm_get_social_field();
     foreach ($social_field as $social_key => $social_value) {
         $fields['social'][$social_key] = '';
     }
     if ($this->id) {
         foreach ($this->data as $key => $value) {
             $fields[$key] = $value;
         }
         $avatar_id = (int) $this->get_meta('photo_id', true);
         $fields['avatar']['id'] = $avatar_id;
         if ($avatar_id) {
             $fields['avatar']['url'] = wp_get_attachment_url($avatar_id);
         }
         foreach ($fields['social'] as $key => $value) {
             $fields['social'][$key] = $this->get_meta($key, true);
         }
         $fields['life_stage'] = $this->get_meta('life_stage', true);
     }
     return apply_filters('erp_crm_get_ ' . $this->contact_type . '_fields', $fields, $this->data, $this->id);
 }
Exemple #2
0
<?php

$social_field = erp_crm_get_social_field();
?>
<div class="customer-social-wrap">
    <?php 
foreach ($social_field as $social_key => $social_value) {
    ?>
        <div class="row">
            <?php 
    erp_html_form_input(array('label' => $social_value['title'], 'name' => $social_key, 'value' => "{{{ data.social_field.{$social_key} }}}", 'id' => 'erp-customer-social' . $social_key, 'class' => 'erp-customer-social' . $social_key));
    ?>
        </div>
    <?php 
}
?>

    <input type="hidden" name="customer_id" id="erp-customer-id" value="{{ data.customer_id }}">
    <input type="hidden" name="action" id="erp-customer-social" value="erp-crm-customer-social">
    <?php 
wp_nonce_field('wp-erp-crm-customer-social-nonce');
?>
</div>