WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Default listing orderby

[Resolved] Default listing orderby

  • terjemar
    Member

    @terjemar

    I read in the user manual that one can use:
    [weblib_searchform]
    [weblib_itemlist holdbutton=1 inlinemoreinfo=1]

    to list a search form and the items in the library. The items appear in the default sort order, which is by barcode. I would like to change the default sort order to author. I saw the weblib_orderby option, and I tried putting weblib_orderby=author in the weblib-searchform entry and in the weblib_itemlist entry, but it doesn’t change anything. I still get my items in barcode order. Please help.

    LCS Lending Library

    Thank you,
    -S

    http://wordpress.org/plugins/weblibrarian/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Robert Heller
    Participant

    @robertpheller

    It is current not possible to change the default search order.

    terjemar
    Member

    @terjemar

    OK. Thanks. I went looking and found the bit of code in short_codes.php that determines the default search order and changed it manually. I understand that the change will go away once I update the plugin. Hopefully you’ll include a way to change the default search order in an upcoming release.

    Thank you.
    -S

    terjemar,

    Lines 28 – 31?

    $searchby  = isset($_REQUEST['searchby'])  ? $_REQUEST['searchby']  : 'title';
        $searchbox = isset($_REQUEST['searchbox']) ? $_REQUEST['searchbox'] : '';
        $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'barcode';
        if ( empty( $weblib_orderby ) ) $weblib_orderby = 'barcode';
        $weblib_order = isset( $_REQUEST['weblib_order'] ) ? $_REQUEST['weblib_order'] : 'ASC';
        if ( empty( $weblib_order ) ) $weblib_order = 'ASC';

    to this?

    $searchby  = isset($_REQUEST['searchby'])  ? $_REQUEST['searchby']  : 'title';
        $searchbox = isset($_REQUEST['searchbox']) ? $_REQUEST['searchbox'] : '';
        $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'title';
        if ( empty( $weblib_orderby ) ) $weblib_orderby = 'title';
        $weblib_order = isset( $_REQUEST['weblib_order'] ) ? $_REQUEST['weblib_order'] : 'ASC';
        if ( empty( $weblib_order ) ) $weblib_order = 'ASC';

    Lines 102-107

    $searchby = isset($_REQUEST['searchby']) ? $_REQUEST['searchby'] : 'title';
    $searchbox = isset($_REQUEST['searchbox']) ? $_REQUEST['searchbox'] : '';
    $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'barcode';
    if ( empty( $weblib_orderby ) ) $weblib_orderby = 'barcode';
    $weblib_order = isset( $_REQUEST['weblib_order'] ) ? $_REQUEST['weblib_order'] : 'ASC';
    if ( empty( $weblib_order ) ) $weblib_order = 'ASC';

    Specifically, change lines 104 and 105 to:

    $weblib_orderby = isset( $_REQUEST['weblib_orderby'] ) ? $_REQUEST['weblib_orderby'] : 'author, title';
    if ( empty( $weblib_orderby ) ) $weblib_orderby = 'author, title';

    mysql allows for multiple fields when sorting, so whichever field or fields that you want to sort by need to be specified and delimited by commas.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Default listing orderby’ is closed to new replies.