[Resolved] Does Gp change permalink structure?

Home Forums Support [Resolved] Does Gp change permalink structure?

Home Forums Support Does Gp change permalink structure?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #217686
    Max

    I am developing a WP site locally on Xampp.

    I am using the following code to add a styled login/out button to the sidebar:

    add_shortcode( 'my_login', 'my_login' );
        function my_login() {
        if ( is_user_logged_in() ) 
        return '<a href="'.wp_logout_url( get_permalink() ).'" title="Logout"   class="button login">LOG OUT</a>';
                         else 
                            return '<a href="'.wp_login_url( get_permalink() ).'" title="Login" class="button login">LOG IN</a>';
                        }

    My site has 6 pages linked to the main nav. One is for the blog and another is a bbpress forum. If I login/out on 4 of these pages the code works as expected. That is if I visit the page then log in I am returned to that page. If I log out on that page I am returned to it also.

    However, when on the blog main page, or a blog post, and I log in I am taken (always) to the oldest post in the blog (the one that displays last on the blog main page) What ever page I log out from in the blog same occurs. I am taken to the last post.

    Same problem occurs if I am on the forum index page or a forum topic. When I log in I am taken (always) to the forum at the bottom of the forum index. What ever forum page I log out from same problem occurs.

    I have tried deactivating all plugins and the bug remains so it is not plugin related.

    Basically I just want my login/out to function as it should. Whatever page a person is on when they log in they are taken back to that page.

    Any help anyone can provide to resolve this is greatly appreciated.

    Thank in advance for any assistance.

    Kind Regards

    Max

    #217702
    Tom
    Lead Developer
    Lead Developer

    Hi Max,

    GP doesn’t change any permalink settings.

    I’m not sure why this would be happening. It’s most likely that get_permalink() is grabbing the URL of the first item in the loop (latest blog post etc..).

    Have you tried asking over on Stackoverflow? They’re awesome, and will most likely have an answer for you.

    #217722
    Max

    Posted on Stack and Wp support already. Posted here out of desperation.

    #217726
    Max

    Its not a child theme issue either. Problem remains if I revert back to GP theme.

    #217816
    Tom
    Lead Developer
    Lead Developer
    #217819
    Max

    Yes.

    I found this at 4am this morning just before collapsing into bed.

    $loginout = '<li class="nav-menu" class="menu-item">' . wp_loginout($_SERVER['REQUEST_URI'], false ) .

    It works. And it also runs a lot faster than the permalink option.

    I am not sure what the “false” attribute is for though?

    Sorry for bothering you so much here in these forums. I am old and lost my job nearly a year ago due to bad health. I am trying to start something online.

    Your help and patience (with my often non related GP questions) is appreciated greatly.

    Kind Regards

    Max

    #217900
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working.

    Happy to help when I can 🙂

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