• Hi, I try to use the member’s page to create the user’s state management dashboard. I have added some custom actions and they work just fine. I have a problem with standard actions though (Activate/Deactivate, /Approve, etc.). After I click the action it does what it suppose to do but it redirects me to my profile page which is extremely annoying especially when I have to perform multiple actions on multiple users. How can I change that so instead of redirecting to my profile it would refresh the member’s page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bcim

    Please try this code snippet to redirect you back to the Member Directory after updating the user status in the directory:

    // Redirect administrators back to member director after updating the user status from member directory
    add_action("um_after_user_status_is_changed","um_122121_redirect_back_to_directory", 1 );
    function um_122121_redirect_back_to_directory(){
    
        if( ! function_exists("um_get_core_page") ) return;
        
        if( um_get_core_page("user") && isset( $_REQUEST['um_action'] ) ){
            add_filter("um_get_current_page_url",function( $current_url ){
                $url = $_SERVER['HTTP_REFERER'];
                if( strpos( $url,"/members/") > -1 ){
                    return $url;
                }
                return $current_url;
            });
        }
    }

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

    Regards,

    Thread Starter Krzysztof Rawski

    (@bcim)

    It works just fine. Thank you. BTW it is strange that by default it redirects to admin profile after changing users status.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bcim

    Thanks for letting us know. I’ve created an issue for this on our public Github repository: https://github.com/ultimatemember/ultimatemember/issues/960

    I’m marking this as resolved for now.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Members page actions redirect’ is closed to new replies.