Support » Plugins » Ordering in Kaf’s all authors template

  • Hi, im using Kaf’s all authors template ( to display a list of the users on the site and it works almost perfectly. The one thing i cant figured out is how i can order the users the way i want it.

        global $wpdb, $table_prefix; // set global WP vars needed for script
        $order = 'user_nicename'; // set order for users table query
        $user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY $order"); // query users
        foreach($user_ids as $user_id) : // start authors' profile "loop"
        $user = get_userdata($user_id); // retrieve author (i.e. user) details
        $level = $table_prefix . 'user_level'; // set 'user_level' usermeta meta_key record
        $user->user_level = $user->$level; // assign 'user_level' property to $users
        $role = $table_prefix . 'capabilities'; // set 'role' usermeta table meta_key record
        $user->role = array_keys($user->$role); // assign 'role' property to $user
        $user->role = $user->role[0]; // make sure $user->role is not an array

    Now its order by user_nicename, what i want is a specific ordering. So i created a extra user field with the Cimy User Extra Fields plugin (

    I gave every user a special number by creating a Order field. But i cant get the all authors template to sort after those numbers.

    I tried something like this:
    $order = get_cimyFieldValue($user_id, 'ORDER');

    which gives me:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
    Warning: Invalid argument supplied for foreach() in /hsphere/local/home/tohin406/ on line 20

    im a php newbie so this error dont help me much. Anybody out there who can help?

    Kindly Regards,

  • The topic ‘Ordering in Kaf’s all authors template’ is closed to new replies.