• cpatience

    (@cpatience)


    I am trying to create a list of authors that can have the disply order customized.

    I started off by adding a custom usermeta data to the profile using:

    // Set Order
    add_action( 'show_user_profile', 'include_user' );
    add_action( 'edit_user_profile', 'include_user' );
    
    function include_user( $user ) {
    $order = get_the_author_meta ( 'showorder', $user->ID);
    <h3>Display Order</h3>
    Type in the position this author should be listed:
    <input type="text" name="showorder" value="<?php echo esc_attr( get_the_author_meta( 'showorder', $user->ID ) ); ?>" class="regular-text" />
    <? }
    
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    
    function my_save_extra_profile_fields( $user_id ) {
    	if ( !current_user_can( 'edit_user', $user_id ) )
    		return false;
    update_usermeta( $user_id, 'showorder', $_POST['showorder'] );
    }

    I’m using the following code to grab the registered users:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Is it possible to sort the $authors[] array based on the ‘showorder’ usermeta?

    Thanks much.

Viewing 1 replies (of 1 total)
  • cpatients,
    I’m having the same question. Were you able to resolve it? How? Can anyone else offer suggestion to newbie?
    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Author List Order?’ is closed to new replies.