Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
  • in reply to: Kleo login module #168625
     Gavsta
    Participant

    Hi Laura,

    Not a problem. The site is located at http://lgtest.quadris.biz and the page i am working on is here: http://lgtest.quadris.biz/quadris-gc/

    Its my staging server and can run a bit slow sometimes.

    you can login with the following details

    username: laura_kleo
    password: VvtHRFq0gONBUn8pkNT64JSV

    I had some success with the login and redirection yesterday. I have the login box on that page, and now when you login it redirects you back to the correct tab.

    Issues at the moment:

    Admin’s are no longer taken to the administrators dashboard.
    Also, the URL that is output doesn’t look very clean with pretty permalinks. AS it is now, the link is changed to include the tab’s ID. so the link ends up looking like this http://lgtest.quadris.biz/quadris-gc/#link_tab-existing

    Ideally i would like to omit that last part from the URL and just keep the venue’s permalink. That is probably me being fussy though, i imagine that if i removed that from the link then when redirected the tab wouldn’t be opened by default.

    Function to perform redirect on login:

    COPY CODE
    add_filter( 'login_redirect', function ( $redirect_to, $requested_redirect_to, $user ) {
    
    global $user;
    if( isset( $user->roles) && is_array( $user->roles)) {
        if ( in_array( 'administrator', $user->roles)) {
        $redirect_to = admin_url();
        return $redirect_to;
        } elseif ( ! $requested_redirect_to ) {
            $redirect_to = wp_get_referer();
    
             return $redirect_to;
        }
    
       
       
    }
     ?>
        
        <?php if (is_user_logged_in()) : ?>
        <a href="<?php echo wp_logout_url(get_permalink()); ?>">Logout</a>
    <?php endif;
        
    }, 10, 2 );

    Generally though Laura, the redirect is working now (yay!) but if you can offer any advice on fixing the administrator redirect part and if it’s possible to clean the URL up a bit. Or if there is a way to edit the tab names so that the output is quadris-gc/#existing and not /#link_tab-existing

    Thanks for your time Laura,

    PhilB

Viewing 1 post (of 1 total)

Log in with your credentials

Forgot your details?