[Plugin: BAW Login Logout Menu] register adds emty item in nav menu
When I add the ‘register’ item to the nav menu it will add a empty item (‘a’ tag) to the nav when the user is logged in. Seems like the ‘$item = null’ still triggers the nav to create an item but an empty one. Wired thing is that this empty item sits at a different place … but it comes and goes with the ‘register’ item of your plugin.
I am using the ‘intent’ pro theme.
Is there a fix / workaround? I tried some things myself but I do not know php, only JS.
Thanks and cheers, Alex
In that case, if you could provide more information on the problem (perhaps a screenshot hosted at eg. imgur.com), I’ll take a further look at your issue.
Interesting that he has the same issue that you mentioned, yet doesn’t use TML.
I use the ‘Intent’ professional theme from wpbandit.com
I have installed ‘Cimy User Extra Fields’ plugin
When I add the ‘register’ menu item I have the ‘hole’ at some ‘random’ place in the menu when logged in (see http://imgur.com/PTEiI)
Only when the item is the very first in the menu the hole also appears first (meaning most left top item on a horizontal menu)
The menu code looks like this http://imgur.com/IAWqP
Not sure if there is more to help you with debugging? If so, let me know.
AlexJS: Could you test if disabling plugins one by one and finally reverting to the 2011 theme removes the error? Also, is the “hole” in your menu at the same place every time you reload the same page, ie. the location of the whole changes only when the page changes?
Jeff: I thought the same. To correct my earlier post, it seems to Julio that the bug is on TML side, but it could also be that TML’s behavior is correct and we need to look further to identify the cause.
While it’s possible that this functionality of BAWLLM depends on other plugins’ strict adherence to some recommended behavior, it could also be that this is an issue on the BAWLLM side. Hopefully Julio can have another look at this.
On his submission to the TML support forum he mentions “when $post_id and $title are sent empty, you change the title, but there is no link.” I had a look at bawllm.php to see how it handles these, but wasn’t able to puzzle it out yet.
I moved the ‘register’ menu item around and reloaded a lot. Findings:
– position does not change on reload
– the ’empty’ menu item appeared only at 2 different positions no matter how much I moved the ‘register’ menu item around in the first 2 menu levels
Tested the 2011 theme only in preview mode. Fucked up the whole menu, so I did not activate it. I am not sure if I can just switch back and all changes I made are back and ok.
I found a bit of code in bawllm.php that seems related:
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;
This is related to my case, where an unwanted
<a>Log in</a>was output in the HTML only on the profile page and always in the position where the Register link would be displayed for non-logged-in users. Not sure if it is related AlexJS’s case, as he says the item locations are random.
Even in my case, I don’t see why after
$item = null;esc_url() would return anything for it except null. Julio’s patch for TML fixed it for me, so it could be that TML does something strange without the fix, and my issue is unrelated to that of AlexJS.
AlexJS: Do you use the “Register” menu item? If, does the issue show only for logged-in users, and does it disappear if you disable that menu item?
Yup, it happens only for logged-in users and the empty menu item does not appear where the ‘register’ link would be for logged-out users.
Empty menu item does not appear where the ‘register’ link would be, but appears only in other locations?
The last time I switched themes back and forth the menus stayed intact, but widgets were moved to the bottom of the widgets pane. Their settings were kept, so I had only to drag them back to their places.
Does the issue happen when you have no other plugins enabled?
See, I have no dev. version of the site and 20 plugins installed. There is no more testing I can do to get this solved.
It works on the footer menu, so I use it there and leave the login/logout/register links of the top menu. instead I have buttons in the content and a content filter which hides/changes them based on the user status.
It seems our issues are separate, so I’ve continued posting on my issue on the thread.
Glad you’ve found a workaround. If it works on one menu/widget area but not all, that makes me first suspect the theme to cause a conflict. As it’s a professional theme, I don’t think Julio has the opportunity to test it, so you might want to bring the issue to the attention of the theme developers.
Turning plugins and theme on and off is a bugger, but doesn’t usually take more than 20-30 minutes to do. Some themes/plugins forget settings when disabled, but that’s luckily getting rare as the overall quality of WP plugins and themes has continued to improve each year.
If I would have an easy process in place to backup and recover the whole wp installation I would be more open to test things but I have never tried to recover the whole installation (files + db). So I keep a low profile on trying things just for ‘fun’ 😉
Any recommendations for backup and recovery as well as dev installations and switching between dev and live?
If you have shell access, you can have shell scripts that run this for you either periodically or on command. This is what we have used successfully. Requirements:
- Shell access
- A second database (if not possible, there are doable workarounds)
- Addition to your server’s VirtualHost settings to map eg. testing.example.com to a different directory than where your main site is mapped to.
For example the command
./sync-to-dev.shwould do the following:
- Copy all files from your WordPress installation directory to the directory your testing site is mapped to.
- Take a mysqldump of your main site’s database, and write it into the development site’s database.
There are also simpler solutions. The most common one is surely running a development environment at home. Windows users would do this most commonly by installing WAMP, Mac users by MAMP and Linux users by LAMP or using their distribution’s software repositories to install Apache, MySQL and PHP. A caveat is that on occasion some plugins behave differently in desktop environments compared to dedicated server environments.
For moving the database between different environments I’ve successfully used WP Migrate DB. What it does is basically taking a mysqldump and then doing a search-and-replace to use new settings for the site address. All that can also be done manually in a text editor.
Taking a look at http://wordpress.org/tags/development-environment is also worth it.
- The topic ‘[Plugin: BAW Login Logout Menu] register adds emty item in nav menu’ is closed to new replies.