Exemplo n.º 1
0
function userpro_profile_icons($args, $user_id, $wrapper = null)
{
    global $userpro;
    $res = null;
    foreach (userpro_fields_group_by_template('social', $args["social_group"]) as $key => $array) {
        $icon = $userpro->field_icon($key);
        if (userpro_profile_data($key, $user_id) && userpro_field_is_viewable($key, $user_id, $args) && $icon) {
            $res .= '<a href="' . userpro_link_filter(userpro_profile_data($key, $user_id), $key) . '" class="userpro-profile-icon userpro-tip" title="' . $array['label'] . '" target="' . $args['social_target'] . '" ><i class="userpro-icon-' . $icon . '"></i></a>';
        }
    }
    if ($res) {
        if ($wrapper) {
            echo '<div class="' . $wrapper . '">';
        }
        echo $res;
        if ($wrapper) {
            echo '</div>';
        }
    }
}
Exemplo n.º 2
0
function userpro_show_field($key, $array, $i, $args, $user_id = null)
{
    global $userpro;
    extract($array);
    extract($args);
    $res = null;
    /**
    		include & exclude
    		done by custom shortcode
    		params 
    		start here 
    		**/
    if (isset($args['exclude_fields']) && $args['exclude_fields'] != '') {
        if (in_array($key, explode(',', $args['exclude_fields']))) {
            $res = '';
            return false;
        }
    }
    if (isset($args['exclude_fields_by_name']) && $args['exclude_fields_by_name'] != '') {
        if (in_array($array['label'], explode(',', $args['exclude_fields_by_name']))) {
            $res = '';
            return false;
        }
    }
    if (isset($args['exclude_fields_by_type']) && $args['exclude_fields_by_type'] != '') {
        if (isset($array['type']) && in_array($array['type'], explode(',', $args['exclude_fields_by_type']))) {
            $res = '';
            return false;
        }
    }
    if (isset($args['include_fields']) && $args['include_fields'] != '') {
        if (!in_array($key, explode(',', $args['include_fields']))) {
            $res = '';
            return false;
        }
    }
    if (isset($args['include_fields_by_name']) && $args['include_fields_by_name'] != '') {
        if (!in_array($array['label'], explode(',', $args['include_fields_by_name']))) {
            $res = '';
            return false;
        }
    }
    if (isset($args['include_fields_by_type']) && $args['include_fields_by_type'] != '') {
        if (isset($array['type']) && !in_array($array['type'], explode(',', $args['include_fields_by_type'])) || !isset($array['type'])) {
            $res = '';
            return false;
        }
    }
    /**
    		end here
    		thanks please do not edit 
    		here unless you know what you do
    		**/
    if ($user_id) {
        $value = userpro_profile_data($key, $user_id);
        if (isset($array['type']) && $key != 'role' && in_array($array['type'], array('select', 'multiselect', 'checkbox', 'checkbox-full', 'radio', 'radio-full'))) {
            $value = userpro_profile_data_nicename($key, userpro_profile_data($key, $user_id));
        }
        if (isset($array['html']) && $array['html'] == 0) {
            $value = userpro_profile_nohtml($value);
        }
        if (isset($array['type']) && $array['type'] == 'picture') {
            if ($key == 'profilepicture') {
                $value = get_avatar($user_id, 64);
            } else {
                $crop = userpro_profile_data($key, $user_id);
                if ($crop) {
                    if (isset($array['width'])) {
                        $width = $array['width'];
                        $height = $array['height'];
                    } else {
                        $width = '';
                        $height = '';
                    }
                    $value = '<img src="' . $crop . '" width="' . $width . '" height="' . $height . '" alt="" class="modified" />';
                }
            }
        }
        if (isset($array['type']) && $array['type'] == 'file') {
            $file = userpro_profile_data($key, $user_id);
            if ($file) {
                $value = '<div class="userpro-file-input"><a href="' . $file . '" ' . userpro_file_type_icon($file) . '>' . basename($file) . '</a></div>';
            }
        }
    }
    /* display a section */
    if ($allow_sections && isset($array['heading'])) {
        $res .= "<div class='userpro-section userpro-column userpro-collapsible-" . $array['collapsible'] . " userpro-collapsed-" . $array['collapsed'] . "'>" . $array['heading'] . "</div>";
    }
    /* display a field */
    if (!$user_id) {
        $user_id = 0;
    }
    if (isset($array['type']) && userpro_field_by_role($key, $user_id) && !empty($value) && userpro_field_is_viewable($key, $user_id, $args) && !in_array($key, $userpro->fields_to_hide_from_view()) && $array['type'] != 'mailchimp' && $array['type'] != 'followers') {
        $res .= "<div class='userpro-field userpro-field-" . $key . " " . userpro_private_field_class($array) . " userpro-field-{$template}' data-key='{$key}'>";
        if ($array['label'] && $array['type'] != 'passwordstrength') {
            if ($args['field_icons'] == 1) {
                $res .= "<div class='userpro-label view iconed'>";
            } else {
                $res .= "<div class='userpro-label view'>";
            }
            $res .= "<label for='{$key}-{$i}'>" . $array['label'] . "</label>";
            if ($args['field_icons'] == 1 && $userpro->field_icon($key)) {
                $res .= '<span class="userpro-field-icon"><i class="userpro-icon-' . $userpro->field_icon($key) . '"></i></span>';
            }
            $res .= "</div>";
        }
        $res .= "<div class='userpro-input'>";
        //***
        /* Before custom field is displayed!
         */
        /**/
        $value = apply_filters('userpro_before_value_is_displayed', $value, $key, $array, $user_id);
        /* SHOW VALUE */
        $countrylist = get_option('userpro_fields');
        $country = $countrylist['billing_country']['options'];
        if ($key == 'role') {
            $res .= userpro_user_role($value);
        } elseif ($key == 'billing_country') {
            foreach ($country as $country_code => $country_name) {
                if ($country_name == $value) {
                    $res .= $value;
                }
                if ($country_code == $value) {
                    $value = $country_name;
                    $res .= $value;
                }
            }
        } elseif ($key == 'shipping_country') {
            foreach ($country as $country_code => $country_name) {
                if ($country_name == $value) {
                    $res .= $value;
                }
                if ($country_code == $value) {
                    $value = $country_name;
                    $res .= $value;
                }
            }
        } else {
            $res .= $value;
        }
        /* hidden field notice */
        if (userpro_field_is_viewable($key, $user_id, $args) && (userpro_profile_data('hide_' . $key, $user_id) || userpro_field_default_hidden($key, $template, $args[$template . '_group']))) {
            $res .= '<div class="userpro-help">' . sprintf(__('(Your %s will not be visible to public)', 'userpro'), strtolower($array['label'])) . '</div>';
        }
        $res .= "<div class='userpro-clear'></div>";
        $res .= "</div>";
        $res .= "</div><div class='userpro-clear'></div>";
    }
    return $res;
}
Exemplo n.º 3
0
 function parse_column($col, $user_id, $user, $args)
 {
     global $userpro_msg;
     $output = null;
     $show_on_mobile = array('');
     if (isset($args['show_on_mobile'])) {
         $show_on_mobile = explode(',', $args['show_on_mobile']);
     }
     switch ($col) {
         case 'user_id':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="small ' . $col . ' ' . $mobile . '">' . $user_id . '</td>';
             break;
         case 'picture':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="thumb ' . $col . ' ' . $mobile . '"><div class="userpro-table-img"><a href="' . $this->permalink($user_id) . '">' . get_avatar($user_id, 36) . '</a></div></td>';
             break;
         case 'name':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="name ' . $col . ' ' . $mobile . '"><a href="' . $this->permalink($user_id) . '">' . userpro_profile_data('user_login', $user_id) . '</a> ';
             if (userpro_is_verified($user_id)) {
                 $output .= userpro_get_badge('verified');
             }
             $output .= '<br /><span class="nickname">(' . userpro_profile_data('display_name', $user_id) . ')</span></td>';
             break;
         case 'country':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . userpro_get_badge('country_big', $user_id) . '</td>';
             break;
         case 'gender':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . $this->cap_gender($user_id) . '</td>';
             break;
         case 'role':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . $this->get_role_nice($user) . '</td>';
             break;
         case 'email_user':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">';
             if (userpro_field_is_viewable('user_email', $user_id, $args)) {
                 $output .= '<a href="mailto:' . userpro_profile_data('user_email', $user_id) . '" class="userpro-flat-btn"><i class="userpro-icon-envelope"></i><span>' . __('Contact', 'userpro') . '</span></a>';
             }
             $output .= '</td>';
             break;
         case 'message_user':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             if (class_exists('userpro_msg_api')) {
                 if ($userpro_msg->can_chat_with($user_id)) {
                     $output .= '<td class="' . $col . ' ' . $mobile . '"><a href="#" class="userpro-flat-btn chat userpro-init-chat" data-chat_with="' . $user_id . '" data-chat_from="' . get_current_user_id() . '"><i class="userpro-icon-comment"></i><span>' . __('Send Message', 'userpro-msg') . '</span>';
                     $output .= '</a></td>';
                 }
             }
             break;
         default:
             $value = get_user_meta($user_id, $col, true);
             if (is_array($value)) {
                 $value = implode(',', $value);
             }
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . $value . '</td>';
             break;
     }
     return $output;
 }