WordPress.org

Support

Support » Plugins and Hacks » Login Logout Menu » [Resolved] [Plugin: BAW Login/Logout menu] BAW Login/Logout Menu and Theme My Login compatibility issue

[Resolved] [Plugin: BAW Login/Logout menu] BAW Login/Logout Menu and Theme My Login compatibility issue

Viewing 14 replies - 1 through 14 (of 14 total)
  • I don’t understand why you need BAW Login/Logout menu with TML.

    Much like this wordpress.org page says at the top, “Welcome, Daedalon! View your profile (Log Out)”, which contains two user-specific links, to profile and to log out. Our intention is to have the same as a proper WP navigation menu.

    BAW Login/Logout Menu is the best solution we’ve found so far. Although TML is a Swiss knife of a plugin, I didn’t notice it yet have a module for creating user-specific menus.

    Plugin Author Julio Potier

    @juliobox

    ThemeMyLogin
    /includes/class-theme-my-login.php

    line 553:
    if ( is_admin() )
    becomes
    if ( is_admin() or empty( $title ) )

    This is a TML bug 😉

    Verified, this change fixed the issue. Excellent work once again, Julio. Many thanks!

    Jeff, could you review the change to incorporate it into the next TML update?

    Plugin Author Julio Potier

    @juliobox

    Sorry Jeff Farthing, i was not aware you were TML owner !
    So i posted it on the plugin’s support too, sorry.
    What do you think about that ?

    I don’t understand what that is supposed to do. Also, @daedalon, you could use TML’s Custom User Links module and the widget to do what you want to do.

    Jeff, I sent you a message via your contact form. If you could reply to it so I’ll get your email address, I’ll send you a screenshot showing the issue and the result of the fix.

    Thanks about the tip with the module. I had a look at that module earlier, but couldn’t fathom whether it supports what I need: links that are shown only depending on whether the user is logged in or out. It seems this is not yet supported by the module. I’m a bit unsure what does the module do overall. It seems that there are two links already that are the same for any user role, but I don’t see anything related to them in the Menus or Widgets admin screens. If I remember correctly all the other included modules’ purpose and usage were clear to me on the first look, making this the only module that left me looking for additional documentation.

    A sentence or two in the module list and in the module settings screens could help us new users out.

    Jeff, in case you’ve replied to my email, it hasn’t come through yet.

    Until this fix makes it to the plugin, we’re stuck with manually reapplying the patch every time Theme My Login is updated. In the newest plugin version the fix is applied on line 576.

    That line of code has nothing to do with links…

    There’s another similar submission. I’ll continue the discussion there to keep it all together. Hopefully we’ll find a solution to the issue on that thread.

    I got your email and sent the screenshot. Thanks for looking into this!

    I think I figured out the problem, and as it’s separate on the other issue, I’ll post about it here. This appears to be what happens:

    1. BAWLLM creates a menu item, but returns it as null when logged in:
      case '#bawregister#' : 	if( is_user_logged_in() ) $item = null; else $item->url = site_url( 'wp-login.php?action=register', 'login' ); break;
      		}
      		$item->url = esc_url( $item->url );
      	}
      	return $item;
    2. Right after, TML resumes from BAW’s empty string in class-theme-my-login.php, lines 659-665:
      function wp_setup_nav_menu_item( $menu_item ) {
      		if ( 'page' == $menu_item->object && $this->is_login_page( $menu_item->object_id ) ) {
      			$menu_item->title = $this->the_title( $menu_item->title, $menu_item->object_id );
      			$menu_item->url = is_user_logged_in() ? wp_logout_url() : $this->get_login_page_link();
      		}
      		return $menu_item;
      	}
    3. On the login/?action=profile page the_title() sets the menu item with the empty URL and title to have a title (575-582):
      function the_title( $title, $post_id = 0 ) {
      		if ( is_admin() )
      			return $title;
      
      		if ( $this->is_login_page( $post_id ) ) {
      			if ( !in_the_loop() ) {
      				$title = is_user_logged_in() ? __( 'Log Out', 'theme-my-login' ) : __( 'Log In', 'theme-my-login' );
      			} else {

      Because of this, changing the first line inside the_title() to be if ( is_admin() or empty( $title ) ) instead, the symptom disappears. Not sure if it’s the perfect solution, though, but it solves this issue and during the time I’ve now had it on my site, I haven’t noticed any errors caused by this.

    It’s not the perfect solution. As I suspected, the bug is on the end of the other plugin.

    Thanks for the comment, Jeff. What should BAWLLM do instead of returning a null $item?

    Also, do you have an idea why TML sets a title for that $menu_item but not a url?

    I created a second navigation menu on my theme, and the problem persisted despite having applied the Julio’s fix from above.

    Jeff: Does TML support making custom links that can be set to shown only if the user is logged in or out? Are there instructions for this available?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] [Plugin: BAW Login/Logout menu] BAW Login/Logout Menu and Theme My Login compatibility issue’ is closed to new replies.
Skip to toolbar