• I’m desperately trying to figure out why the User Photo plugin isn’t working.

    I’m creating a page of profiles (similar to a page of posts). I’m using the User Photo plugin to call my user profile pictures. Here’s my code, thus far:

    <?php get_header(); ?>
    <div id="inside-content"><?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <h2 id="inside-h2" class="chunk orange"><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>
    
    <div id="ap-content">
    <?php
    // Get the authors from the database ordered by user nicename
    global $wpdb;
    $query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename";
    $author_ids = $wpdb->get_results($query);
    // Loop through each author
    foreach($author_ids as $author) :
    // Get user data
    $curauth = get_userdata($author->ID);
    // If user level is above 0 or login name is "admin", display profile
    if($curauth->user_level > 0 || $curauth->user_login == 'admin') :
    // Get link to author page
    $user_link = get_author_posts_url($curauth->ID);
    // Set default avatar (values = default, wavatar, identicon, monsterid)
    $avatar = 'wavatar';
    ?>
        <div class="project">
            <h3 class="project-title chunk"><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?></a></h3>
            <h4 class="orange chunk"><?php echo $curauth->subtitle; ?></h4>
            <a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>" target="_self"><?php userphoto_the_author_photo(); ?></a>
        </div>
    
    <?php endif; ?>
    <?php endforeach; ?>
    <div class="clear"></div></div><!-- end #ap-content -->
    
    <div class="clear"></div></div><!--- INSIDE-PAGE -->
    <div class="clear"></div></div><!-- CONTENT -->
    <div class="clear"></div></div><!-- MAIN -->
    <?php get_footer(); ?>

    I can’t get the User Photo plugin to call multiple, different users’ photos. Currently it’s just calling in the user’s photo who created the page (me).

    Thoughts? Help? (Preemptive) thanks!

    PS. I don’t know if this is appropriate, but I’m willing to pay for the help (paypal).

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter hoss9009

    (@hoss9009)

    Sorry… also, am I calling in the authors correctly?

    Thread Starter hoss9009

    (@hoss9009)

    Sorry… one more thing… I would like pagination on this… am I anywhere close to getting that too?

    Thread Starter hoss9009

    (@hoss9009)

    $ for anyone who can fix this… (via paypal)

    Try changing :
    $author_ids = $wpdb->get_results($query);

    to

    $author_ids = $wpdb->get_results($query, ARRAY_A);

    $wpdb->get_results returns an object by default.

    Thread Starter hoss9009

    (@hoss9009)

    Hmmm… The users (all together) went away.
    Here’s my page.
    Other ideas?
    I just can’t figure out how to get the plugin to pull each individual user’s profile pic.

    Forget the Array_A thing, my mistake. I shouldn’t work on 3 things at the same time lol.

    How many users do you have? I see two pictures on the page.

    Try passing the author id into the userphoto_the_author_photo() function like this:

    userphoto_the_author_photo(authorId);

    Thread Starter hoss9009

    (@hoss9009)

    Sorry @rfair, when I use your code, it throws a link above the pictures saying “authorId” w/ a link to the author.php of that user.
    @petervanderdoes 2 users… the pic you see is the admin pic (user on the left).

    Add after this line:

    if($curauth->user_level > 0 || $curauth->user_login == 'admin') :
    global $authordata;
    $authordata=$curauth;

    or a bit nicer solution as I personally loath globals 🙂
    change

    <a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>" target="_self"><?php userphoto_the_author_photo(); ?></a>

    to

    <a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>" target="_self"><?php echo  userphoto__get_userphoto($curauth->ID, 1, '', '', '', ''); ?></a>
    Thread Starter hoss9009

    (@hoss9009)

    Any idea how to limit the number of users on the page to 5 and then paginate it?

    Thread Starter hoss9009

    (@hoss9009)

    @petervanderdoes I’ll give it a whirl

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Page of Authors Problem’ is closed to new replies.