function get_role_nice($user) { $user_roles = $user->roles; if (isset($user_roles) && is_array($user_roles)) { $user_role = array_shift($user_roles); return userpro_user_role($user_role); } return ''; }
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; }
function userpro_rd_list_redirects($type) { global $userpro; $res = ''; //delete_option('userpro_redirects_'.$type); $redirects = get_option('userpro_redirects_' . $type); $res .= "<thead>\r\n\t\t<tr>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Username', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Role', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Custom Field', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Field Value', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Redirection URL', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Remove', 'userpro') . "</th>\r\n\t\t</tr>\r\n\t\t</thead>"; $res .= "<tfoot>\r\n\t\t<tr>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Username', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Role', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Custom Field', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Field Value', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Redirection URL', 'userpro') . "</th>\r\n\t\t\t<th scope='col' class='manage-column'>" . __('Remove', 'userpro') . "</th>\r\n\t\t</tr>\r\n\t\t</tfoot>"; if (is_array($redirects)) { $redirects = array_reverse($redirects, true); foreach ($redirects as $k => $info) { $user = get_userdata($info['user']); if ($user->ID) { $info['user'] = '******' . $userpro->permalink($info['user']) . '">' . $user->user_login . '</a>'; } $res .= '<tr valign="top">'; $res .= '<td>' . $info['user'] . '</td>'; $res .= '<td>' . userpro_user_role($info['role']) . '</td>'; $res .= '<td>' . $userpro->field_label($info['field']) . '</td>'; $res .= '<td>' . $info['field_value'] . '</td>'; $res .= '<td>' . $info['url'] . '</td>'; $res .= '<td><a href="#" class="remove-redirect-rule" data-k="' . $k . '">' . __('Remove Rule', 'userpro') . '</a></td>'; $res .= '</tr>'; } } return $res; }