Button in place of Text for Logout on Login Widget

User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Button in place of Text for Logout on Login Widget

Post by axew3 »

This will be maybe added on next 1.6.9, but as asked (and after removed) on another topic, here the easy way to replace text logout with a button on WP_w3all Login Widget:

open views/login_form_include_iframe_mode_links.php
or views/login_form_include_noiframe_mode_links.php (if on iframe or not)
search for this code:

Code: Select all

<a class="button" href="<?php echo wp_logout_url(); ?>"><?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?></a>
replace with:

Code: Select all

<form action="<?php echo wp_logout_url(); ?>">
    <input class="" type="submit" value="<?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?>" />
</form>
1.6.8 has just been released.
Goofkop
User www
User www
Posts: 63
Joined: Sun Feb 26, 2017 8:33 am

Re: Button in place of Text for Logout on Login Widget

Post by Goofkop »

Thank You very much!

It looks very nice but i didn't logout when i click on it.
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Button in place of Text for Logout on Login Widget

Post by axew3 »

as in place i will give you the right code so ... :o strange, it should work!
p.s there are several easy way to achieve ...
Goofkop
User www
User www
Posts: 63
Joined: Sun Feb 26, 2017 8:33 am

Re: Button in place of Text for Logout on Login Widget

Post by Goofkop »

I changed:

<a href="<?php echo wp_logout_url(); ?>"><?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?></a>

In:

<form action="<?php echo wp_logout_url(); ?>">
<input class="" type="submit" value="<?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?>" />
</form>

The first code is a little bit different than the yours.
Goofkop
User www
User www
Posts: 63
Joined: Sun Feb 26, 2017 8:33 am

Re: Button in place of Text for Logout on Login Widget

Post by Goofkop »

When i click on logout i am going to the following url: http://www.bakkersbaas.nl/wp-login.php?

And i see this:

http://imgur.com/a/AiYmQ

With the old code i click on logout and automatically i am going to this url: http://www.bakkersbaas.nl/wp-login.php?loggedout=true

And i see this:

http://imgur.com/a/GGwC9 (which says: You have been logged out!
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Button in place of Text for Logout on Login Widget

Post by axew3 »

Yes it is different, but both are working on my fly tests.
this output the wp_logout url

Code: Select all

<?php echo wp_logout_url(); ?>
in the default it is inside a text link:

Code: Select all

<a href="<?php echo wp_logout_url(); ?>"
in the second output into button

Code: Select all

<form action="<?php echo wp_logout_url(); ?>">
<input class="" type="submit"
the above is working on my test, but try just this instead:

Code: Select all

<input type="button" onclick="location.href='<?php echo wp_logout_url(); ?>';" value="Logout" />
Post Reply