Ejemplo n.º 1
0
 protected function get_user_info($user_id = false)
 {
     $data = awpcp_users_collection()->find_by_id($user_id);
     $translations = array('first_name' => 'first_name', 'last_name' => 'last_name', 'email' => 'email', 'city' => 'city', 'address_1' => 'address');
     foreach ($translations as $field => $key) {
         $info[$field] = awpcp_get_property($data, $key);
     }
     return $info;
 }
Ejemplo n.º 2
0
 /**
  * @since 3.3
  */
 private function overwrite_sender_information($posted_data)
 {
     $user_information = awpcp_users_collection()->find_by_id(get_current_user_id());
     if (isset($user_information->display_name) && !empty($user_information->display_name)) {
         $posted_data['awpcp_sender_name'] = $user_information->display_name;
     } else {
         if (isset($user_information->user_login) && !empty($user_information->user_login)) {
             $posted_data['awpcp_sender_name'] = $user_information->user_login;
         } else {
             if (isset($user_information->username) && !empty($user_information->username)) {
                 $posted_data['awpcp_sender_name'] = $user_information->username;
             }
         }
     }
     $posted_data['awpcp_sender_email'] = $user_information->user_email;
     return $posted_data;
 }
Ejemplo n.º 3
0
 protected function get_user_info($user_id = false)
 {
     $user_id = $user_id === false ? get_current_user_id() : $user_id;
     $data = awpcp_users_collection()->find_by_id($user_id);
     $translations = array('ad_contact_name' => array('display_name', 'user_login', 'username'), 'ad_contact_email' => 'user_email', 'ad_contact_phone' => 'phone', 'websiteurl' => 'user_url', 'ad_country' => 'country', 'ad_state' => 'state', 'ad_city' => 'city', 'ad_county_village' => 'county');
     $info = array();
     foreach ($translations as $field => $keys) {
         if (!empty($info[$field])) {
             continue;
         }
         $value = awpcp_get_object_property_from_alternatives($data, $keys);
         if (!empty($value)) {
             $info[$field] = $value;
         }
     }
     if (empty($info['ad_contact_name'])) {
         $info['ad_contact_name'] = trim($data->first_name . " " . $data->last_name);
     }
     $info['regions'][] = array_filter(array('country' => awpcp_array_data('ad_country', '', $info), 'state' => awpcp_array_data('ad_state', '', $info), 'city' => awpcp_array_data('ad_city', '', $info), 'county' => awpcp_array_data('ad_county_village', '', $info)), 'strlen');
     $info = apply_filters('awpcp-listing-details-user-info', $info, $user_id);
     return $info;
 }
Ejemplo n.º 4
0
function awpcp_users_autocomplete()
{
    return new AWPCP_UsersAutocomplete(awpcp_users_collection(), awpcp_request(), awpcp()->js);
}
function awpcp_users_autocomplete_ajax_handler()
{
    return new AWPCP_UsersAutocompleteAjaxHandler(awpcp_users_collection(), awpcp_request(), awpcp_ajax_response());
}
Ejemplo n.º 6
0
function awpcp_users_dropdown()
{
    return new AWPCP_UsersDropdown(awpcp_users_collection(), awpcp_request());
}