• Resolved psn

    (@psn)


    Hi

    When we debug our site we notice a small bug in your plugin, in file authors.php line 66 you have code for users ID and you have put in “id” instead of “ID” which gives an error when sorting on ID is used in widget.

    Per

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author flocsy

    (@flocsy)

    can you try to pass ‘id’ instead of ‘ID’ ?

    Thread Starter psn

    (@psn)

    Yes already done and then no error occours ??

    Thread Starter psn

    (@psn)

    Hi, I assume you will soon deploy a new release with above fix and if you also can retest both against latest WP and PHP version would be great!

    Per

    Plugin Author flocsy

    (@flocsy)

    @psn, I don’t think that’s being passed from my code. If I misunderstand or miss something, then please send here the patch or describe in words what did you have to change to fix it (which line, in which function, from what to what)

    Thread Starter psn

    (@psn)

    I wrote all that in my first post above:
    In authors.php file line 66 change id to ID

    Per

    Plugin Author flocsy

    (@flocsy)

    strange. Can you add this line:

    echo “ORDERBY: ${orderby};”

    before line #56? (just before the switch) and let me know what it prints above the widget? For me it prints ‘id’, not ‘ID’

    Thread Starter psn

    (@psn)

    Hi

    Yes we also got “id” when we echo your code above but we don’t get the correct order of users “ID” if we chose to order by “ID” and more when we debug code we get this NOTICE when we use “id” and not ID:

    [10-Nov-2017 22:17:11 Europe/Stockholm] PHP Notice: Use of undefined constant widget_authors_sort_by_id – assumed ‘widget_authors_sort_by_id’ in /customers/a/d/b/mesas.se/httpd.www/wp-content/plugins/authors/authors.php on line 66

    Thread Starter psn

    (@psn)

    Also if you look at row 25 in authors.php file you have:

    `function widget_authors_sort_by_id($a, $b) {
    return 0 + $a->ID – $b->ID;
    }`
    Dont know if this can confuse the widget and the error we see??

    Plugin Author flocsy

    (@flocsy)

    No, actually line 25 should be the reason it should work.
    What php version do you have?

    What you can try is to change line 66 to this (added ‘ before and after the function name):

    usort($authors, 'widget_authors_sort_by_id');

    Thread Starter psn

    (@psn)

    Hi

    We run php version 7.1.10, will try to add mentioned code later this evening.

    Thread Starter psn

    (@psn)

    When checking the order if we use ID as sort function we get actually correct order but if we use “id” instead of “ID” we then get the php notice. Not big deal as we don’t use that ORDER in our widget-area. We use number of post and that works fine regardless of ID or id.

    Don’t know if thsi part is connected to which PHP we use!

    Anyway I think we can close this case by now!

    Per

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Small bug’ is closed to new replies.