Support » Plugin: amr users » su Querystring Value

  • In a previous version of the user list plugin, if I did a search for a user, it would add that search term to the current pages querystring. I was then able to user this piece of the referrer URL to redirect back to the filtered list. Are you able to add this back in? The only way the SU querystring appears is if I sort the user list after doing a search.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author anmari

    (@anmari)

    Hi
    At a quick look here (I’m not at my pc)
    http://directories.wpusersplugin.com/simple-user-list/?su=test
    The query URL still works.
    Looks like the form action may be a ‘POST’ rather than a ‘GET’
    I know some sites had oddities with the REQUEST variable (supposed to hold both GET and POST), so it maybe a change a while back around that.

    For quick fix, You can of course try – have your own little search form with a GET action before the shortcode.

    • This reply was modified 3 months, 1 week ago by anmari.

    Thanks for the quick reply as always. The su querystring still works. What I was referring to is if I do a search. So go to this page and then enter a search filter: http://directories.wpusersplugin.com/simple-user-list/

    You’ll see that after you hit submit button the search filter doesn’t get added in the pages URL. So it’s doing a post request like you said. It would be great if that could be a GET request instead. I think it was that way before, but then it changed.

    Plugin Author anmari

    (@anmari)

    Hi Martin,

    Sorry but I’m struggling to understand exactly the use case you describe.

    You say “referrer URL to redirect back to the filtered list”

    I understand this to mean someone clicks on one of the search results, which may take them to another page or another view of the data.
    You want to offer the user a link on that second page or view to return them to the search results. Basically a back button? there are other ways to create a back link or button.

    Am I missing something?

    In thinking about this – using a GET on the form will put all the form variables in the url – some people have complex filtering and this can look messy, so at moment I am disinclined, unless more people request it as necessary and even then might rather have it as not the default.

    I use this on a form when I’m editing a users record. So someone clicks on a user record and they go to an edit form. Then on the edit form I store the querystring from the user list page so on success, I can redirect them back to the filtered search.

    Now, if I’m on the user list page and I do a search, the su parameter isn’t added to the pages url. Now if I click a column heading after doing the initial search the ‘su’ parameter then shows up in the querystring of the page. So it almost works, it’s just missing the parameter getting added during the first query.

    Plugin Author anmari

    (@anmari)

    Sounds like you must be doing this programmatically?
    The su variable should still be in the $_POST variable ?
    Then you just use https://developer.wordpress.org/reference/functions/add_query_arg/

    something like:
    if (!empty( $_POST[‘su’]))
    $return_url = add_query_arg( ‘su’, $_POST[‘su’], $referrer_url );

    and redirect to the return url (possibly escaped just to be safe)

    Plugin Author anmari

    (@anmari)

    Urg! Of course the saving of the variable has to be when you build the link to your edit form – pass the ‘su’ along in that link. And then you have it in the edit form and use it to build the return URL

    Yep, that would work. Am I able to do that within’ the admin somewhere? Or is there a custom hook I need to use?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.