public function __construct($wpUser) { $this->id = $wpUser->ID; if (function_exists('get_wp_user_avatar_src')) { if (strlen(get_wp_user_avatar_src($this->id, 'original')) > 0) { $this->image = get_wp_user_avatar_src($this->id, 'original'); } } if (!strlen($this->image) > 0) { $this->image = 'http://grafikk.ukm.no/placeholder/person.jpg'; } $this->company_name = get_the_author_meta('title', $this->id); $this->login = $wpUser->user_login; $this->nicename = $wpUser->nicename; $this->user_email = $wpUser->user_email; $this->url = $wpUser->url; $this->registered = $wpUser->registered; $this->display_name = $wpUser->display_name; $this->firstname = $wpUser->firstname; $this->lastname = $wpUser->lastname; $this->nickname = $wpUser->nickname; $this->description = $wpUser->description; $this->facebook_url = get_the_author_meta('facebook', $this->id); $this->title = get_the_author_meta('Title', $this->id); $this->link = get_author_posts_url($this->id, $this->nicename); }
if ($post_type == "Task") { $post_cat = get_the_category(); } elseif ($post_type == "News") { $post_cat = get_the_terms($post->ID, 'news-type'); } elseif ($post_type == "Event") { $post_cat = get_the_terms($post->ID, 'event-type'); } $title_context = ''; $context = ''; $icon = ''; $image_url = get_the_post_thumbnail($id, 'thumbnail', array('class' => 'alignright')); if ($post_type == 'User') { global $foundstaff; $foundstaff++; if (function_exists('get_wp_user_avatar_src')) { $image_url_src = get_wp_user_avatar_src($post->user_id, 'thumbnail'); $image_url = "<img src=" . $image_url_src . " width='96' height='96' alt='" . $post->title . "' class='img"; $directorystyle = get_option('options_staff_directory_style'); // 0 = squares, 1 = circles if ($directorystyle == 1) { $image_url .= ' img-circle'; } $image_url .= " alignleft' />"; } else { $image_url = get_avatar($post->user_id, 96); } $userurl = get_author_posts_url($post->user_id); $gis = "options_forum_support"; $forumsupport = get_option($gis); if (function_exists('bp_activity_screen_index')) { // if using BuddyPress - link to the members page
<h1 class="page-title">About: <?php echo $curauth->nickname . ' ' . $curauth->last_name; ?> </h1> </figcaption> </figure> <div class="wrap"> <div class="userinfo"> <?php if (get_wp_user_avatar_src() !== '') { ?> <figure> <img src="/wp-includes/images/blank.gif" style="background-image:url(<?php echo get_wp_user_avatar_src(); ?> )"> </figure> <?php } ?> <div class="profile"> <?php if ($curauth->user_description !== '') { ?> <h2>Über</h2> <p><?php echo $curauth->user_description; ?>
function ht_people_shortcode($atts) { //get any attributes that may have been passed; override defaults $opts = shortcode_atts(array('id' => '', 'team' => ''), $atts); $userid = $opts['id']; $directorystyle = get_option('options_staff_directory_style'); // 0 = squares, 1 = circles $showmobile = get_option('options_show_mobile_on_staff_cards'); // 1 = show $fulldetails = get_option('options_full_detail_staff_cards'); $context = get_user_meta($userid, 'user_job_title', true); if ($context == '') { $context = "staff"; } $icon = "user"; $user_info = get_userdata($userid); $userurl = site_url() . '/staff/' . $user_info->user_nicename; $displayname = get_user_meta($userid, 'first_name', true) . " " . get_user_meta($userid, 'last_name', true); if (function_exists('get_wp_user_avatar_src')) { $image_url_src = get_wp_user_avatar_src($userid, 'thumbnail'); $avatarhtml = "<img src=" . $image_url_src . " width='66' height='66' alt='" . $user_info->display_name . "' class='img"; if ($directorystyle == 1) { $avatarhtml .= ' img-circle'; } $avatarhtml .= " alignleft' />"; } else { $avatarhtml = get_avatar($post->user_id, 66); $avatarhtml = str_replace("photo", "photo alignleft", $avatarhtml); } $html = ''; $counter = 0; $tcounter = 0; if ($fulldetails) { $html .= "<div class='col-lg-6 col-md-6 col-sm-6'><div class='media well well-sm'><a href='" . site_url() . "/staff/" . $user_info->user_nicename . "/'>" . $avatarhtml . "</a><div class='media-body'><p><a href='" . site_url() . "/staff/" . $user_info->user_nicename . "/'><strong>" . $displayname . "</strong></a><br>"; // display team name(s) if (get_user_meta($userid, 'user_job_title', true)) { $html .= get_user_meta($userid, 'user_job_title', true) . "<br>"; } if (get_user_meta($userid, 'user_telephone', true)) { $html .= '<i class="dashicons dashicons-phone"></i> <a href="tel:' . str_replace(" ", "", get_user_meta($userid, "user_telephone", true)) . '">' . get_user_meta($userid, 'user_telephone', true) . "</a><br>"; } if (get_user_meta($userid, 'user_mobile', true) && $showmobile) { $html .= '<i class="dashicons dashicons-smartphone"></i> <a href="tel:' . str_replace(" ", "", get_user_meta($userid, "user_mobile", true)) . '">' . get_user_meta($userid, 'user_mobile', true) . "</a><br>"; } $html .= '<a href="mailto:' . $user_info->user_email . '">' . __("Email", "govintranet") . ' ' . $user_info->first_name . '</a></p></div></div></div>'; $counter++; $tcounter++; //end full details } else { $html .= "<div class='col-lg-6 col-md-6 col-sm-12'><div class='indexcard'><a href='" . site_url() . "/staff/" . $user_info->user_nicename . "/'><div class='media'>" . $avatarhtml . "<div class='media-body'><strong>" . $displayname . "</strong><br>"; if (get_user_meta($userid, 'user_job_title', true)) { $html .= '<span class="small">' . get_user_meta($userid, 'user_job_title', true) . "</span><br>"; } if (get_user_meta($userid, 'user_telephone', true)) { $html .= '<span class="small"><i class="dashicons dashicons-phone"></i> ' . get_user_meta($userid, 'user_telephone', true) . "</span><br>"; } if (get_user_meta($userid, 'user_mobile', true) && $showmobile) { $html .= '<span class="small"><i class="dashicons dashicons-smartphone"></i> ' . get_user_meta($userid, 'user_mobile', true) . "</span>"; } $html .= "</div></div></div></div></a>"; $counter++; } return "<div id='peoplenav'>" . $html . "</div>"; }
/** * Add to edit user profile * @since 1.4 * @param object $user * @uses int $blog_id * @uses object $current_user * @uses bool $show_avatars * @uses object $wpdb * @uses object $wp_user_avatar * @uses bool $wpua_allow_upload * @uses bool $wpua_edit_avatar * @uses object $wpua_functions * @uses string $wpua_upload_size_limit_with_units * @uses add_query_arg() * @uses admin_url() * @uses do_action() * @uses get_blog_prefix() * @uses get_user_meta() * @uses get_wp_user_avatar_src() * @uses has_wp_user_avatar() * @uses is_admin() * @uses wpua_author() * @uses wpua_get_avatar_original() * @uses wpua_is_author_or_above() */ public static function wpua_action_show_user_profile($user) { global $blog_id, $current_user, $show_avatars, $wpdb, $wp_user_avatar, $wpua_allow_upload, $wpua_edit_avatar, $wpua_functions, $wpua_upload_size_limit_with_units; // Get WPUA attachment ID $wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true); // Show remove button if WPUA is set $hide_remove = !has_wp_user_avatar($user->ID) ? 'wpua-hide' : ""; // Hide image tags if show avatars is off $hide_images = !has_wp_user_avatar($user->ID) && (bool) $show_avatars == 0 ? 'wpua-no-avatars' : ""; // If avatars are enabled, get original avatar image or show blank $avatar_medium_src = (bool) $show_avatars == 1 ? $wpua_functions->wpua_get_avatar_original($user->user_email, 'medium') : includes_url() . 'images/blank.gif'; // Check if user has wp_user_avatar, if not show image from above $avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src; // Check if user has wp_user_avatar, if not show image from above $avatar_thumbnail = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 96) : $avatar_medium_src; $edit_attachment_link = add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')); // Chck if admin page $is_admin = is_admin() ? '_admin' : ""; ?> <?php do_action('wpua_before_avatar' . $is_admin); ?> <input type="hidden" name="wp-user-avatar" id="<?php echo $user == 'add-new-user' ? 'wp-user-avatar' : 'wp-user-avatar-existing'; ?> " value="<?php echo $wpua; ?> " /> <?php if ($wp_user_avatar->wpua_is_author_or_above()) { // Button to launch Media Uploader ?> <p id="<?php echo $user == 'add-new-user' ? 'wpua-add-button' : 'wpua-add-button-existing'; ?> "><button type="button" class="button" id="<?php echo $user == 'add-new-user' ? 'wpua-add' : 'wpua-add-existing'; ?> " name="<?php echo $user == 'add-new-user' ? 'wpua-add' : 'wpua-add-existing'; ?> " data-title="<?php _e('Choose Image'); ?> : <?php echo $user->display_name; ?> "><?php _e('Choose Image'); ?> </button></p> <?php } elseif (!$wp_user_avatar->wpua_is_author_or_above()) { // Upload button ?> <p id="<?php echo $user == 'add-new-user' ? 'wpua-upload-button' : 'wpua-upload-button-existing'; ?> "> <input name="wpua-file" id="<?php echo $user == 'add-new-user' ? 'wpua-file' : 'wpua-file-existing'; ?> " type="file" /> <button type="submit" class="button" id="<?php echo $user == 'add-new-user' ? 'wpua-upload' : 'wpua-upload-existing'; ?> " name="submit" value="<?php _e('Upload'); ?> "><?php _e('Upload'); ?> </button> </p> <p id="<?php echo $user == 'add-new-user' ? 'wpua-upload-messages' : 'wpua-upload-messages-existing'; ?> "> <span id="<?php echo $user == 'add-new-user' ? 'wpua-max-upload' : 'wpua-max-upload-existing'; ?> " class="description"><?php printf(__('Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units), esc_html('KB')); ?> </span> <span id="<?php echo $user == 'add-new-user' ? 'wpua-allowed-files' : 'wpua-allowed-files-existing'; ?> " class="description"><?php _e('Allowed Files'); ?> : <?php _e('<code>jpg jpeg png gif</code>'); ?> </span> </p> <?php } ?> <div id="<?php echo $user == 'add-new-user' ? 'wpua-images' : 'wpua-images-existing'; ?> " class="<?php echo $hide_images; ?> "> <p id="<?php echo $user == 'add-new-user' ? 'wpua-preview' : 'wpua-preview-existing'; ?> "> <img src="<?php echo $avatar_medium; ?> " alt="" /> <span class="description"><?php _e('Original Size'); ?> </span> </p> <p id="<?php echo $user == 'add-new-user' ? 'wpua-thumbnail' : 'wpua-thumbnail-existing'; ?> "> <img src="<?php echo $avatar_thumbnail; ?> " alt="" /> <span class="description"><?php _e('Thumbnail'); ?> </span> </p> <p id="<?php echo $user == 'add-new-user' ? 'wpua-remove-button' : 'wpua-remove-button-existing'; ?> " class="<?php echo $hide_remove; ?> "> <button type="button" class="button" id="<?php echo $user == 'add-new-user' ? 'wpua-remove' : 'wpua-remove-existing'; ?> " name="wpua-remove"><?php _e('Remove Image'); ?> </button> <?php if ((bool) $wpua_edit_avatar == 1 && !$wp_user_avatar->wpua_is_author_or_above() && has_wp_user_avatar($current_user->ID) && $wp_user_avatar->wpua_author($wpua, $current_user->ID)) { // Edit button ?> <span id="<?php echo $user == 'add-new-user' ? 'wpua-edit-attachment' : 'wpua-edit-attachment-existing'; ?> "><a href="<?php echo $edit_attachment_link; ?> " class="edit-attachment" target="_blank"><?php _e('Edit Image'); ?> </a></span> <?php } ?> </p> <p id="<?php echo $user == 'add-new-user' ? 'wpua-undo-button' : 'wpua-undo-button-existing'; ?> "><button type="button" class="button" id="<?php echo $user == 'add-new-user' ? 'wpua-undo' : 'wpua-undo-existing'; ?> " name="wpua-undo"><?php _e('Undo'); ?> </button></p> </div> <?php do_action('wpua_after_avatar' . $is_admin); ?> <?php }
/** * Add to edit user profile * @since 1.4 * @param object/string $user * @uses bool $show_avatars * @uses object $wpua_functions * @uses do_action() * @uses get_wp_user_avatar_src() * @uses has_wp_user_avatar() * @uses is_admin() * @uses wpua_get_avatar_original() * @uses array maybe_unserialize() * @uses get_option() * @uses bool array_key_exists() */ public static function wpua_action_show_user_profile($user) { global $blog_id, $current_user, $show_avatars, $wpdb, $wp_user_avatar, $wpua_allow_upload, $wpua_edit_avatar, $wpua_functions, $wpua_upload_size_limit_with_units; // Get WPUA $user_id = ''; if (is_object($user)) { $user_id = $user->ID; } else { if (absint($user)) { $user_id = $user; } } $wpua = get_user_meta($user_id, $wpdb->get_blog_prefix(wpua_get_main_blog_id()) . 'user_avatar', true); if (isset($user->user_email)) { $default_avatar = $wpua_functions->get_wpua_default_avatar($user->user_email, 'medium'); } else { $default_avatar = $wpua_functions->get_wpua_default_avatar('', 'medium'); } // Check if user has wp_user_avatar, if not show image from above $avatar_medium_src = has_wp_user_avatar($user_id) ? get_wp_user_avatar_src($user_id, 'medium') : $default_avatar; // Check if user has wp_user_avatar, if not show image from above $avatar_thumbnail = has_wp_user_avatar($user_id) ? get_wp_user_avatar_src($user_id, 96) : $avatar_medium_src; // Chck if admin page $is_admin = is_admin() ? '_admin' : ''; ?> <?php do_action('wpua_before_avatar' . $is_admin); ?> <?php wp_nonce_field('no_action', 'wpua_avatar'); ?> <input type="hidden" name="default_avatar" id="default_avatar" value="<?php echo $default_avatar; ?> " /> <input type="hidden" name="wp_user_avatar_url" id="<?php echo $user == 'add-existing-user' ? 'wp-user-avatar-url-existing' : 'wp-user-avatar-url'; ?> " value="" /> <input type="hidden" name="wp-user-avatar" id="<?php echo $user == 'add-existing-user' ? 'wp-user-avatar-existing' : 'wp-user-avatar'; ?> " value="<?php echo $avatar_thumbnail; ?> " /> <div id="<?php echo $user == 'add-existing-user' ? 'wpua-add-button-existing' : 'wpua-add-button'; ?> " class="avatar-container"> <?php // Imagepicker changes starts ?> <img src="<?php echo $avatar_thumbnail; ?> " alt="" id="<?php echo $user == 'add-existing-user' ? 'wp-user-avatar-img-existing' : 'wp-user-avatar-img'; ?> " class="choose_image" /> <?php if (has_wp_user_avatar($user_id)) { ?> <br><input type="button" name="btn_remove" value="<?php _e('Delete', 'wp-user-avatar-pro'); ?> " id="delete_avatar" class="button-secondary" data-nonce="<?php echo wp_create_nonce('wpua_avatar_delete'); ?> "> <br><input type="button" name="btn_reset" value="<?php _e('Reset', 'wp-user-avatar-pro'); ?> " id="reset_avatar" class="button-secondary" style="display:none;"> <?php } ?> </div> <br> <?php do_action('wpua_after_avatar' . $is_admin); ?> <?php }
/** * GET USER PROFILE IMAGE ***********************************/ function wpdc_the_profile_photo($usuario) { if (is_object($usuario) && is_numeric($usuario->ID)) { $user_id = $usuario->ID; } elseif (is_numeric($usuario)) { $user_id = $usuario; } $user = get_userdata($user_id); if (function_exists('get_wp_user_avatar_src') && get_wp_user_avatar_src($user_id, 100, 'medium') != '') { $user_photo = get_wp_user_avatar_src($user_id, 100, 'medium'); } elseif ($user->userphoto_image_file != '') { $user_photo = get_bloginfo('url') . '/wp-content/uploads/userphoto/' . $user->userphoto_image_file; } else { $user_photo = get_stylesheet_directory_uri() . '/img/default/nophoto.png'; } echo '<div class="wrap wrap--photo" title="' . wpdc_get_user_name($user_id) . '"><img src="' . $user_photo . '"></div>'; }
$q = "select meta_value as ID, user_id, display_name from {$wpdb->users} join {$wpdb->usermeta} on {$wpdb->users}.ID = {$wpdb->usermeta}.user_id where {$wpdb->usermeta}.meta_key='user_line_manager' and {$wpdb->usermeta}.meta_value = " . $user_id; $poduserreports = $wpdb->get_results($q, ARRAY_A); if (count($poduserreports) > 0) { echo "<p><i class='dashicons dashicons-arrow-down-alt2'></i></p>"; echo "<p id='directreports'>"; foreach ($poduserreports as $p) { $pid = $p['user_id']; $u = get_userdata($pid); //print_r($u); $jobtitle = get_user_meta($pid, 'user_job_title', true); if ($jobtitle) { $jobtitle = " - " . $jobtitle; } $imgstyle = ''; if (function_exists('get_wp_user_avatar')) { $imgsrc = get_wp_user_avatar_src($pid, 'thumbnail', 'left'); $imgstyle .= " width='50' height='50'"; if ($directorystyle == 1) { $imgstyle .= " class='img img-circle'"; } else { $imgstyle .= " class='img'"; } echo "<a class='tlink' data-placement='right' data-original-title = '" . $u->user_nicename . "' title='" . $u->display_name . $jobtitle . "' href='" . site_url() . "/staff/" . $u->user_nicename . "'><img src='" . $imgsrc . "' " . $imgstyle . " alt='" . $u->display_name . "'/></a>"; } else { $imgsrc = get_avatar($user_id, 'thumbnail', '', $u->display_name); $imgsrc = str_replace('height=\'96\'', 'height="50"', $imgsrc); $imgsrc = str_replace('width=\'96\'', 'width="50"', $imgsrc); echo "<a title='" . $u->display_name . "' href='" . site_url() . "/staff/" . $u->user_nicename . "'>" . $imgsrc . "</a>"; } } echo "</p>";
?> /source/css/editor-style.css" /> <h1 style="text-align: center;font-weight: bold;display: block;font-size: 2em;font:normal 34px myrid, Arial, Helvetica, sans-serif; color: #d03423;">Instructor's Profile</h1> <ul> <style> .thumb-wrapper { position:relative; } </style> <?php $hturl = get_site_url() . "/wp-content/uploads/2013/play.png"; ?> <?php $src_img = get_wp_user_avatar_src($userid); //echo $userid; //echo $src_img; ?> <li class="list_item clearfix" style="color:#999999;"> <div class="content"> <div style="width:140px !important;float:left;padding:5px 20px 5px 5px;"> <?php /*?><img src="images/img_akash.png" style="margin:0 0 15px 17px;" /><?php */ //echo get_avatar( $userid, '128' ); $youtubeurl = get_user_meta($userid, 'jabber', true); ?> <?php if ($youtubeurl) { ?>
/* * QUOTEBOARD * Author Following * * Displays the members the current user is following * * This template is called from author.php and is only accessed when * the URL endpoint is 'following' */ $query = "SELECT * FROM wp_qb_followers WHERE follower_id = '{$current_page_user_id}'"; if ($followings = $wpdb->get_results($query)) { foreach ($followings as $following) { $following = get_user_by('id', $following->user_id); $following_url = home_url('/') . 'author/' . $following->user_nicename; // get user avatar, and specify a fallback if (!($following_avatar = get_wp_user_avatar_src($following->ID, 80))) { $following_avatar = DEFAULT_THUMBNAIL; } // count stats $quotecount = count_user_posts_by_type($following->ID, 'quote'); $boardcount = count_user_posts_by_type($following->ID, 'board'); // member background if ($background_id = get_user_meta($following->ID, 'user_background', true)) { $upload_directory = wp_upload_dir(); $background_src = $wpdb->get_var("SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = '" . $background_id . "' AND meta_key = '_wp_attached_file'"); $user_background = $upload_directory['baseurl'] . '/' . $background_src; } else { $user_background = DEFAULT_BACKGROUND; } // description if (strlen($following->description = get_user_meta($following->ID, 'description', true)) > 200) {
?> <?php if ($user_query->results > 100) { echo 'wrap--masonry__100'; } ?> "> <?php $cont = 0; $limit = 11; foreach ($user_query->results as $user) { if ($cont >= $limit) { continue; } $have_photo = false; if (function_exists('get_wp_user_avatar_src') && get_wp_user_avatar_src($user->ID, 100, 'medium') != '') { $have_photo = true; } elseif ($user->userphoto_image_file != '') { $have_photo = true; } if (!$have_photo) { continue; } wpdc_the_profile_photo($user); $cont++; } if (get_option('users_can_asociate')) { ?> <div class="wrap wrap--photo wrap--photo__upgrade" title=""> <a href="<?php echo site_url('upgrade');
</select> </div> </div> </div> <div class="wrap wrap--frame wrap--userlist"> <h4><?php echo sizeof(get_post_meta(get_the_ID(), 'members_pending', true)); ?> Socios con la cuota pendiente de validar</h4> <table> <?php foreach ($members_pending as $user_id => $time) { $user = get_userdata($user_id); $usermeta = get_user_meta($user_id); if (function_exists('get_wp_user_avatar_src') && get_wp_user_avatar_src($user_id, 100, 'medium') != '') { $user_photo = get_wp_user_avatar_src($user_id, 100, 'medium'); } elseif ($user->userphoto_image_file != '') { $user_photo = get_bloginfo('url') . '/wp-content/uploads/userphoto/' . $user->userphoto_image_file; } else { $user_photo = get_stylesheet_directory_uri() . '/img/default/nophoto.png'; } echo '<tr>'; echo '<td class="hideonmobile"><div class="wrap wrap--photo wrap--photo__mini" title="' . get_the_author_meta('first_name', $user_id) . ' ' . get_the_author_meta('last_name', $user_id) . '"><img src="' . $user_photo . '"></div><td>'; echo '<td><a href="' . get_author_posts_url($user_id) . '">' . get_the_author_meta('first_name', $user_id) . ' ' . get_the_author_meta('last_name', $user_id) . '</a></td>'; echo '<td>' . $time . '</td>'; echo '<td><input type="checkbox" class="hidden" id="checkbox-pen-' . $user_id . '" name="members_pendingdown[]" value="' . $user_id . '"><label for="checkbox-pen-' . $user_id . '">'; // the_svg_icon('close', 'icon--corner'); echo '</label></td>'; echo '<td><input type="checkbox" class="hidden" id="checkbox-topay-' . $user_id . '" name="members_validate[]" value="' . $user_id . '"><label for="checkbox-topay-' . $user_id . '">'; // the_svg_icon('check', 'icon--corner icon--corner__second'); echo '</label></td>';
</div> <span class="article-categories">Published in <?php the_category(', '); ?> </span><span class="article-top"><a href="#top" class="top" title="Go to the top of the page">↑ Back to top</a></span> </article><!-- end of article --> <div class="about about-box"> <h2 class="about-title">About the Author</h2> <div class="about-author"> <div class="about-author-bio"> <a class="about-author-avatar" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> "><img src="<?php echo get_wp_user_avatar_src(get_the_author_meta('ID')); ?> " width="80" height="80" alt="<?php echo the_author_meta('display_name'); ?> "></a> <p><span class="about-author-name"><a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> "><?php echo the_author_meta('display_name'); ?> </a></span><br><small><?php echo get_the_author_meta('description'); ?> </small></p>
function wpua_action_show_user_profile($user) { global $wpdb, $blog_id, $current_user, $show_avatars; // Get WPUA attachment ID $wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true); // Show remove button if WPUA is set $hide_notice = has_wp_user_avatar($user->ID) ? ' class="hide-me"' : ''; $hide_remove = !has_wp_user_avatar($user->ID) ? ' hide-me' : ''; // If avatars are enabled, get original avatar image or show blank $avatar_medium_src = $show_avatars == '1' && is_admin() ? wpua_get_avatar_original($user->user_email, 96) : includes_url() . 'images/blank.gif'; // Check if user has wp_user_avatar, if not show image from above $avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src; // Check if user has wp_user_avatar, if not show image from above $avatar_thumbnail = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 96) : $avatar_medium_src; // Change text on message based on current user $profile = $current_user->ID == $user->ID ? 'Profile' : 'User'; // Max upload size if (!function_exists('wp_max_upload_size')) { require_once ABSPATH . 'wp-admin/includes/template.php'; } $upload_size_unit = wp_max_upload_size(); $byte_sizes = array('KB', 'MB', 'GB'); for ($u = -1; $upload_size_unit > 1024 && $u < count($byte_sizes) - 1; $u++) { $upload_size_unit /= 1024; } if ($u < 0) { $upload_size_unit = 0; $u = 0; } else { $upload_size_unit = (int) $upload_size_unit; } ?> <?php if (class_exists('bbPress') && !is_admin()) { // Add to bbPress profile with same style ?> <h2 class="entry-title"><?php _e('WP User Avatar'); ?> </h2> <fieldset class="bbp-form"> <legend><?php _e('WP User Avatar'); ?> </legend> <?php } else { // Add to profile with admin style ?> <h3><?php _e('WP User Avatar'); ?> </h3> <table class="form-table"> <tr> <th><label for="wp_user_avatar"><?php _e('WP User Avatar'); ?> </label></th> <td> <?php } ?> <input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?> " /> <?php if (current_user_can('upload_files')) { // Button to launch Media uploader ?> <p><button type="button" class="button" id="add-wp-user-avatar" name="add-wp-user-avatar"><?php _e('Edit WP User Avatar'); ?> </button></p> <?php } elseif (!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) { // Upload button ?> <input name="wp-user-avatar-file" id="wp-user-avatar-file" type="file" /> <button type="submit" class="button" id="upload-wp-user-avatar" name="upload-wp-user-avatar" value="<?php _e('Upload'); ?> "><?php _e('Upload'); ?> </button> <?php if (isset($_GET['errors']) && $_GET['errors'] == 'type') { ?> <p id="wp-user-avatar-errors"><?php _e('File format is not allowed.'); ?> </p> <?php } ?> <?php $postdata = file_get_contents("php://input"); if (!empty($postdata['wp-user-avatar-file'])) { ?> <p id="wp-user-avatar-errors"><?php _e('File is too large.'); ?> </p> <?php } ?> <p> <?php _e('Maximum upload file size: ' . esc_html($upload_size_unit) . esc_html($byte_sizes[$u])); ?> <br /> <?php _e('Allowed file formats: JPG, GIF, PNG'); ?> </p> <?php } elseif (!current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) { // Edit button ?> <?php $edit_attachment_link = function_exists('wp_enqueue_media') ? add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')) : add_query_arg(array('attachment_id' => $wpua, 'action' => 'edit'), admin_url('media.php')); ?> <p><button type="button" class="button" id="edit-wp-user-avatar" name="edit-wp-user-avatar" onclick="window.open('<?php echo $edit_attachment_link; ?> ', '_self');"><?php _e('Edit WP User Avatar'); ?> </button></p> <?php } ?> <p id="wp-user-avatar-preview"> <img src="<?php echo $avatar_medium; ?> " alt="" /> <?php _e('Original'); ?> </p> <p id="wp-user-avatar-thumbnail"> <img src="<?php echo $avatar_thumbnail; ?> " alt="" /> <?php _e('Thumbnail'); ?> </p> <p><button type="button" class="button<?php echo $hide_remove; ?> " id="remove-wp-user-avatar" name="remove-wp-user-avatar"><?php _e('Remove'); ?> </button></p> <p id="wp-user-avatar-message"><?php _e('Press "Update ' . $profile . '" to save your changes.'); ?> </p> <?php if (class_exists('bbPress') && !is_admin()) { // Add to bbPress profile with same style ?> </fieldset> <?php } else { // Add to profile with admin style ?> </td> </tr> </table> <?php } ?> <?php echo wpua_js($user->display_name, $avatar_medium_src); // Add JS ?> <?php }
/** * Display shortcode * @since 1.4 * @param array $atts * @param string $content * @uses array $_wp_additional_image_sizes * @uses array $all_sizes * @uses int $blog_id * @uses object $post * @uses object $wpdb * @uses do_shortcode() * @uses get_attachment_link() * @uses get_blog_prefix() * @uses get_option() * @uses get_user_by() * @uses get_query_var() * @uses get_the_author_meta() * @uses get_user_meta() * @uses get_wp_user_avatar_src() * @uses get_wp_user_avatar() * @uses image_add_caption() * @uses is_author() * @uses shortcode_atts() * @return string */ public function wpua_shortcode($atts, $content = null) { global $all_sizes, $blog_id, $post, $wpdb; // Set shortcode attributes extract(shortcode_atts(array('user' => "", 'size' => '96', 'align' => "", 'link' => "", 'target' => ""), $atts)); // Find user by ID, login, slug, or e-mail address if (!empty($user)) { $user = is_numeric($user) ? get_user_by('id', $user) : get_user_by('login', $user); $user = empty($user) ? get_user_by('slug', $user) : $user; $user = empty($user) ? get_user_by('email', $user) : $user; } else { // Find author's name if id_or_email is empty $author_name = get_query_var('author_name'); if (is_author()) { // On author page, get user by page slug $user = get_user_by('slug', $author_name); } else { // On post, get user by author meta $user_id = get_the_author_meta('ID'); $user = get_user_by('id', $user_id); } } // Numeric sizes leave as-is $get_size = $size; // Check for custom image sizes if there are captions if (!empty($content)) { if (in_array($size, $all_sizes)) { if (in_array($size, array('original', 'large', 'medium', 'thumbnail'))) { $get_size = $size == 'original' ? get_option('large_size_w') : get_option($size . '_size_w'); } else { $get_size = $_wp_additional_image_sizes[$size]['width']; } } } // Get user ID $id_or_email = !empty($user) ? $user->ID : '*****@*****.**'; // Check if link is set if (!empty($link)) { // CSS class is same as link type, except for URL $link_class = $link; if ($link == 'file') { // Get image src $link = get_wp_user_avatar_src($id_or_email, 'original'); } elseif ($link == 'attachment') { // Get attachment URL $link = get_attachment_link(get_the_author_meta($wpdb->get_blog_prefix($blog_id) . 'user_avatar', $id_or_email)); } else { // URL $link_class = 'custom'; } // Open in new window $target_link = !empty($target) ? ' target="' . $target . '"' : ""; // Wrap the avatar inside the link $html = '<a href="' . $link . '" class="wp-user-avatar-link wp-user-avatar-' . $link_class . '"' . $target_link . '>' . get_wp_user_avatar($id_or_email, $get_size, $align) . '</a>'; } else { $html = get_wp_user_avatar($id_or_email, $get_size, $align); } // Check if caption is set if (!empty($content)) { // Get attachment ID $wpua = get_user_meta($id_or_email, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true); // Clean up caption $content = trim($content); $content = preg_replace('/\\r|\\n/', "", $content); $content = preg_replace('/<\\/p><p>/', "", $content, 1); $content = preg_replace('/<\\/p><p>$/', "", $content); $content = str_replace('</p><p>', "<br /><br />", $content); $avatar = do_shortcode(image_add_caption($html, $wpua, $content, $title = "", $align, $link, $get_size, $alt = "")); } else { $avatar = $html; } return $avatar; }
$alreadyshown[$u] = true; $userid = $u; if (isset($teamleaderid) && in_array($userid, $teamleaderid)) { continue; } //don't output if this person is the team head and already displayed $context = get_user_meta($userid, 'user_job_title', true); if ($context == '') { $context = "staff"; } $icon = "user"; $user_info = get_userdata($userid); $userurl = site_url() . '/staff/' . $user_info->user_nicename; $displayname = get_user_meta($userid, 'first_name', true) . " " . get_user_meta($userid, 'last_name', true); if (function_exists('get_wp_user_avatar_src')) { $image_url_src = get_wp_user_avatar_src($userid, 'thumbnail'); $avatarhtml = "<img src=" . $image_url_src . " width='66' height='66' alt='" . $user_info->display_name . "' class='img"; $directorystyle = get_option('options_staff_directory_style'); // 0 = squares, 1 = circles if ($directorystyle == 1) { $avatarhtml .= ' img-circle'; } $avatarhtml .= " alignleft' />"; } else { $avatarhtml = get_avatar($post->user_id, 66); $avatarhtml = str_replace("photo", "photo alignleft", $avatarhtml); } echo "<a href='" . site_url() . "/staff/" . $user_info->user_nicename . "/'><div class='media'>" . $avatarhtml . "<div class='media-body'><strong>" . $displayname . "</strong><br>"; if (get_user_meta($userid, 'user_job_title', true)) { echo '<span class="small">' . get_user_meta($userid, 'user_job_title', true) . "</span><br>"; }
function wpua_action_show_user_profile($user) { global $blog_id, $current_user, $post, $show_avatars, $wpdb, $wpua_allow_upload, $wpua_edit_avatar, $wpua_upload_size_limit_with_units; // Get WPUA attachment ID $wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true); // Show remove button if WPUA is set $hide_remove = !has_wp_user_avatar($user->ID) ? ' wpua-hide' : ""; // If avatars are enabled, get original avatar image or show blank $avatar_medium_src = (bool) $show_avatars == 1 ? wpua_get_avatar_original($user->user_email, 96) : includes_url() . 'images/blank.gif'; // Check if user has wp_user_avatar, if not show image from above $avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src; // Check if user has wp_user_avatar, if not show image from above $avatar_thumbnail = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 96) : $avatar_medium_src; // Change text on message based on current user $profile = $current_user->ID == $user->ID ? '“' . __('Update Profile') . '”' : '“' . __('Update User') . '”'; ?> <?php do_action('wpua_before_avatar'); ?> <input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?> " /> <?php if (current_user_can('upload_files')) { // Button to launch Media uploader ?> <p id="wpua-add-button"><button type="button" class="button" id="wpua-add" name="wpua-add"><?php _e('Edit Image'); ?> </button></p> <?php } elseif (!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) { // Upload button ?> <p id="wpua-upload-button"> <input name="wpua-file" id="wpua-file" type="file" /> <button type="submit" class="button" id="wpua-upload" name="submit" value="<?php _e('Upload'); ?> "><?php _e('Upload'); ?> </button> </p> <p id="wpua-upload-messages"> <span id="wpua-max-upload"><?php printf(__('Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units), esc_html('KB')); ?> </span> <span id="wpua-allowed-files"><?php _e('Allowed Files'); ?> : <?php _e('<code>jpg jpeg png gif</code>'); ?> </span> </p> <?php } elseif ((bool) $wpua_edit_avatar == 1 && !current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) { // Edit button ?> <?php $edit_attachment_link = add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')); ?> <p id="wpua-edit-button"><button type="button" class="button" id="wpua-edit" name="wpua-edit" onclick="window.open('<?php echo $edit_attachment_link; ?> ', '_self');"><?php _e('Edit Image'); ?> </button></p> <?php } ?> <?php /*?> <p id="wpua-preview"> <img src="<?php echo $avatar_medium; ?>" alt="" /> <?php _e('Original Size'); ?> </p> <?php */ ?> <p id="wpua-thumbnail"> <img src="<?php echo $avatar_thumbnail; ?> " alt="" /> <?php _e('Thumbnail'); ?> </p> <p id="wpua-remove-button"><button type="button" class="button<?php echo $hide_remove; ?> " id="wpua-remove" name="wpua-remove"><?php _e('Remove'); ?> </button></p> <p id="wpua-message"><?php printf(__('Click %s to save your changes', 'wp-user-avatar'), $profile); ?> </p> <?php do_action('wpua_after_avatar'); ?> <?php }
$curauth = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); $author_email = get_the_author_meta('user_email', $curauth->ID); $twitter_profile = get_the_author_meta('twitter_profile', $curauth->ID); $linkedin_profile = get_the_author_meta('linkedin_profile', $curauth->ID); $google_profile = get_the_author_meta('google_profile', $curauth->ID); $user_url = get_the_author_meta('user_url', $curauth->ID); $facebook_profile = get_the_author_meta('facebook_profile', $curauth->ID); $github_profile = get_the_author_meta('github_profile', $curauth->ID); $pinterest_profile = get_the_author_meta('pinterest_profile', $curauth->ID); $tumbler_profile = get_the_author_meta('tumbler_profile', $curauth->ID); $template_location = get_bloginfo('template_directory'); $avatar_address = $template_location . "/images/surfagility.jpg"; $personal_avatar = false; if (function_exists('has_wp_user_avatar')) { if (has_wp_user_avatar($curauth->ID)) { $avatar_address = get_wp_user_avatar_src($curauth->ID, 'large'); $personal_avatar = true; } } ?> <!-- container div starts in header --> <!-- row div starts in header --> <div class="author-page"> <div class="col-lg-5 col-sm-5 cover" > <?php if ($personal_avatar) { ?> <div class="cover-img" style="background-image:url('<?php echo $avatar_address; ?> ')">
if (!($user_url_nicename = url_segment(2))) { // this needs to be "2" for the live site $user_url_nicename = $current_user->user_nicename; } // determine if user is viewing his own pages $is_viewing_own_page = true; $current_page_user_id = $current_user->ID; if ($current_user->user_nicename != $user_url_nicename && is_author()) { $is_viewing_own_page = false; $current_page_user_id = get_user_by('slug', $user_url_nicename)->ID; } // get user avatar, and specify a fallback if (!($avatar = get_wp_user_avatar_src($current_page_user_id, 80))) { $avatar = DEFAULT_THUMBNAIL; } if (!($menu_avatar = get_wp_user_avatar_src($current_user->ID, 48))) { $menu_avatar = DEFAULT_THUMBNAIL; } // get user background if (is_user_logged_in()) { if (is_page() || is_singular('post') || is_search()) { $page_background = DEFAULT_PAGE_BACKGROUND; } else { if ($background_id = get_user_meta($current_page_user_id, 'user_background', true)) { global $wpdb; $upload_directory = wp_upload_dir(); $background_src = $wpdb->get_var("SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = '" . $background_id . "' AND meta_key = '_wp_attached_file'"); $page_background = $user_background = $upload_directory['baseurl'] . '/' . $background_src; } else { $page_background = $user_background = DEFAULT_BACKGROUND; }
<a href="/?logout=true" class="cabinet--signout"> ВЫЙТИ ИЗ ЛИЧНОГО КАБИНЕТА <i class="fa fa-sign-out"></i> </a> </div> </div> </section> <section class="cabinet__content"> <div class="container"> <div class="row"> <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12"> <aside class="cabinet__sidebar"> <div class="cabinet__sidebar--head"> <div class="cabinet__sidebar--avatar"> <img src="<?php echo get_wp_user_avatar_src($current_user->ID, 96); ?> " alt=""> </div> <div class="cabinet__sidebar--name"> <p><?php echo $current_user->nickname; ?> </p> <h4><?php echo $current_user->user_firstname; ?> <?php echo $current_user->user_lastname; ?> </h4>
if (have_posts()) { while (have_posts()) { the_post(); // get fave count $faves = qb_count_faves($post->ID); // get comment count $comments = wp_count_comments($post->ID); $quote_id = get_the_ID(); //$attributed_to = get_field( 'quote_author' ) ? get_field( 'quote_author' ) : 'Anonymous'; // fetch quote contributor; set to "You" for quotes added by current user $contributor = get_the_author_meta('display_name'); if ($contributor == $current_user->display_name) { $contributor .= ' (you)'; } // get author avatar if (!($author_avatar = get_wp_user_avatar_src($post->post_author, 80))) { $author_avatar = DEFAULT_THUMBNAIL; } echo '<section class="main"> <p class="message quote-edit success">Quote updated successfully</p>'; $quotes = new WP_Query(array('p' => $quote_id, 'post_status' => array('private', 'publish'), 'post_type' => 'quote')); include TEMPLATEPATH . '/loop-quotes.php'; /** * Tags */ if ($tags = get_the_terms($post->ID, 'post_tag')) { echo ' <section class="tag box"> <div class="bubble"> <h4>Tags</h4> <ul>';
<?php $op_user = get_user_meta($user->ID, 'op_user', true); ?> <div class="wrap wrap--user"> <figure class="wrap wrap--photo"> <a href="<?php echo get_author_posts_url($user->ID); ?> "> <img src="<?php if (function_exists('get_wp_user_avatar_src') && get_wp_user_avatar_src($user->ID, 100, 'medium') != '') { echo get_wp_user_avatar_src($user->ID, 100, 'medium'); } elseif ($user->userphoto_image_file != '') { echo get_bloginfo('url') . '/wp-content/uploads/userphoto/' . $user->userphoto_image_file; } else { echo get_stylesheet_directory_uri() . '/img/default/nophoto.png'; } ?> "/> <div class="overflow overflow--black"> <p> <?php if (get_the_author_meta('asociation_position', $user->ID) != '') { echo '<strong>' . change_role_name(get_the_author_meta('asociation_position', $user->ID)) . '</strong>'; } ?> <?php echo '<br>' . get_the_author_meta('first_name', $user->ID) . '<br>' . get_the_author_meta('last_name', $user->ID); ?>
if ($members) { echo '<main>'; foreach ($members as $member) { // get user info $member_id = $member['board_members_user']['ID']; $member_screen_name = $member['board_members_user']['display_name']; $member_username = $member['board_members_user']['user_nicename']; $member_description = $member['board_members_user']['user_description']; $member_home_url = get_bloginfo('home') . '/author/' . $member_username; // count stats $quotecount = count_user_posts_by_type($member_id, 'quote'); $boardcount = count_user_posts_by_type($member_id, 'board'); //$follower_count = $wpdb->get_var( "SELECT COUNT(*) FROM wp_qb_followers WHERE follower_id = '$member_id'" ); // member thumbnail if (has_wp_user_avatar($member_id)) { $avatar = get_wp_user_avatar_src($member_id, 80); } else { $avatar = DEFAULT_THUMBNAIL; } // member background if ($background_id = get_user_meta($member_id, 'user_background', true)) { $upload_directory = wp_upload_dir(); $background_src = $wpdb->get_var("SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = '" . $background_id . "' AND meta_key = '_wp_attached_file'"); $user_background = $upload_directory['baseurl'] . '/' . $background_src; } else { $user_background = DEFAULT_BACKGROUND; } // description if (strlen($member_description = get_user_meta($member_id, 'description', true)) > 200) { $member_description = substr($member_description, 0, 200) . '...'; } elseif (empty($member_description)) {
<div class="overlay header"> <div class="row"> <div class="medium-8 medium-offset-3 columns"> <h1><?php the_author_meta('display_name', $author_id); ?> </h1> </div> </div> </div> <section class="body"> <div class="row"> <div class="author-bio small-12 medium-2 medium-offset-1 columns"> <img src="<?php echo get_wp_user_avatar_src(get_the_author_meta('ID', $author_id), 150); ?> " class="author-bio-image"> <ul class="social-icon-links inline-list"> <?php if (get_the_author_meta('twitter', $author_id)) { ?> <li><a href="<?php the_author_meta('twitter', $author_id); ?> "><img src="<?php theme_image_src('icons/social-twitter-grey.svg'); ?> "></a></li> <?php
<?php if (get_user_meta($userid, 'user_telephone', true)) { $html .= '<i class="glyphicon glyphicon-earphone"></i> <a href="tel:' . str_replace(" ", "", get_user_meta($userid, "user_telephone", true)) . '">' . get_user_meta($userid, 'user_telephone', true) . "</a><br>"; } ?> <?php if (get_user_meta($userid, 'user_mobile', true) && $showmobile) { $html .= '<i class="glyphicon glyphicon-phone"></i> <a href="tel:' . str_replace(" ", "", get_user_meta($userid, "user_mobile", true)) . '">' . get_user_meta($userid, 'user_mobile', true) . "</a><br>"; } $html .= '<a href="mailto:' . $user_info->user_email . '">Email ' . $user_info->first_name . '</a></p></div></div></div>'; $counter++; } else { if (function_exists('get_wp_user_avatar')) { $imgsrc = get_wp_user_avatar_src($u['user_id'], 'thumbnail'); if ($directorystyle == 1) { $avatarhtml = "<img class='img img-circle alignleft' src='" . $imgsrc . "' width='66' height='66' alt='" . $displayname . "' />"; } else { $avatarhtml = "<img class='img alignleft' src='" . $imgsrc . "' width='66' height='66' alt='" . $displayname . "' />"; } } else { $avatarhtml = get_avatar($u['user_id'], 66, array('class' => 'alignleft')); $avatarhtml = str_replace("photo", "photo alignleft", $avatarhtml); } $html .= "<div class='col-lg-4 col-md-4 col-sm-6'><div class='indexcard'><a href='" . site_url() . "/staff/" . $user_info->user_nicename . "/'><div class='media'>" . $avatarhtml . "<div class='media-body'><strong>" . $displayname . "</strong>" . $gradedisplay . "<br>"; // display team name(s) $poduser = new Pod('user', $userid); $terms = $poduser->get_field('user_team'); unset($poduser); foreach ($terms as $taxonomy) {
if ($invite_id !== 0) { // check that user is being followed by the person being invited // 11/24/14 - temporarily disabling this check to facilitate invites //$is_followed = $wpdb->get_var( "SELECT user_id FROM wp_qb_followers WHERE user_id = '$user_id' AND follower_id = '$invite_id'" ); // check that person being invited is followed by the current user $is_following = $wpdb->get_var("SELECT user_id FROM wp_qb_followers WHERE user_id = '{$invite_id}' AND follower_id = '{$user_id}'"); // if mutual followers, look up invitee info if ($is_following) { //&& $is_followed ) { $invitee = get_user_by('id', $invite_id); // make sure invitee is not already a collaborator on the board if (qb_check_if_collaborating($invitee->user_email, $board_id) == false) { echo json_encode(array('errors' => 'This person is already a collaborator on this board.')); exit; } if (!($invitee_avatar = get_wp_user_avatar_src($invitee->ID, 48))) { $invitee_avatar = DEFAULT_THUMBNAIL; } $return_html = ' <li class="awaiting-invite" data-email="' . $invitee->user_email . '" data-id="' . $invitee->ID . '"> <a href="' . get_bloginfo('home') . '/author/' . $invitee->user_nicename . '" target="_blank"> <img src="' . $invitee_avatar . '" width="48" height="48" /> <span>' . $invitee->display_name . '</span> <span>Awaiting Invitation</span> </a> <a class="delete remove-invitee" href="">(remove)</a> </li>'; echo json_encode(array('html' => $return_html, 'email' => $invitee->user_email)); } else { echo json_encode(array('errors' => 'To invite someone, you must be following them and they must also be following you.')); }