• I have a user page at my site showing nice name and avatar. After 1 week there is already 400 users at the site, and the users page is getting slow to load. How can I paginate the page? Below is the code I use to display the authors:

    <?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="authorpost overview">
                            <a class="authorimage" href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>">
                                <?php echo get_avatar($curauth->user_email, '40'); ?>
                            </a>
                            <?php echo $user_registered ?>
                            <a class="title" href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?></a><br />
    
                        </div>
    					<?php endif; ?>
    					<?php endforeach; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Paging page with users’ is closed to new replies.