foreach ((array) $sr as $u) { $g = get_user_meta($u['user_id'], 'user_grade', false); $l = get_user_meta($u['user_id'], 'last_name', false); //echo $u." ".$g[0]['name']." ".$l[0]."<br> "; $userid = $u['user_id']; //echo $userid; $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')) { $image_url = get_wp_user_avatar($userid, 130, 'left'); } else { $image_url = get_avatar($userid, 130); } $image_url = str_replace('avatar ', 'avatar img ', $image_url); if ($directorystyle == 1) { $avatarhtml = str_replace('avatar-66', 'avatar-66 pull-left indexcard-avatar img img-circle', get_avatar($userid, 66)); } else { $avatarhtml = str_replace('avatar-66', 'avatar-66 pull-left indexcard-avatar img ', get_avatar($userid, 66)); } $gradedisplay = ''; if ($showgrade) { $gradecode = get_user_meta($userid, 'user_grade', true); $gradecode = $gradecode['grade_code']; $gradedisplay = "<span class='badge pull-right'>" . $gradecode . "</span>"; }
if (empty($comment)) { echo json_encode(array('errors' => 'Please enter a comment')); exit; } if ($quote_id === 0) { echo json_encode(array('errors' => 'Sorry, this form submission is not allowed (invalid quote ID).')); exit; } // get commenter info $current_user = wp_get_current_user(); // set up comment properties $comment_parameters = array('comment_author' => $current_user->display_name, 'comment_author_email' => $current_user->user_email, 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_author_url' => $current_user->user_url, 'comment_content' => $comment, 'comment_date' => current_time('mysql'), 'comment_parent' => 0, 'comment_post_ID' => $quote_id, 'user_id' => $current_user->ID); // add the comment if ($comment_added_id = wp_insert_comment($comment_parameters)) { wp_notify_postauthor($comment_added_id); if (!($comment_avatar = get_wp_user_avatar($current_user->ID, 48))) { $comment_avatar = DEFAULT_THUMBNAIL; } $comment_html = ' <li>' . $comment_avatar . $current_user->display_name . '<time class="timeago" datetime="' . date('c') . '">' . date('F j, Y') . '</time> <p>' . $comment . '</p> </li>'; echo json_encode(array('comment_html' => $comment_html)); } else { echo json_encode(array('errors' => 'There was a problem adding your comment')); } exit; /* function ajaxify_comments($comment_ID, $comment_status){ if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){ //If AJAX Request Then
function getUserListing($curuser) { $html = '<div class="uyd-user ' . ($curuser->ID === 'GUEST' ? 'guest' : '') . '">'; /* Gravatar */ if (function_exists('get_wp_user_avatar')) { $display_gravatar = get_wp_user_avatar($curuser->user_email, 32); } else { $display_gravatar = get_avatar($curuser->user_email, 32); if ($display_gravatar === false) { //Gravatar is disabled, show default image. $display_gravatar = '<img src="' . USEYOURDRIVE_ROOTPATH . '/css/images/usericon.png"/>'; } } $html .= "<div class=\"uyd-avatar\"><a title=\"{$curuser->display_name}\">{$display_gravatar}</a></div>\n"; $html .= "<div class=\"uyd-userinfo\" data-userid=\"" . $curuser->ID . "\">"; /* name */ $html .= "<div class=\"uyd-name\"><a href=\"" . ($curuser->ID === 'GUEST' ? '#' : get_edit_user_link($curuser->ID)) . "\"title=\"{$curuser->display_name}\">{$curuser->display_name}</a></div>\n"; /* Current link */ if ($curuser->ID === 'GUEST') { $curfolder = get_site_option('use_your_drive_guestlinkedto'); } else { $curfolder = get_user_option('use_your_drive_linkedto', $curuser->ID); } $nolink = true; if (empty($curfolder) || !is_array($curfolder) || !isset($curfolder['foldertext'])) { $curfolder = __('Not yet linked to a folder', 'useyourdrive'); } else { $curfolder = $curfolder['foldertext']; $nolink = false; } $html .= "<div class=\"uyd-linkedto\">{$curfolder}</div>\n"; $html .= "<input class='uyd-linkbutton button-primary' type='submit' title='" . __('Link to folder', 'useyourdrive') . "' value='" . __('Link to folder', 'useyourdrive') . "'>"; $html .= "<input class='uyd-unlinkbutton button-secondary " . ($nolink ? 'disabled' : '') . "' type='submit' title='" . __('Remove link', 'useyourdrive') . "' value='" . __('Remove link', 'useyourdrive') . "'>"; $html .= "</div>"; $html .= '</div>'; return $html; }
<main id="main" class="site-main col-md-12" role="main"> <?php if (have_posts()) { ?> <header class="page-header col-md-12"> <?php the_archive_title('', '</h1>'); //This has a filter, found in functions.php, that determines the formatting of the prefix. This also controls which .section-title appears above the archive the_archive_title the_archive_description('<div class="taxonomy-description">', '</div>'); ?> <div class="taxonomy-description author-bio"> <?php echo get_wp_user_avatar(get_the_author_meta('ID'), 96, 'left'); echo get_the_author_meta('description'); ?> </div> <h2 class="widget-title" style="border:none;">Publications by <?php echo get_the_author_meta('first_name'); ?> </h2> </header><!-- .page-header --> <div class="col-md-8"> <?php /* Start the Loop */ ?> <?php while (have_posts()) {
function wpua_shortcode($atts, $content) { global $blog_id, $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; } // 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; // Open in new window $target_link = !empty($target) ? ' target="' . $target . '"' : ""; if ($link == 'file') { // Get image src $image_link = get_wp_user_avatar_src($id_or_email, 'original', $align); } elseif ($link == 'attachment') { // Get attachment URL $image_link = get_attachment_link(get_the_author_meta($wpdb->get_blog_prefix($blog_id) . 'user_avatar', $id_or_email)); } else { // URL $image_link = $link; $link_class = 'custom'; } // Wrap the avatar inside the link $avatar = '<a href="' . $image_link . '" class="wp-user-avatar-link wp-user-avatar-' . $link_class . '"' . $target_link . '>' . get_wp_user_avatar($id_or_email, $size, $align) . '</a>'; } else { // Get WPUA as normal $avatar = get_wp_user_avatar($id_or_email, $size, $align); } return $avatar; }
/** * 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; }
<?php $post = new TimberPost(); $data = Timber::get_context(); $related_posts = yarpp_get_related(); if (!empty($related_posts)) { foreach ($related_posts as $related_post) { $timber_related_posts[] = Timber::get_post($related_post->ID); } $data['related_posts'] = $timber_related_posts; } $data['post'] = $post; $data['author_image'] = get_lazyloadxt_html(get_wp_user_avatar($post->author->ID, 150)); Timber::render(array('single.twig'), $data);
<?php /* * QUOTEBOARD * Comment Form - loaded in single-quote.php */ // get avatar (relies on WP User Avatar plugin) if (!($current_user_avatar = get_wp_user_avatar(get_current_user_id(), 'thumb-small'))) { $current_user_avatar = DEFAULT_THUMBNAIL; } if (have_comments()) { ?> <section class="comment box"> <div class="bubble"> <h4>Comments</h4> <span class="box-meta"> <?php comments_number('No comments yet', '1 comment so far', '% comments so far'); ?> </span> <?php if (have_comments()) { echo '<ul id="comment-list">'; wp_list_comments(array('callback' => 'qb_comments')); echo '</ul>'; } ?> </div> <!-- // bubble --> </section> <!-- // comments -->
$quote_board_permalink .= '<a href="' . get_the_permalink($board) . '">' . get_the_title($board) . '</a>'; } // update custom fields if ($quote_updated) { add_post_meta($quote_added_id, 'quote_author', $quote_attributed_to_id); add_post_meta($quote_added_id, '_quote_author', 'field_507658884a81f'); add_post_meta($quote_added_id, 'quote_character', $quote_character_id); add_post_meta($quote_added_id, '_quote_character', 'field_56c724e28d8b8'); add_post_meta($quote_added_id, 'quote_source', $quote_sourced_to_id); add_post_meta($quote_added_id, '_quote_source', 'field_507658884b202'); add_post_meta($quote_added_id, 'quote_board', $quote_boards); add_post_meta($quote_added_id, '_quote_board', 'field_5077ae14b09b9'); add_post_meta($quote_added_id, 'quote_link', $quote_source_info); add_post_meta($quote_added_id, '_quote_link', 'field_568d2f6302c1e'); // return params for jQuery echo json_encode(array('added_by' => $current_user_id, 'author_id' => $quote_attributed_to_id, 'board_id' => $quote_boards, 'quote_id' => $quote_added_id, 'home_url' => home_url(), 'avatar' => get_wp_user_avatar($current_user_id, 80), 'quote_url' => get_permalink($quote_added_id), 'username' => get_user_by('id', $current_user_id)->user_nicename, 'datetime' => date('c'), 'quote' => wp_unslash(nl2br($quote_text_hashless)), 'privacy' => $quote_status, 'permalink' => $quote_board_permalink)); exit; } else { echo json_encode(array('permalink' => false)); } /* //test echo json_encode( array( 'hashed quote' => $quote_text_hashed, 'attributed to' => $quote_attributed_to, 'attributed to ID' => $quote_attributed_to_id, 'board id' => $quote_boards,
// fetch character $character = get_field('quote_character'); // 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'; $quote_class = ' yours'; $home_url = ''; } else { $quote_class = ''; $home_url = 'author/' . get_the_author_meta('user_nicename'); } // fetch quote board $board_id = get_post_meta($post->ID, 'quote_board', true); // get avatar (relies on WP User Avatar plugin) if (!($author_avatar = get_wp_user_avatar($author['ID'], 60))) { $author_avatar = get_default_thumbnail('thumb-small'); } // use character image whenever possible if ($character) { if ($character_image_id = get_field('character_image', $character->ID)) { $author_avatar = wp_get_attachment_image($character_image_id, 'thumb-small'); } } ?> <article class="quote box<?php echo $quote_class; ?> " data-author="<?php echo $author['ID'];
$wp_query = null; $wp_query = new WP_Query(); $wp_query->query('cat=' . $temp . '&showposts=9' . '&paged=' . $paged); ?> <ul class="interview-list"> <?php while ($wp_query->have_posts()) { $wp_query->the_post(); ?> <li class="single-news"> <a href="<?php the_permalink(); ?> "> <div class="thumb"> <?php echo get_wp_user_avatar($authordata->ID, 181, 'left'); ?> </div> <div class="posts-info"> <?php $author = get_the_author(); ?> <?php $user_description = get_the_author_meta('description', $authordata->ID); ?> <h2><span class="author-name"><?php echo $author; ?> </span></h2> <h4><?php
function get_author_avatar_url($id) { $get_avatar = get_wp_user_avatar($id); preg_match('/src\\s*=\\s*"(.+?)"/', $get_avatar, $matches); return $matches[1]; }
// 'posts_per_page' => 10, //RESULTS_PER_PAGE, // 'post_type' => 'quote' // ) // ); include TEMPLATEPATH . '/loop-quotes.php'; echo '<a class="btn right" href="' . home_url() . '/quotes">More Quotes »</a> </div> <div class="flex-child flex-40"> <h3 style="margin-left: 30px;">Notable Quoters</h3>'; if ($curated_authors = get_field('curated_authors', 'option')) { foreach ($curated_authors as $key => $author) { foreach ($author['author'] as $key => $value) { // I don't know why this nested foreach is needed... // get author avatar if (!($author_avatar = get_wp_user_avatar($value['ID'], 'thumbnail'))) { $author_avatar = get_default_thumbnail('thumbnail'); } // get user background if ($background_id = get_user_meta($value['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'"); $author_cover_photo = $upload_directory['baseurl'] . '/' . $background_src; } else { $author_cover_photo = DEFAULT_BACKGROUND; } // get author quote counts $author_quote_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key = 'quote_author' AND meta_value = '" . $value['ID'] . "'"); echo '<div class="profile static" data-link="' . home_url('/') . 'author/' . $value['user_nicename'] . '"> <div class="cover" style="background: url(' . $author_cover_photo . ') center no-repeat;">' . $author_avatar . '<div> <div>
<li data-email="' . $member_email . '" data-id="' . $member['board_members_user']['ID'] . '"> <a href="' . get_bloginfo('home') . '/author/' . $member['board_members_user']['user_nicename'] . '" target="_blank">' . $member_avatar . ' <span>' . $member['board_members_user']['display_name'] . '</span>' . '<span>' . ($user_id != $member['board_members_user']['ID'] ? 'Invited by you' : 'You created this board') . '</span> </a>' . ($user_id != $member['board_members_user']['ID'] ? '<a class="delete remove-collab" href="">(remove)</a>' : '') . ' </li>'; } } // check for pending collaborators (invitations sent by board curator but not yet accepted) if ($pending_invitees = $wpdb->get_results("SELECT invite_email, is_member FROM wp_qb_invite_codes WHERE board_id = '{$board_id}'")) { foreach ($pending_invitees as $pending) { // get info for existing members if ($pending->is_member) { $existing_member = get_user_by('email', $pending->invite_email); $collaborators .= ' <li class="awaiting-invite" data-email="' . $pending->invite_email . '" data-id="' . $existing_member->ID . '"> <a href="' . get_bloginfo('home') . '/author/' . $existing_member->user_nicename . '" target="_blank">' . get_wp_user_avatar($existing_member->ID, 48) . ' <span>' . $existing_member->display_name . '</span> <span>Invitation Sent – Awaiting Response</span> </a></li>'; // . ( $user_id != $member['board_members_user']['ID'] ? '<a class="delete remove-pending-collab" href="">(remove)</a>' : '' ) . ' //</li>'; // else the pending invite is for a non-member } else { $collaborators .= ' <li class="awaiting-invite" data-email="' . $pending->invite_email . '"> <div class="ico email invite-email"></div> <span>' . $pending->invite_email . '</span> <span>Invitation Sent – Awaiting Response</span> </a></li>'; } }
if ($recentQuery->have_posts()) { while ($recentQuery->have_posts()) { $recentQuery->the_post(); ?> <h3>Latest News</h3> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="author"> <div class="avatarWrapper"> <?php echo get_wp_user_avatar(); ?> </div> <span class="authorName"> By <?php the_author(); ?> </span> </div> <?php the_content('Read More »'); ?> <?php } }
">Register</a></button> </div> <?php } else { ?> <?php $current_user = wp_get_current_user(); ?> <div class="col-sm-6 buttons-stat"> <div class="pull-right"> <div class="col-xs-6" id="avatar"> <?php if (function_exists('get_wp_user_avatar')) { echo get_wp_user_avatar($current_user->ID, 60); } //else { // echo '<img src="../images/cb_mystery-man-avatar.jpg/" />'; //} ?> </div> <div class="col-xs-6" id="right-group"> <?php $profilename = get_user_meta($current_user->ID, 'profilename', true); $cur_username = $profilename != "" ? $profilename : $current_user->user_login; // echo ">> ".$cur_username." | ".$dusername." | ".$cur_user->user_login; ?> <div id="user">Hello, <span id="username"><a href="<?php echo get_home_url() . '/user-dashboard'; ?>
</div> <?php } ?> <div class="postWrapper"> <?php the_content(); ?> <div class="postFooter clearfix"> <div class="authorMeta clearfix"> <div class="authorAvatar"> <img class="authorAvatarInner" src="<?php if (get_wp_user_avatar()) { echo get_wp_user_avatar_src(); } ?> "/> <div class="authorAvatarFilter"></div> </div> <div class="authorInfo"> <h3>Posted by <?php the_author(); ?> </h3> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> ">View all posts by <?php
/** * Now that the image is uploaded to the wp_uploads directory, * we need to add it to the media library as an attachment. */ $attachment = array('post_mime_type' => 'image/jpeg', 'post_title' => $author_info->display_name, 'post_content' => '', 'post_status' => 'inherit'); $attach_id = wp_insert_attachment($attachment, $local_image_path); // require_once( ABSPATH . 'wp-admin/includes/image.php' ); // Generate the metadata for the attachment, and update the database record. $attach_data = wp_generate_attachment_metadata($attach_id, $local_image_path); wp_update_attachment_metadata($attach_id, $attach_data); // link avatar with user (so it's recognized by WP User Avatar) add_post_meta($attach_id, '_wp_attachment_wp_user_avatar', $current_page_user_id); update_user_meta($current_page_user_id, 'wp_user_avatar', $attach_id); } // user now has an avatar, so fetch it! $author_photo = get_wp_user_avatar($current_page_user_id, 'thumbnail'); } curl_close($ch); } // user bio - if it isn't specified, attempt to get from Wikipedia if (!($user_bio = get_user_meta($current_page_user_id, 'description', true))) { $api_url = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exsentences=2&redirects&titles=' . $author_name; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, 'Quoteboard/1.0 (http://www.quoteboard.com/; elebrias@gmail.com)'); $api_result = curl_exec($ch); curl_close($ch); // API call fails if (!$api_result) { $user_bio = 'Alas, we don\'t have any information about this person.';
$curauth = get_userdata(intval($author)); ?> <h1 class="page__title soft--bottom text--secondary fa-angle-right"> <?php echo ucfirst($curauth->display_name); ?> </h1> </div><!--/.grid__item --><div class="grid__item palm-one-whole mid-one-whole two-thirds"> <div class="grid"> <div class="grid__item palm-one-whole one-quarter"> <?php echo '<span>' . get_wp_user_avatar(get_the_author_meta('user_email'), 150) . '</span>'; ?> </div><!-- --><div class="grid__item palm-one-whole push--bottom three-quarters"> <div class="author-social"> <?php $theme_path = get_template_directory_uri(); if ($curauth->website) { echo '<a href="' . $curauth->website . '"><img class="author-social-icon" src="' . $theme_path . '/dist/images/twitter_circle_color.png"></a>'; } if ($curauth->twitter) { echo '<a href="' . $curauth->twitter . '"><img class="author-social-icon" src="' . $theme_path . '/dist/images/twitter_circle_color.png"></a>'; } if ($curauth->facebook) { echo '<a href="' . $curauth->facebook . '"><img class="author-social-icon" src="' . $theme_path . '/dist/images/facebook_circle_color.png"></a>';
function author_biography($author_id = 0) { if ($author_id == 0) { $author_id = get_the_author_meta('ID'); } $author_username = get_the_author_meta('display_name', $author_id); ?> <div class="author-bio-wrapper"> <div class="row"> <div class="col-xs-2 tight-right"> <div class="author-image"><a href="<?php echo get_author_posts_url($author_id); ?> "><?php echo get_wp_user_avatar($author_id, 'medium'); ?> </a></div> </div> <div class="col-xs-10"> <div class="author-title"><h3 class="section_title"><strong><?php echo $author_username; ?> </strong></h3></div> <div class="author-connect"> <ul> <?php if (get_the_author_meta('twitter', $author_id) != "") { ?> <li class="twitter-bio"><a href="http://twitter.com/intent/user?screen_name=<?php echo get_the_author_meta('twitter', $author_id); ?> "><i class="fa fa-fw fa-twitter"></i></a></li> <?php } if (get_the_author_meta('linkedin', $author_id) != "") { ?> <li class="linkedin-bio"><a href="<?php echo get_the_author_meta('linkedin', $author_id); ?> " target="_blank"><i class="fa fa-fw fa-linkedin"></i></a></li> <?php } ?> </ul> </div> <?php if (get_the_author_meta('job_title', $author_id) != "") { ?> <div class="author-job-title"><?php echo get_the_author_meta('job_title', $author_id); ?> </div> <?php } if (get_the_author_meta('description', $author_id) != "") { ?> <div class="author-biography"><?php echo get_the_author_meta('description', $author_id); ?> </div> <?php } ?> </div> </div> </div> <?php }
/** * Return just the image src * @since 1.1 * @param int|string $id_or_email * @param int|string $size * @param string $align * @uses get_wp_user_avatar() * @return string */ public function get_wp_user_avatar_src($id_or_email = "", $size = "", $align = "") { $wpua_image_src = ""; // Gets the avatar img tag $wpua_image = get_wp_user_avatar($id_or_email, $size, $align); // Takes the img tag, extracts the src if (!empty($wpua_image)) { $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER); $wpua_image_src = !empty($matches) ? $matches[0][1] : ""; } return $wpua_image_src; }
the_tags('Tags : '); ?> </p> </footer> </article> <hr> <aside class="bloc-author"> <!-- Emplacement avatar --> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> "> <?php echo get_wp_user_avatar(get_the_author_meta('ID'), 'thumbnail'); ?> </a> <div class="about"> <h3><a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> "><?php the_author(); ?> </a></h3> <p><?php the_author_meta('description'); ?> </p> </div>
function author_biography($author_id = 0) { if ($author_id == 0) { $author_id = get_the_author_meta('ID'); } $author_username = explode(' ', get_the_author_meta('display_name', $author_id)); ?> <div class="author-bio-wrapper"> <div class="author-image"><a href="<?php echo get_author_posts_url($author_id); ?> "><?php echo get_wp_user_avatar($author_id, 'thumbnail'); ?> </a></div> <div class="author-title"> <h3><?php $i = 0; // put br inside authors name - Jacob<br/>Raccuia foreach ($author_username as $name) { if ($i > 0) { echo '<br/>'; } echo $name; $i++; } ?> </h3> </div> <div class="author-connect"> <ul> <?php if (get_the_author_meta('twitter', $author_id) != "") { ?> <li class="twitter-bio"><a href="http://twitter.com/intent/user?screen_name=<?php echo get_the_author_meta('twitter', $author_id); ?> "><i class="fa fa-fw fa-twitter"></i></a></li> <?php } if (get_the_author_meta('linkedin', $author_id) != "") { ?> <li class="linkedin-bio"><a href="<?php echo get_the_author_meta('linkedin', $author_id); ?> " target="_blank"><i class="fa fa-fw fa-linkedin"></i></a></li> <?php } ?> </ul> </div> </div> <?php }
echo $fieldgroup['url']; ?> "><img src="<?php echo $fieldgroup['logo']['url']; ?> "></a></a> <?php } ?> <hr> <a href="/<?php echo get_the_author_link(); ?> "> <?php echo get_wp_user_avatar(get_the_author_meta('ID'), 150); ?> <p><?php echo get_the_author(); ?> </p> </a> </div> </div> <!-- DECK --> <h2 class="deck"><?php echo get_the_excerpt(); ?> </h2> <hr>
?> "><?php _e('logged in', 'html5reset'); ?> </a> <?php _e('to post a comment.', 'html5reset'); ?> </p> <?php } ?> <div class="comments-item"> <div class="comments-item-pic"> <?php echo get_wp_user_avatar(wp_get_current_user(), 60); ?> </div> <div class="comments-item-comment"> <form action="<?php echo get_option('siteurl'); ?> /wp-comments-post.php" method="post"> <input type="hidden" name="form-name" value="form 2"> <input placeholder="Your Name" type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?> " size="22" tabindex="1" <?php if ($req) { echo "aria-required='true'";
</div> <div id="home-col-3" class="col-lg-3 col-md-3 col-sm-5"> <?php if (is_active_sidebar('login-widget-area')) { $current_user = wp_get_current_user(); ?> <div id="loginrow" class="category-block"> <div id="loginaccordion"> <h3 class="widget-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#loginaccordion" href="#logincollapselogin"> <?php if (is_user_logged_in()) { ?> <?php if (function_exists('get_wp_user_avatar')) { echo get_wp_user_avatar(intval($current_user->id), 32); } echo " " . $current_user->display_name; ?> <?php } else { ?> Login <i class="glyphicon glyphicon-chevron-down"></i> <?php } ?> </a> </h3> </div> <div id="logincollapselogin" class="xpanel-collapse collapse out"> <div class="xpanel-body">
wp_reset_postdata(); } echo '</ul></div></section>'; } /** * Faves */ if ($faves = get_field('quote_fave')) { echo ' <section class="faves box"> <div class="bubble"> <h4>Faves</h4> <ul>'; foreach ($faves as $fave) { if (has_wp_user_avatar($fave['quote_fave_user']['ID'])) { $avatar = get_wp_user_avatar($fave['quote_fave_user']['ID'], 48); } else { $avatar = DEFAULT_THUMBNAIL; } echo ' <li> <a href="' . home_url('/') . 'author/' . $fave['quote_fave_user']['user_nicename'] . '">' . $avatar . $fave['quote_fave_user']['display_name'] . '</a> </li>'; } echo ' </ul> </div> </section>'; } /** * Comments
function wppb_front_end_profile_info() { global $changesSaved; global $changesSavedNoMatchingPass; global $changesSavedNoPass; $editProfileFilterArray = array(); $editProfileFilterArray2 = array(); $extraFieldsErrorHolder = array(); //we will use this array to store the ID's of the extra-fields left uncompleted global $wppb_shortcode_on_front; //get "login with" setting $wppb_generalSettings = get_option('wppb_general_settings'); $wppb_shortcode_on_front = true; ob_start(); get_currentuserinfo(); $wppb_defaultOptions = get_option('wppb_default_settings'); $changesSavedNoEmail = 'no'; $changesSavedNoEmailExist = 'no'; $previousError = 'no'; $pictureUpload = 'no'; $avatarUpload = 'yes'; $allRequiredCompleted = 'yes'; $uploadName = array(); $uploadExt = array(); $uploadSize = array(); $editFilterArray = array(); $error = null; /* Get user info. */ global $current_user; /* delete the attachment if set */ if (isset($_GET['userID']) && isset($_GET['field'])) { update_user_meta($_GET['userID'], $_GET['field'], ''); } /* delete the avatar */ if (isset($_GET['userID']) && isset($_GET['fieldOriginal']) && isset($_GET['fieldResized'])) { update_user_meta($_GET['userID'], $_GET['fieldOriginal'], ''); update_user_meta($_GET['userID'], $_GET['fieldResized'], ''); } //fallback if the file was largen then post_max_size, case in which no errors can be saved in $_FILES[fileName]['error'] if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { $editProfileFilterArray['noPost'] = '<p class="error">' . sprintf(__('The information size you were trying to submit was larger than %1$sb!<br/>This is usually caused by a large file(s) trying to be uploaded.<br/>Since it was also larger than %2$sb no additional information is available.<br/>The user was NOT created!', 'profilebuilder'), WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA, WPPB_SERVER_MAX_POST_SIZE_MEGA) . '</p>'; echo $editProfileFilterArray['noPost'] = apply_filters('wppb_edit_profile_no_post_error', $editProfileFilterArray['noPost']); } //a way to catch the user before updating his/her profile without completing a required field if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'update-user' && wp_verify_nonce($_POST['edit_nonce_field'], 'verify_edit_user')) { //variable to control whether the user submitted data or not $allRequiredCompleted = apply_filters('wppb_edit_profile_all_required_completed', $allRequiredCompleted); if ($wppb_defaultOptions['firstname'] == 'show') { $_POST['first_name'] = apply_filters('wppb_edit_profile_posted_first_name_check', $_POST['first_name']); if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { if (isset($_POST['first_name']) && trim($_POST['first_name']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['lastname'] == 'show') { $_POST['last_name'] = apply_filters('wppb_edit_profile_posted_last_name_check', $_POST['last_name']); if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { if (isset($_POST['last_name']) && trim($_POST['last_name']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['nickname'] == 'show') { $_POST['nickname'] = apply_filters('wppb_edit_profile_posted_nickname_check', $_POST['nickname']); if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { if (isset($_POST['nickname']) && trim($_POST['nickname']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['dispname'] == 'show') { $_POST['display_name'] = apply_filters('wppb_edit_profile_posted_display_name_check', $_POST['display_name']); if ($wppb_defaultOptions['dispnameRequired'] == 'yes') { if (isset($_POST['display_name']) && trim($_POST['display_name']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['website'] == 'show') { $_POST['website'] = apply_filters('wppb_edit_profile_posted_website_check', $_POST['website']); if ($wppb_defaultOptions['websiteRequired'] == 'yes') { if (isset($_POST['website']) && trim($_POST['website']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['aim'] == 'show') { $_POST['aim'] = apply_filters('wppb_edit_profile_posted_aim_check', $_POST['aim']); if ($wppb_defaultOptions['aimRequired'] == 'yes') { if (isset($_POST['aim']) && trim($_POST['aim']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['yahoo'] == 'show') { $_POST['yim'] = apply_filters('wppb_edit_profile_posted_yahoo_check', $_POST['yim']); if ($wppb_defaultOptions['yahooRequired'] == 'yes') { if (isset($_POST['yim']) && trim($_POST['yim']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['jabber'] == 'show') { $_POST['jabber'] = apply_filters('wppb_edit_profile_posted_jabber_check', $_POST['jabber']); if ($wppb_defaultOptions['jabberRequired'] == 'yes') { if (isset($_POST['jabber']) && trim($_POST['jabber']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['bio'] == 'show') { $_POST['description'] = apply_filters('wppb_edit_profile_posted_bio_check', $_POST['description']); if ($wppb_defaultOptions['bioRequired'] == 'yes') { if (isset($_POST['description']) && trim($_POST['description']) == '') { $allRequiredCompleted = 'no'; } } } /* also check the extra profile information */ $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { $wppbFetchArray = get_option('wppb_custom_fields'); foreach ($wppbFetchArray as $key => $value) { switch ($value['item_type']) { case "input": $_POST[$value['item_type'] . $value['id']] = apply_filters('wppb_edit_profile_input_custom_field_' . $value['id'] . '_check', $_POST[$value['item_type'] . $value['id']]); if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "checkbox": $checkboxOption = ''; $checkboxValue = explode(',', $value['item_options']); foreach ($checkboxValue as $thisValue) { $thisValue = str_replace(' ', '#@space@#', $thisValue); //we need to escape the space-codification we sent earlier in the post if (isset($_POST[$thisValue . $value['id']])) { $localValue = str_replace('#@space@#', ' ', $_POST[$thisValue . $value['id']]); $checkboxOption = $checkboxOption . $localValue . ','; } } if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($checkboxOption) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "radio": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "select": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "countrySelect": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "timeZone": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "datepicker": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "textarea": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "upload": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { $uploadedfile = $value['item_type'] . $value['id']; if (basename($_FILES[$uploadedfile]['name']) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "avatar": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { $uploadedfile = $value['item_type'] . $value['id']; if (basename($_FILES[$uploadedfile]['name']) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; } } } $allRequiredCompleted = apply_filters('wppb_edit_profile_all_required_completed_after_check', $allRequiredCompleted); } /* If profile was saved, update profile. */ if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'update-user' && wp_verify_nonce($_POST['edit_nonce_field'], 'verify_edit_user') && $allRequiredCompleted == 'yes') { if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { $_POST['email'] = apply_filters('wppb_edit_profile_posted_email', $_POST['email']); if ($wppb_defaultOptions['emailRequired'] == 'yes') { if (trim($_POST['email']) != '' && isset($_POST['email'])) { if (email_exists($_POST['email']) != FALSE) { $thisEmail = email_exists($_POST['email']); } else { $thisEmail = $current_user->id; } if (!empty($_POST['email']) && is_email($_POST['email'])) { // if the user entered a valid email address if ($thisEmail == $current_user->id) { // if the entered email address is not already registered to some other user wp_update_user(array('ID' => $current_user->id, 'user_email' => esc_attr($_POST['email']))); $changesSaved = 'yes'; } else { $changesSavedNoEmailExist = 'yes'; } } else { $changesSavedNoEmail = 'yes'; } } } else { if (email_exists($_POST['email']) != FALSE) { $thisEmail = email_exists($_POST['email']); } else { $thisEmail = $current_user->id; } if (!empty($_POST['email']) && is_email($_POST['email'])) { // if the user entered a valid email address if ($thisEmail == $current_user->id) { // if the entered email address is not already registered to some other user wp_update_user(array('ID' => $current_user->id, 'user_email' => esc_attr($_POST['email']))); $changesSaved = 'yes'; } else { $changesSavedNoEmailExist = 'yes'; } } else { $changesSavedNoEmail = 'yes'; } } } /* Update user information. */ if ($wppb_defaultOptions['firstname'] == 'show') { $_POST['first_name'] = apply_filters('wppb_edit_profile_posted_first_name', $_POST['first_name']); if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { if (isset($_POST['first_name']) && trim($_POST['first_name']) != '') { wp_update_user(array('ID' => $current_user->id, 'first_name' => esc_attr($_POST['first_name']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'first_name' => esc_attr($_POST['first_name']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['lastname'] == 'show') { $_POST['last_name'] = apply_filters('wppb_edit_profile_posted_last_name', $_POST['last_name']); if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { if (isset($_POST['last_name']) && trim($_POST['last_name']) != '') { wp_update_user(array('ID' => $current_user->id, 'last_name' => esc_attr($_POST['last_name']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'last_name' => esc_attr($_POST['last_name']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['nickname'] == 'show') { $_POST['nickname'] = apply_filters('wppb_edit_profile_posted_nickname', $_POST['nickname']); if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { if (isset($_POST['nickname']) && trim($_POST['nickname']) != '') { wp_update_user(array('ID' => $current_user->id, 'nickname' => esc_attr($_POST['nickname']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'nickname' => esc_attr($_POST['nickname']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['dispname'] == 'show') { $_POST['display_name'] = apply_filters('wppb_edit_profile_posted_display_name', $_POST['display_name']); if ($wppb_defaultOptions['dispnameRequired'] == 'yes') { if (isset($_POST['display_name']) && trim($_POST['display_name']) != '') { wp_update_user(array('ID' => $current_user->id, 'display_name' => esc_attr($_POST['display_name']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'display_name' => esc_attr($_POST['display_name']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['website'] == 'show') { $_POST['website'] = apply_filters('wppb_edit_profile_posted_website', $_POST['website']); if ($wppb_defaultOptions['websiteRequired'] == 'yes') { if (isset($_POST['website']) && trim($_POST['website']) != '') { $wppbPos = strpos((string) $_POST['website'], 'http://'); if ($wppbPos !== FALSE) { wp_update_user(array('ID' => $current_user->id, 'user_url' => esc_attr($_POST['website']))); $changesSaved = 'yes'; } else { wp_update_user(array('ID' => $current_user->id, 'user_url' => 'http://' . esc_attr($_POST['website']))); $changesSaved = 'yes'; } } } else { $wppbPos = strpos((string) $_POST['website'], 'http://'); $website = esc_attr($_POST['website']); if ($wppbPos !== FALSE) { if ($website == 'http://') { $website = ''; } wp_update_user(array('ID' => $current_user->id, 'user_url' => $website)); $changesSaved = 'yes'; } else { if ($website != '') { $website = 'http://' . $website; } wp_update_user(array('ID' => $current_user->id, 'user_url' => $website)); $changesSaved = 'yes'; } } } if ($wppb_defaultOptions['aim'] == 'show') { $_POST['aim'] = apply_filters('wppb_edit_profile_posted_aim', $_POST['aim']); if ($wppb_defaultOptions['aimRequired'] == 'yes') { if (isset($_POST['aim']) && trim($_POST['aim']) != '') { update_user_meta($current_user->id, 'aim', esc_attr($_POST['aim'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'aim', esc_attr($_POST['aim'])); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['yahoo'] == 'show') { $_POST['yim'] = apply_filters('wppb_edit_profile_posted_yahoo', $_POST['yim']); if ($wppb_defaultOptions['yahooRequired'] == 'yes') { if (isset($_POST['yim']) && trim($_POST['yim']) != '') { update_user_meta($current_user->id, 'yim', esc_attr($_POST['yim'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'yim', esc_attr($_POST['yim'])); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['jabber'] == 'show') { $_POST['jabber'] = apply_filters('wppb_edit_profile_posted_jabber', $_POST['jabber']); if ($wppb_defaultOptions['jabberRequired'] == 'yes') { if (isset($_POST['jabber']) && trim($_POST['jabber']) != '') { update_user_meta($current_user->id, 'jabber', esc_attr($_POST['jabber'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'jabber', esc_attr($_POST['jabber'])); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['bio'] == 'show') { $_POST['description'] = apply_filters('wppb_edit_profile_posted_bio', $_POST['description']); if ($wppb_defaultOptions['bioRequired'] == 'yes') { if (isset($_POST['description']) && trim($_POST['description']) != '') { update_user_meta($current_user->id, 'description', esc_attr($_POST['description'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'description', esc_attr($_POST['description'])); $changesSaved = 'yes'; } } /* update the extra profile information */ $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { $wppbFetchArray = get_option('wppb_custom_fields'); foreach ($wppbFetchArray as $key => $value) { switch ($value['item_type']) { case "input": $_POST[$value['item_type'] . $value['id']] = apply_filters('wppb_edit_profile_input_custom_field_' . $value['id'], $_POST[$value['item_type'] . $value['id']]); if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "hiddenInput": update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); break; case "checkbox": $checkboxOption = ''; $value['item_options'] = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $id . '_options_translation', $value['item_options']); $checkboxValue = explode(',', $value['item_options']); foreach ($checkboxValue as $thisValue) { $thisValue = str_replace(' ', '#@space@#', $thisValue); //we need to escape the space-codification we sent earlier in the post if (isset($_POST[$thisValue . $value['id']])) { $localValue = str_replace('#@space@#', ' ', $_POST[$thisValue . $value['id']]); $checkboxOption = $checkboxOption . $localValue . ','; } } if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($checkboxOption) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($checkboxOption)); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($checkboxOption)); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($checkboxOption)); } break; case "radio": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "select": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "countrySelect": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "timeZone": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "datepicker": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "textarea": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "upload": $uploadedfile = $value['item_type'] . $value['id']; //get allowed file types if ($value['item_options'] != NULL || $value['item_options'] != '') { $allFiles = false; $extensions = explode(',', $value['item_options']); foreach ($extensions as $key3 => $value3) { $extensions[$key3] = trim($value3); } } else { $allFiles = true; } //first we need to verify if we don't try to upload a 0b or 0 length file if (basename($_FILES[$uploadedfile]['name']) != '') { //get this attachments extension $thisFileExtStart = strrpos($_FILES[$uploadedfile]['name'], '.'); $thisFileExt = substr($_FILES[$uploadedfile]['name'], $thisFileExtStart); if ($allFiles === false) { if (in_array($thisFileExt, $extensions)) { //second we need to verify if the uploaded file size is less then the set file size in php.ini if ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0) { //we need to prepare the basename of the file, so that ' becomes ` as ' gives an error $fileName = basename($_FILES[$uploadedfile]['name']); $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } else { $finalFileName .= $fileName[$i]; } } //create the target path for uploading $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path = $wpUploadPath['basedir'] . "/profile_builder/attachments/"; $target_path = $target_path . 'userID_' . $current_user->id . '_attachment_' . $finalFileName; if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { $upFile = $wpUploadPath['baseurl'] . '/profile_builder/attachments/userID_' . $current_user->id . '_attachment_' . $finalFileName; update_user_meta($current_user->id, $value['item_metaName'], $upFile); $pictureUpload = 'yes'; } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } else { array_push($uploadExt, basename($_FILES[$uploadedfile]['name'])); $allowedExtensions = ''; (int) ($nrOfExt = count($extensions) - 2); foreach ($extensions as $key4 => $value4) { $allowedExtensions .= $value4; if ($key4 <= $nrOfExt) { $allowedExtensions .= ', '; } } } } else { //second we need to verify if the uploaded file size is less then the set file size in php.ini if ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0) { //we need to prepare the basename of the file, so that ' becomes ` as ' gives an error $fileName = basename($_FILES[$uploadedfile]['name']); $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } else { $finalFileName .= $fileName[$i]; } } //create the target path for uploading $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path = $wpUploadPath['basedir'] . "/profile_builder/attachments/"; $target_path = $target_path . 'userID_' . $current_user->id . '_attachment_' . $finalFileName; if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { $upFile = $wpUploadPath['baseurl'] . '/profile_builder/attachments/userID_' . $current_user->id . '_attachment_' . $finalFileName; update_user_meta($current_user->id, $value['item_metaName'], $upFile); $pictureUpload = 'yes'; } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } } break; case "avatar": $avatarUpload = 'no'; $uploadedfile = $value['item_type'] . $value['id']; $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path_original = $wpUploadPath['basedir'] . "/profile_builder/avatars/"; $fileName = $_FILES[$uploadedfile]['name']; $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } elseif ($fileName[$i] == ' ') { $finalFileName .= '_'; } else { $finalFileName .= $fileName[$i]; } } $fileName = $finalFileName; $target_path = $target_path_original . 'userID_' . $current_user->id . '_originalAvatar_' . $fileName; /* when trying to upload file, be sure it's one of the accepted image file-types */ if (($_FILES[$uploadedfile]['type'] == 'image/jpeg' || $_FILES[$uploadedfile]['type'] == 'image/jpg' || $_FILES[$uploadedfile]['type'] == 'image/png' || $_FILES[$uploadedfile]['type'] == 'image/bmp' || $_FILES[$uploadedfile]['type'] == 'image/pjpeg' || $_FILES[$uploadedfile]['type'] == 'image/x-png') && ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0)) { $avatarUpload = 'yes'; $wp_filetype = wp_check_filetype(basename($_FILES[$uploadedfile]['name']), null); $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => $fileName, 'post_content' => '', 'post_status' => 'inherit'); $attach_id = wp_insert_attachment($attachment, $target_path); $upFile = image_downsize($attach_id, 'thumbnail'); $upFile = $upFile[0]; //if file upload succeded if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { update_user_meta($current_user->id, $value['item_metaName'], $upFile); update_user_meta($current_user->id, 'resized_avatar_' . $value['id'], ''); } else { $avatarUpload = 'no'; } } elseif (($_FILES[$uploadedfile]['size'] > WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE || $_FILES[$uploadedfile]['size'] == 0) && $fileName != '') { $avatarUpload = 'no'; } elseif ($fileName == '') { $avatarUpload = 'yes'; } break; } } } } ?> <div class="wppb_holder" id="wppb_modify"> <?php if (!is_user_logged_in()) { $editProfileFilterArray['notLoggedIn'] = ' <p class="warning">' . __('You must be logged in to edit your profile.', 'profilebuilder') . '</p><!-- .warning -->'; echo $editProfileFilterArray['notLoggedIn'] = apply_filters('wppb_edit_profile_user_not_logged_in', $editProfileFilterArray['notLoggedIn']); } else { /* messages for the the delete avatar/attachment */ if (isset($_GET['fileType'])) { if ($_GET['fileType'] == 'avatar') { $editProfileFilterArray['avatarChangesSaved'] = ' <p class="changes-saved">' . __('The avatar was successfully deleted.', 'profilebuilder') . '</p><!-- .changes-saved -->'; echo $editProfileFilterArray['avatarChangesSaved'] = apply_filters('wppb_edit_profile_avatar_changes_saved', $editProfileFilterArray['avatarChangesSaved']); unset($_GET['fileType']); } elseif ($_GET['fileType'] == 'attachment') { $editProfileFilterArray['attachmentChangesSaved'] = '<p class="changes-saved">' . sprintf(__('The attachment "%1$s" was successfully deleted.', 'profilebuilder'), $_GET['fileName']) . '</p><!-- .changes-saved -->'; echo $editProfileFilterArray['attachmentChangesSaved'] = apply_filters('wppb_edit_profile_attachment_changes_saved', $editProfileFilterArray['attachmentChangesSaved']); unset($_GET['fileType']); unset($_GET['fileName']); } } /* all the other messages/errors */ $nrOfBadUploads = 0; $nrOfBadUploads = count($uploadName); $nrOfBadExtUploads = count($uploadExt); if ($changesSaved == 'yes' && $changesSavedNoMatchingPass == 'no' && $changesSavedNoPass == 'no' && $changesSavedNoEmail == 'no' && $changesSavedNoEmailExist == 'no' && $avatarUpload == 'yes' && $nrOfBadUploads == 0 && $nrOfBadExtUploads == 0) { $editProfileFilterArray['allChangesSaved'] = ' <p class="changes-saved">' . __('The changes have been successfully saved.', 'profilebuilder') . '</p><!-- .changes-saved -->'; echo $editProfileFilterArray['allChangesSaved'] = apply_filters('wppb_edit_profile_all_changes_saved', $editProfileFilterArray['allChangesSaved']); } elseif ($changesSaved == 'yes' && $changesSavedNoEmailExist == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedExceptExistingEmail'] = '<p class="semi-saved">' . sprintf(__('The email address you entered is already registered to a different user.%1$sThe email address was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedExceptExistingEmail'] = apply_filters('wppb_edit_profile_all_changes_saved_except_existing_email', $editProfileFilterArray['allChangesSavedExceptExistingEmail']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $changesSavedNoEmail == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedExceptInvalidEmail'] = '<p class="semi-saved">' . sprintf(__('The email address you entered is invalid.%1$sThe email address was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedExceptInvalidEmail'] = apply_filters('wppb_edit_profile_all_changes_saved_except_invalid_email', $editProfileFilterArray['allChangesSavedExceptInvalidEmail']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $changesSavedNoMatchingPass == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedMismatchedPass'] = '******' . sprintf(__('The passwords you entered do not match.%1$sThe password was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedMismatchedPass'] = apply_filters('wppb_edit_profile_all_changes_saved_except_mismatch_password', $editProfileFilterArray['allChangesSavedMismatchedPass']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $changesSavedNoPass == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedUncompletedPass'] = '******' . sprintf(__('You didn\'t complete both password fields.%1$sThe password was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedUncompletedPass'] = apply_filters('wppb_edit_profile_all_changes_saved_except_uncompleted_password', $editProfileFilterArray['allChangesSavedUncompletedPass']); $previousError = 'yes'; } elseif ($allRequiredCompleted == 'no') { $editProfileFilterArray['errorSavingChanges'] = '<p class="error">' . $errorMessage . '<br/>' . __('Your profile was NOT updated, since not all required fields were completed!', 'profilebuilder') . '</p><!-- .error -->'; echo $editProfileFilterArray['errorSavingChanges'] = apply_filters('wppb_edit_profile_error_saving_changes', $editProfileFilterArray['errorSavingChanges']); } $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { if ($changesSaved == 'yes' && $nrOfBadUploads > 0 && $previousError == 'no') { $lastOne = 0; $editProfileFilterArray['errorUploadingAttachments'] = ' <p class="semi-saved">' . __('There was an error while trying to upload the following attachments:', 'profilebuilder') . '<br/> <span class="error">'; foreach ($uploadName as $key => $name) { $lastOne++; $editProfileFilterArray['errorUploadingAttachments'] .= $name; if ($nrOfBadUploads - $lastOne > 0) { $editProfileFilterArray['errorUploadingAttachments'] .= ';<span style="padding-left:10px"></span>'; } } $editProfileFilterArray['errorUploadingAttachments'] .= '</span><br/>' . sprintf(__('Possible cause: the size was bigger than %1$sb. The listed attachements were %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA, '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['errorUploadingAttachments'] = apply_filters('wppb_edit_profile_error_uploading_attachments', $editProfileFilterArray['errorUploadingAttachments']); $previousError = 'yes'; } if ($changesSaved == 'yes' && $avatarUpload == 'no' && $previousError == 'no') { $editProfileFilterArray['errorUploadingAvatar'] = ' <p class="semi-saved">' . __('There was an error while trying to upload your avatar picture.', 'profilebuilder') . '<br/>' . __('Possible cause: size/incorrect file-type.', 'profilebuilder') . '<br/>' . __('The avatar was', 'profilebuilder') . ' <span class="error">' . __('NOT', 'profilebuilder') . '</span> ' . __('updated along with the rest of the information.', 'profilebuilder') . ' </p>'; echo $editProfileFilterArray['errorUploadingAvatar'] = apply_filters('wppb_edit_profile_error_uploading_avatar', $editProfileFilterArray['errorUploadingAvatar']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $nrOfBadExtUploads != 0 && $previousError == 'no') { $editProfileFilterArray['errorUploadingAttachmentExts'] = ' <p class="semi-saved">' . __('There was an error while trying to upload the following attachment(s)', 'profilebuilder') . ': <span class="error">'; foreach ($uploadExt as $key5 => $name5) { $lastOne++; $editProfileFilterArray['errorUploadingAttachmentExts'] .= $name5; if ($nrOfBadExtUploads - $lastOne > 0) { $editProfileFilterArray['errorUploadingAttachmentExts'] .= ';<span style="padding-left:10px"></span>'; } } $editProfileFilterArray['errorUploadingAttachmentExts'] .= '</span><br/>' . sprintf(__('Only files with the following extension(s) can be uploaded: %1$s<br/>This file was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<span class="error">' . $allowedExtensions . '</span>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['errorUploadingAttachmentExts'] = apply_filters('wppb_edit_profile_error_uploading_attachment', $editProfileFilterArray['errorUploadingAttachmentExts']); $previousError = 'yes'; } } /* use this action hook to add extra content before the edit profile form. */ do_action('wppb_before_edit_profile_fields'); ?> <form enctype="multipart/form-data" method="post" id="edituser" class="user-forms" action="<?php the_permalink(); ?> "> <?php echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE . '" /><!-- set the MAX_FILE_SIZE to the server\'s current max upload size in bytes -->'; $editProfileFilterArray2['contentName1'] = '<p class="nameHeader"><strong>' . __('Name', 'profilebuilder') . '</strong></p>'; $editProfileFilterArray2['contentName1'] = apply_filters('wppb_edit_profile_content_name1', $editProfileFilterArray2['contentName1']); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { if ($wppb_defaultOptions['email'] == 'show') { $editProfileFilterArray2['contentName2'] = ' <p class="email"> <label for="email">' . __('Email', 'profilebuilder') . '</label> <input class="text-input" name="email" type="text" id="email" value="' . get_the_author_meta('user_email', $current_user->id) . '" disabled="disabled"/> <span class="wppb-description-delimiter"> ' . __('The email cannot be changed.', 'profilebuilder') . '</span> </p><!-- .first_name -->'; $editProfileFilterArray2['contentName2'] = apply_filters('wppb_edit_profile_content_name2_with_email', $editProfileFilterArray2['contentName2'], $current_user->id); } } else { if ($wppb_defaultOptions['username'] == 'show') { $editProfileFilterArray2['contentName2'] = ' <p class="username"> <label for="user_login">' . __('Username', 'profilebuilder') . '</label> <input class="text-input" name="user_login" type="text" id="user_login" value="' . get_the_author_meta('user_login', $current_user->id) . '" disabled="disabled"/> <span class="wppb-description-delimiter"> ' . __('The usernames cannot be changed.', 'profilebuilder') . '</span> </p><!-- .first_name -->'; $editProfileFilterArray2['contentName2'] = apply_filters('wppb_edit_profile_content_name2', $editProfileFilterArray2['contentName2'], $current_user->id); } } if ($wppb_defaultOptions['firstname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['first_name'])) { if (trim($_POST['first_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentName3'] = ' <p class="first_name' . $errorVar . '"> <label for="first_name">' . __('First Name', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="first_name" type="text" id="first_name" value="' . get_the_author_meta('first_name', $current_user->id) . '" /> </p><!-- .first_name -->'; $editProfileFilterArray2['contentName3'] = apply_filters('wppb_edit_profile_content_name3', $editProfileFilterArray2['contentName3'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['lastname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['last_name'])) { if (trim($_POST['last_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentName4'] = ' <p class="last_name' . $errorVar . '"> <label for="last_name">' . __('Last Name', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="last_name" type="text" id="last_name" value="' . get_the_author_meta('last_name', $current_user->id) . '" /> </p><!-- .last_name -->'; $editProfileFilterArray2['contentName4'] = apply_filters('wppb_edit_profile_content_name4', $editProfileFilterArray2['contentName4'], $current_user->id); } if ($wppb_defaultOptions['nickname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['nickname'])) { if (trim($_POST['nickname']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentName5'] = ' <p class="nickname' . $errorVar . '"> <label for="nickname">' . __('Nickname', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="nickname" type="text" id="nickname" value="' . get_the_author_meta('nickname', $current_user->id) . '" /> </p><!-- .nickname -->'; $editProfileFilterArray2['contentName5'] = apply_filters('wppb_edit_profile_content_name5', $editProfileFilterArray2['contentName5'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['dispname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['dispnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['display_name'])) { if (trim($_POST['display_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['displayName'] = ' <p class="display_name' . $errorVar . '"> <label for="display_name">' . __('Display name publicly as', 'profilebuilder') . $errorMark . '</label> <select name="display_name" id="display_name">'; $public_display = array(); $public_display['display_username'] = get_the_author_meta('user_login', $current_user->id); $thisFirstName = get_the_author_meta('first_name', $current_user->id); if (!empty($thisFirstName)) { $public_display['display_firstname'] = get_the_author_meta('first_name', $current_user->id); } $thisLastName = get_the_author_meta('last_name', $current_user->id); if (!empty($thisLastName)) { $public_display['display_lastname'] = get_the_author_meta('last_name', $current_user->id); } $public_display['display_nickname'] = get_the_author_meta('nickname', $current_user->id); if (!empty($thisFirstName) && !empty($thisLastName)) { $public_display['display_firstlast'] = $thisFirstName . ' ' . $thisLastName; $public_display['display_lastfirst'] = $thisLastName . ' ' . $thisFirstName; } $thisDisplayName = get_the_author_meta('display_name', $current_user->id); if (!in_array($thisDisplayName, $public_display)) { // Only add this if it isn't duplicated elsewhere $public_display = array('display_displayname' => $thisDisplayName) + $public_display; } $public_display = array_map('trim', $public_display); foreach ($public_display as $id => $item) { $editProfileFilterArray2['displayName'] .= '<option id="' . $id . '" value="' . $item . '"'; if ($thisDisplayName == $item) { $editProfileFilterArray2['displayName'] .= ' selected'; } $editProfileFilterArray2['displayName'] .= '>' . $item . '</option>'; } $editProfileFilterArray2['displayName'] .= ' </select> </p><!-- .display_name -->'; $editProfileFilterArray2['displayName'] = apply_filters('wppb_edit_profile_display_name', $editProfileFilterArray2['displayName'], $current_user->id, $errorVar, $errorMark); } $editProfileFilterArray2['contentInfo1'] = '<p class="contactInfoHeader"><strong>' . __('Contact Info', 'profilebuilder') . '</strong></p>'; $editProfileFilterArray2['contentInfo1'] = apply_filters('wppb_edit_profile_content_info1', $editProfileFilterArray2['contentInfo1']); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { if ($wppb_defaultOptions['email'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['emailRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['email'])) { if (trim($_POST['email']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentInfo2'] = ' <p class="form-email' . $errorVar . '"> <label for="email">' . __('E-mail', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="email" type="text" id="email" value="' . get_the_author_meta('user_email', $current_user->id) . '" /> <span class="wppb-description-delimiter">' . __('(required)', 'profilebuilder') . '</span> </p><!-- .form-email -->'; $editProfileFilterArray2['contentInfo2'] = apply_filters('wppb_edit_profile_content_info2', $editProfileFilterArray2['contentInfo2'], $current_user->id, $errorVar, $errorMark); } } if ($wppb_defaultOptions['website'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['websiteRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['website']) && trim($_POST['website']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo3'] = ' <p class="form-website' . $errorVar . '"> <label for="website">' . __('Website', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="website" type="text" id="website" value="' . get_the_author_meta('user_url', $current_user->id) . '" /> </p><!-- .form-website -->'; $editProfileFilterArray2['contentInfo3'] = apply_filters('wppb_edit_profile_content_info3', $editProfileFilterArray2['contentInfo3'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['aim'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['aimRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['aim']) && trim($_POST['aim']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo4'] = ' <p class="form-aim' . $errorVar . '"> <label for="aim">' . __('AIM', 'profilebuilder') . '</label> <input class="text-input" name="aim" type="text" id="aim" value="' . get_the_author_meta('aim', $current_user->id) . '" /> </p><!-- .form-aim -->'; $editProfileFilterArray2['contentInfo4'] = apply_filters('wppb_edit_profile_content_info4', $editProfileFilterArray2['contentInfo4'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['yahoo'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['yahooRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['yim']) && trim($_POST['yim']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo5'] = ' <p class="form-yim' . $errorVar . '"> <label for="yim">' . __('Yahoo IM', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="yim" type="text" id="yim" value="' . get_the_author_meta('yim', $current_user->id) . '" /> </p><!-- .form-yim -->'; $editProfileFilterArray2['contentInfo5'] = apply_filters('wppb_edit_profile_content_info5', $editProfileFilterArray2['contentInfo5'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['jabber'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['jabberRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['jabber']) && trim($_POST['jabber']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo6'] = ' <p class="form-jabber' . $errorVar . '"> <label for="jabber">' . __('Jabber / Google Talk', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="jabber" type="text" id="jabber" value="' . get_the_author_meta('jabber', $current_user->id) . '" /> </p><!-- .form-jabber -->'; $editProfileFilterArray2['contentInfo6'] = apply_filters('wppb_edit_profile_content_info6', $editProfileFilterArray2['contentInfo6'], $current_user->id, $errorVar, $errorMark); } $editProfileFilterArray2['aboutYourself1'] = '<p class="aboutYourselfHeader"><strong>' . __('About Yourself', 'profilebuilder') . '</strong></p>'; $editProfileFilterArray2['aboutYourself1'] = apply_filters('wppb_edit_profile_content_about_yourself1', $editProfileFilterArray2['aboutYourself1']); if ($wppb_defaultOptions['bio'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['bioRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['description']) && trim($_POST['description']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['aboutYourself2'] = ' <p class="form-description' . $errorVar . '"> <label for="description">' . __('Biographical Info', 'profilebuilder') . $errorMark . '</label> <textarea class="text-input" name="description" id="description" rows="5" cols="30">' . get_the_author_meta('description', $current_user->id) . '</textarea> </p><!-- .form-description -->'; $editProfileFilterArray2['aboutYourself2'] = apply_filters('wppb_edit_profile_content_about_yourself2', $editProfileFilterArray2['aboutYourself2'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['password'] == 'show') { $editProfileFilterArray2['aboutYourself3'] = ' <p class="form-password"> <label for="pass1">' . __('New Password', 'profilebuilder') . '</label> <input class="text-input" name="pass1" type="password" id="pass1" /> </p><!-- .form-password --> <p class="form-password' . $errorVar . '"> <label for="pass2">' . __('Repeat Password', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="pass2" type="password" id="pass2" /> </p><!-- .form-password -->'; $editProfileFilterArray2['aboutYourself3'] = apply_filters('wppb_edit_profile_content_about_yourself3', $editProfileFilterArray2['aboutYourself3'], $errorVar, $errorMark); } echo get_wp_user_avatar($current_user->id, 96); $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { require_once $wppb_premium . 'extra.fields.php'; $page = 'edit_profile'; $returnedValue = wppb_extra_fields($current_user->id, $extraFieldsErrorHolder, $editProfileFilterArray2, $page, $error, $_POST); //copy over extra fields to the rest of the fieldso on the edit profile foreach ($returnedValue as $key => $value) { $editProfileFilterArray2[$key] = apply_filters('wppb_edit_profile_content_' . $key, $value, $returnedValue, $key); } } /* additional filter, just in case it is needed */ $editProfileFilterArray2['extraEditProfileFilter'] = ''; $editProfileFilterArray2['extraEditProfileFilter'] = apply_filters('extraEditProfileFilter', $editProfileFilterArray2['extraEditProfileFilter']); /* END additional filter, just in case it is needed */ $editProfileFilterArray2 = apply_filters('wppb_edit_profile', $editProfileFilterArray2); foreach ($editProfileFilterArray2 as $key => $value) { echo $value; } ?> <p class="form-submit"> <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profilebuilder'); ?> " /> <?php // wp_nonce_field( 'update-user' ) ?> <input name="action" type="hidden" id="action" value="update-user" /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_edit_user', 'edit_nonce_field'); ?> </form><!-- #edituser --> <?php //use this action hook to add extra content after the edit profile form. do_action('wppb_after_edit_profile_fields'); } ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
function qb_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; //$avatar = get_avatar( $comment, 48 ); $comment_author_id = get_comment(get_comment_ID())->user_id; $comment_author_url = get_comment_author_url(); if (has_wp_user_avatar($comment_author_id)) { //$avatar = get_wp_user_avatar_src( $comment_author_id, 48 ); $avatar = get_wp_user_avatar($comment_author_id, 48); } else { //$avatar = get_bloginfo( 'template_url' ) . '/images/default/48.png'; // temporary: this is the same for now, for testing; eventually, it should fall back to default image or Facebook image or smt else //$avatar = get_wp_user_avatar_src( $comment_author_id, 48 ); $avatar = get_wp_user_avatar($comment_author_id, 48); } ?> <li <?php get_comment_class(); ?> ><?php if ($comment_author_url) { echo '<a href="' . $comment_author_url . '">' . $avatar . get_comment_author() . '</a>'; } else { echo $avatar . get_comment_author(); } echo '<time class="timeago" datetime="' . get_comment_date('c') . '">' . get_comment_date('F j, Y') . '</time>'; comment_text(); //edit_comment_link( 'Edit', '<span class="edit">', '</span>' ); if ($comment->comment_approved == '0') { echo '<em class="moderate">Your comment is awaiting moderation.</em>'; } /*comment_reply_link( array_merge( $args, array( 'reply_text' => 'Reply', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) );*/ echo '</li>'; }
function first_face() { $outputs = ''; $outputs .= '<h1><a href="' . get_the_permalink(88) . '">Від першої особи</a></h1>'; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('cat=9 ' . '&showposts=2'); $outputs .= '<ul class="interview">'; while ($wp_query->have_posts()) { $wp_query->the_post(); $outputs .= '<li class="single-news">'; $outputs .= '<div class="time">' . get_wp_user_avatar($authordata->ID, 72, "left") . '</div>'; $author = get_the_author(); $user_description = get_the_title(); $outputs .= '<h2><a href="' . get_permalink() . '">' . $author . '</a></h2>'; $outputs .= '<h4><a href="' . get_permalink() . '">' . $user_description . '</a></h4>'; $outputs .= '</li>'; } $outputs .= '</ul>'; echo $outputs; return $outputs; }