function generateNerdGallery()
{
    global $wp_query;
    if (isset($wp_query->query_vars[NN_BOSS_Q_VAR])) {
        $soughtBoss = $wp_query->query_vars[NN_BOSS_Q_VAR];
    }
    $content = '<div id="nerd-gallery">';
    /**
     * Add chris manually
     */
    $content .= userphoto__get_userphoto(6, USERPHOTO_FULL_SIZE, "<div class='nerdpic' >", "<div class='nerd-caption'>Chris Balakrishnan<br/>Nerd Nite Founder</div></div>", "", "");
    $wp_user_search = new WP_User_Query(array('role' => 'City_Boss'));
    $bosses = $wp_user_search->get_results();
    foreach ($bosses as $boss) {
        $cities = get_blogs_of_user($boss->ID);
        $city = null;
        foreach ($cities as $cityObject) {
            if ($cityObject->userblog_id == 1) {
                continue;
            } else {
                $cityName = getCityName($cityObject);
                if (!isHiddenCity($cityObject)) {
                    if (isset($city)) {
                        $city = "{$city} & {$cityName}";
                    } else {
                        $city = $cityName;
                    }
                }
            }
        }
        $boss_name = isset($boss->display_name) ? $boss->display_name : $boss->user_login;
        $user_photo = userphoto__get_userphoto($boss->ID, USERPHOTO_FULL_SIZE, "<div class='nerdpic' >", "<div class='nerd-caption'>{$boss_name}<br/>Nerd Nite {$city} Boss</div></div>", "", "");
        $content .= $user_photo;
    }
    /**
     * Add dan manually
     */
    $content .= userphoto__get_userphoto(9, USERPHOTO_FULL_SIZE, "<div class='nerdpic' >", "<div class='nerd-caption'>Dan Rumney<br/> Webmaster and Podcaster</div></div>", "", "");
    $content .= '</div>';
    return $content;
}
Example #2
0
function userphoto_thumbnail($user, $before = '', $after = '', $attributes = array(), $default_src = '')
{
    if (is_numeric($user)) {
        $userid = intval($user);
    } else {
        if (is_object($user) && @$user->ID) {
            $userid = $user->ID;
        } else {
            if (is_string($user)) {
                $user = get_userdatabylogin($user);
                if (!$user) {
                    return;
                }
                $userid = $user->ID;
            } else {
                return;
            }
        }
    }
    echo userphoto__get_userphoto($userid, USERPHOTO_THUMBNAIL_SIZE, $before, $after, $attributes, $default_src);
}
Example #3
0
function pf_output_single($id)
{
    $vars = pf_get_vars($id);
    $grav_size = get_option('pf_gravatar_size');
    $recent_posts = pf_recent_posts($id, get_option('pf_recent_posts_per_profile'));
    $recent_comments = pf_recent_comments($id, get_option('pf_recent_comments_per_profile'));
    //variables based on the results of pf_get_vars
    foreach ($vars as $key => $value) {
        //if the variable is a string, we need to convert any HTML tags to HTML entities
        //to protect from XSS
        if (is_string($value)) {
            ${$key} = htmlspecialchars($value);
        } else {
            ${$key} = $value;
        }
    }
    $output = "<h3>Profile</h3>";
    if (get_option('pf_show_gravatars') == 'yes') {
        if (function_exists('get_avatar')) {
            $output .= "<p>" . get_avatar($id, $grav_size) . "</p>";
        } else {
            $grav_url = "http://www.gravatar.com/avatar/" . md5($user_email) . "?s=" . $grav_size . "&d=http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536" . "?s=" . $grav_size;
            $output .= "<p><img src='{$grav_url}'/></p>";
        }
    }
    if (get_option('pf_show_userphotos') == 'yes') {
        if (function_exists('userphoto_the_author_photo')) {
            if (get_option('pf_show_userphotos_type') == '1') {
                $userphototype = USERPHOTO_FULL_SIZE;
            } else {
                $userphototype = USERPHOTO_THUMBNAIL_SIZE;
            }
            $output .= "<p>" . userphoto__get_userphoto($id, $userphototype, "", "", array(), "") . "</p>";
        }
    }
    $output .= "<p>{$display_name}</p>";
    if (get_option('pf_show_emails') == 'yes') {
        $output .= "<p>Email:  <a href=" . "mailto:" . $user_email . ">" . antispambot($user_email) . "</a></p>";
    }
    if ($user_url != '' && $user_url != 'http://') {
        $output .= "<p>Website:  <a href=" . $user_url . " rel=\"nofollow\">{$user_url}</a></p>";
    }
    $output .= "<p>Join date:  " . pf_format_datetime($user_registered) . "</p>";
    if ($user_description != '') {
        $output .= "<h3>About Me</h3>";
        $output .= "<p>{$user_description}</p>";
    }
    //display an author's recent posts, if any
    if (get_option('pf_recent_posts_per_profile') > 0 && !empty($recent_posts)) {
        $output .= "<h3>Recent Posts</h3>";
    }
    foreach ($recent_posts as $key => $post) {
        $output .= "<a href=" . get_permalink($post->ID) . ">" . $post->post_title . "</a><br />";
    }
    //display an author's recent comments, if any
    if (get_option('pf_recent_comments_per_profile') > 0 && !empty($recent_comments)) {
        $output .= "<h3>Recent Comments</h3>";
    }
    foreach ($recent_comments as $key => $comment) {
        $output .= "<a href=" . get_permalink($comment->comment_post_ID) . "#comment-" . $comment->comment_ID . ">" . get_the_title($comment->comment_post_ID) . "</a><br />";
        $output .= '<div style="font-size: 11px;font-style: italic;width: 75%; ">' . $comment->comment_content . '</div>';
    }
    echo pf_backlink();
    echo '<div class="pfprofile">';
    echo $output;
    echo '</div>';
    pf_insert_pagination_single();
}
Example #4
0
function display_user()
{
    global $post;
    if (isset($_GET['uid'])) {
        $uid = $_GET['uid'];
        $curauth = get_userdata($uid);
    }
    if ($curauth) {
        $recent_posts = get_posts(array('numberposts' => 10, 'author' => $curauth->ID));
        $recent_comments = wpu_recent_comments($uid);
        $created = date("F jS, Y", strtotime($curauth->user_registered));
        $html = "<p><a href=" . get_permalink($post->ID) . ">&laquo; Back to " . get_the_title($post->ID) . " page</a></p>\n";
        $html .= "<h2>{$curauth->display_name}</h2>\n";
        if (get_option('wpu_image_profile')) {
            if (get_option('wpu_avatars') == "gravatars") {
                $html .= "<p><a href=\"http://en.gravatar.com/\" title=\"Get your own avatar.\">" . get_avatar($curauth->user_email, '96', $gravatar) . "</a></p>\n";
            } elseif (get_option('wpu_avatars') == "userphoto") {
                if (function_exists('userphoto_the_author_photo')) {
                    $html .= "<p>" . userphoto__get_userphoto($curauth->ID, USERPHOTO_FULL_SIZE, "", "", array(), "") . "</p>\n";
                }
            }
        }
        if ($curauth->user_url && $curauth->user_url != "http://") {
            $html .= "<p><strong>Website:</strong> <a href=\"{$curauth->user_url}\" rel=\"nofollow\">{$curauth->user_url}</a></p>\n";
        }
        $html .= "<p><strong>Joined on:</strong>  " . $created . "</p>";
        if (get_option('wpu_description_profile')) {
            $description = $curauth->description;
            if ($curauth->description) {
                $description = preg_replace('/\\r|\\n/', '<br/>', $description);
                $html .= "<p><strong>Profile:</strong></p>\n";
                $html .= "<p>{$description}</p>\n";
            }
        }
        if ($recent_posts) {
            $html .= "<h3>Recent Posts by {$curauth->display_name}</h3>\n";
            $html .= "<ul>\n";
            foreach ($recent_posts as $post) {
                setup_postdata($post);
                $html .= "<li><a href=" . get_permalink($post->ID) . ">" . $post->post_title . "</a></li>";
            }
            $html .= "</ul>\n";
        }
        wp_reset_query();
        if ($recent_comments) {
            $html .= "<h3>Recent Comments by {$curauth->display_name}</h3>\n";
            $html .= "<ul>\n";
            foreach ($recent_comments as $key => $comment) {
                $html .= "<li>\"" . $comment->comment_content . "\" on <a href=" . get_permalink($comment->comment_post_ID) . "#comment-" . $comment->comment_ID . ">" . get_the_title($comment->comment_post_ID) . "</a></li>";
            }
            $html .= "</ul>\n";
        }
        echo "<div id=\"wpu-profile\">\r\n\t\t";
        echo $html;
        echo "</div>\r\n\t\t";
    }
}