• Resolved pwred

    (@pwred)


    Hey,
    I would like to sort users randomly on the Member Directory. Unfortunately, I noticed, that when users are sorted “randomly”, the sorting is saved and will never be changed again. I would prefer to sort users randomly each time again when a user reloads the page because it is pretty useless for me like it is right now because a user would see just the same users the whole time. I saw a post like mine a year ago, but nothing has changed since then. Is it that difficult to add this option? Or can I do this via some changes in the code?

    Thank you very much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pwred

    (@pwred)

    Or is it possible to just reset it manually? So like I click a button on admin and all users get shuffled again?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @pwred

    You can try this code snippet to re-shuffle the member directory results randomly on page load:

    
    add_action("template_redirect",function(){
        if( ! function_exists("um_is_session_started") ) return;
     
        if ( um_is_session_started() === false ) {
                @session_start();
        }
        
        unset( $_SESSION['um_member_directory_seed'] );
       
    });

    You can add the above code snippets to your theme’s functions.php file or use the Code Snippets plugin to run your code.

    Regards,

    • This reply was modified 1 year, 5 months ago by Champ Camba.
    Thread Starter pwred

    (@pwred)

    @champsupertramp Thank you for this amazing and fast support! This works just PERFECT!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Real Random Sorting in Directories’ is closed to new replies.