I got a few minor problems with PHP hard coding I hope you can help me with. I want to make my login change to logout after someone logs in. I have tried two ways so far by putting code into the bottom of my function.php
file, with one nearly breaking the site, I had to remove the code by going in though sudo
. This is the code that nearly worked,
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
I put this code at the bottom of the functions.php
file, although it never gave me the logout, instead it changed REGISTER
to the login.
3 minor problems I’m having are:
-
Login first time after coming back the site from a link that gets sent to a new user’s email lands them on the home page, i have an s2member plugin that states after login you go to another page, this works, but not for a new user.
-
User logout not working unless i tell the logout to open in new window, if not it just times out and google tells me the site will never redirect to the page its looking. Although admin can logout fine.
-
I’m working on with blocked pages unless the user has a paid membership for the service i providing.
Here’s a few wp- details.
WP Version: WP 3.5.1
Installed Plugins: All in one Favicon by Arne Franken version 4.3,
bbPress by The bbPress Community version 2.3.2,
Better WP Security by Bit51 version 3.5.5,
Black Studio TinyMCE Widget by Black Studio version 1.2.0,
Contact Form 7 by Takayuki Miyoshi version 3.4.2,
Custom sidebars by Javier Marquez version 1.2,
Google XML Sitemaps by Arne Brachhold version 3.2.9,
T(-) Countdown by twinpictures, baden03 version 2.2.10,
KB Robots.txt by Adam R. Brown version 1.0.1,
Raw HTML by Janis Elsts version 1.4.10,
Revision Cleaner by Meng Zhuo version 2.1.3,
s2Member® Framework by s2Member® / WebSharks, Inc. version 130617,
Slideshow by StefanBoonstra version 2.2.11,
Ultimate TinyMCE by Josh Lobe version 4.8.1,
Welcome Pack by Paul Gibbs version 3.3,
WooCommerce by WooThemes version 2.0.13,
WordPress SEO by Joost de Valk version 1.4.13,
WP-Mail-SMTP by Callum Macdonald version 0.9.1,
WP Maintenance Mode by Frank Bültge version 1.8.11
Theme Name: Responsive
Theme Version: 1.9.3.2
Author URL: http://themeid.com
I have just took a complete backup off the db and the site, if anyone can help in this coding it would be much appreciated.
And i hope i got the post in the right place.
Just add
at the top of your wp-login.php file.