Support » Plugin: Simple User Listing » Shortcode in post

  • Hi!

    I’m using the Ultimate Member plugin and tried to use your plugin in one of the tabs. The users are being displayed, but when I try to search for a user, it redirects me to the standart tab. I think the tabs might be saved as posts themselves, maybe that is a problem? The url of the tab goes like this:
    http://192.168.100.88/hp1/user/erikamuster/?profiletab=staffoverviewtab
    When I search for somebody, it redirects me to something like this:
    http://192.168.100.88/hp1/user/erikamuster/?as=erik

    Do you have an idea how to fix that? Maybe change the
    $search = ( get_query_var( 'as' ) ) ? get_query_var( 'as' ) : '';
    or the
    <form method="get" id="sul-searchform" action="<?php the_permalink() ?>"> line in the search-author.php file? The permalink is http://192.168.100.88/hp1/user/

    Tanks in advance!

    • This topic was modified 2 years, 5 months ago by dunrar.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author helgatheviking

    (@helgatheviking)

    I don’t know anything about the Ultimate Member plugin. But, if http://192.168.100.88/hp1/user/erikamuster is the page you are on then that’s the_permalink(). Looking at it now, I’m not sure it needs to have an action. You could try overriding the search-author.php template in your theme (see the FAQ) and removing the action.

    
    <form method="get" id="sul-searchform" action="">
    

    Let me know if that works as I should probably adjust the plugin. If that doesn’t work, you could also try manually setting the URL you need.

    
    <form method="get" id="sul-searchform" action="http://192.168.100.88/hp1/user/">
    

    I hope that helps!

    I tried both but still got redirected to the standart tab (which is being displayed if you open the user page)
    http://192.168.100.88/hp1/user/erikamuster/?as=erik
    instead of
    http://192.168.100.88/hp1/user/erikamuster/?profiletab=staffoverviewtab/?as=erik
    or something similar.
    When I print out the_permalink() on the staffoverviewtab, I get
    http://192.168.100.88/hp1/user/ not
    http://192.168.100.88/hp1/user/erikamuster/?profiletab=staffoverviewtab
    I also tried
    <form method="get" id="sul-searchform" action="?profiletab=taskoverviewtab/">
    but still got redirected. Same thing if I use the pagination to go to the next page.
    When I make staffoverviewtab my standart tab, an empty action does work though.

    • This reply was modified 2 years, 5 months ago by dunrar.
    • This reply was modified 2 years, 5 months ago by dunrar.
    • This reply was modified 2 years, 5 months ago by dunrar.
    • This reply was modified 2 years, 5 months ago by dunrar.
    • This reply was modified 2 years, 5 months ago by dunrar.
    Plugin Author helgatheviking

    (@helgatheviking)

    When I make staffoverviewtab my standart tab, an empty action does work though.

    I kind of think the action should always be blank. Not sure when I’ll get to test that out, but it might be a good change for a future version. the_permalink() is too restrictive as a URL and will always delete any custom URL args.

    Pretty much the exact same issue with pagination, see get_previous_users_url() and get_next_users_url()

    Plugin Author helgatheviking

    (@helgatheviking)

    You may need to add some allowed search variables via the sul_user_allowed_search_vars filter. Otherwise, the params get removed. I wrote this a few years ago now, and I don’t really know how necessary it is to limit the vars in the way that I am. Like, so what if they are there?

    This may help with the search redirection. It may not, I’m not sure yet.

    
    function helga_add_allowed_search_var( $vars ) {
    	$vars[] = 'profiletab';
    	return $vars;
    }
    add_filter( 'sul_user_allowed_search_vars', 'helga_add_allowed_search_var' );
    

    Okay, I see. Still, adding allowed search variables did not help me so far. Just pasted your code into the search-author.php, but still got redirected. Any other ideas for allowed search variables? Or in general?

    Thanks in advance!

    Plugin Author helgatheviking

    (@helgatheviking)

    I looked at this today and I think that it is the nature of the GET type of form being used. A GET type form will encode all the inputs into the URL. By default, only the as parameter is an input in the form. Therefore the submit result is always http://192.168.100.88/hp1/user/erikamuster/?as=erik until you add more inputs.

    So I *think* you would need to pass a hidden parameter in the form such as

    <input type="hidden" name="profiletab" value="staffoverviewtab"/>

    to have the resulting URL be http://192.168.100.88/hp1/user/erikamuster/?profiletab=staffoverviewtab/?as=erik

    You may need to use PHP to dynamically set that value, I don’t know how the Members tabs work.

    Then please give my Dev version of the plugin a try:
    https://github.com/helgatheviking/simple-user-listing/tree/dev

    I am hoping that fixes the next/prev links. If you could test it on multisite that would be huge, but even testing on a single install will help.

    Okay, that was it! Thank you very much! Sadly I can try it only on one site, but i’ve tried it with different tabs and it worked. I’ll probably use PHP to set the value of the parameter automatically once I’ve figured out how to get the name of the tab. Haven’t yet hade the chance to try the Dev version or to fix the next/prev links, but once I have, I’ll inform you how it went.

    Still, thanks again already!

    Plugin Author helgatheviking

    (@helgatheviking)

    You’re welcome. Please let me know how the dev version goes.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Shortcode in post’ is closed to new replies.