Forum Replies Created

Viewing 4 replies - 91 through 94 (of 94 total)
  • Thread Starter Richard-B

    (@richard-b)

    bump bump ??

    Forum: Fixing WordPress
    In reply to: showing user list

    Hiya
    This maybe a bit late to help you but this is very similar to what you are doing and works fine even when pulling in data from the usermeta, it even gets data from the register plus plugin.

    I use the code below to pull in the users company name and city. the only problem with it is that it is supposed to order the user list by the company name in ASC alphabetical order but it dosent ?? its probably something really simple im missing (if anyone can help would be very happy), but if you need to use it it will order the list by user name or anything standard

    <?php $szSort = 'company_name';?>
    
    <?php $aUsersID = $wpdb->get_col( $wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC", $szSort ));
    
    foreach ( $aUsersID as $iUserID ) :
    
    $user = get_userdata( $iUserID );
    
    ?>
    <?php if($user->wp_user_level == 2) { ?>
    
    <a href="<?php bloginfo('siteurl'); ?>/author/<?php echo ucwords( ( $user->user_login ) ); ?>"> <?php echo '<li>' . ucwords( ( $user->company_name ) ) . ' - '; ?></a> <?php echo '' . ucwords( ( $user->city ) ) . '</li>';
    }
    endforeach; // end the users loop.
    ?>
    Thread Starter Richard-B

    (@richard-b)

    Bump, please let me know if this is in the wrong section! Still stuck

    Thanks from me also, saved me so much time!

    NOTE* if you just want to include one category, get rid of the minus sign before the 1000 and replace 1000 with the number of the cat you want to use ??

Viewing 4 replies - 91 through 94 (of 94 total)