[How-to] Add a 'My Account' button to w3all login widget

User avatar
kaspir
Moderator
Moderator
Posts: 88
Joined: Mon Mar 20, 2017 2:38 pm
Location: USA
Contact:

[How-to] Add a 'My Account' button to w3all login widget

Post by kaspir »

Image

The MY ACCOUNT button can link to whatever you like really. Even rename it whatever you want! It's just an added button that will use your pre-existing CSS button class (or even change that if need be). Here I show how to direct this new button to either Woo-commerce custom (dashboard.php) page OR even the users phpBB User Control Panel (UCP). Just another way to have one button, instead of a whole other widget! Try this as I've done, thought I'd share:

FIRST CHOOSE WHERE YOU'RE LINKING THE NEW BUTTON
Want to link to WooCommerce user account page? Use this where it says "PLACE_THE_BUTTON_LINK_HERE".

Code: Select all

//your-WP-domain.com/my-account/
NOTE: /my-account/ is default for WooCommerce dashboard.php, if you've changed the permalink for that page, than alter /my-account/ to your custom. Also note, http or https is not required, just the //, in any case of this on any template.

Want to link to your phpBB UCP instead? Use this where it says "PLACE_THE_BUTTON_LINK_HERE".

Code: Select all

<?php echo $w3all_url_to_cms;?>/ucp.php?i=ucp_profile&mode=reg_details
NOTE: this will link to the user's UCP Profile Tab > Edit Account Settings and will work for everyone logged in.

If you use iframe for your forums, you'll need to edit: /wp-content/plugins/wp-w3all-phpbb-integration/views/login_form_include_iframe_mode_links.php otherwise if you don't use iframe option, open and edit: login_form_include_noiframe_mode_links.php

Lastly, Find:

Code: Select all

<?php $logout_button = false;
if (!$logout_button){ ?>
<a class="button" href="<?php echo wp_logout_url(); ?>"><?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?></a>
<?php } else { ?>
<form action="<?php echo wp_logout_url(); ?>">
<input type="submit" value="<?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?>" />
</form>
<?php } ?>
Replace the entire statement with, and remember to change PLACE_THE_BUTTON_LINK_HERE to where ever you're choosing to link to:

Code: Select all

<?php $logout_button = false;
if (!$logout_button){ ?><br />
<a class="button" href="PLACE_THE_BUTTON_LINK_HERE"><?php echo __('My Account' , 'wp-w3all-phpbb-integration' ); ?></a>
<a class="button" style="float:right;" href="<?php echo wp_logout_url(); ?>"><?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?></a>
<?php } else { ?><br />
<a class="button" style="float:right;" href="PLACE_THE_BUTTON_LINK_HERE"><?php echo __('My Account' , 'wp-w3all-phpbb-integration' ); ?></a>
<form action="<?php echo wp_logout_url(); ?>">
<input class="button" type="submit" value="<?php echo __('Logout' , 'wp-w3all-phpbb-integration' ); ?>" />
</form>
<?php } ?>
Image
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads. :P
User avatar
kaspir
Moderator
Moderator
Posts: 88
Joined: Mon Mar 20, 2017 2:38 pm
Location: USA
Contact:

Re: [How-to] Add a 'My Account' button to w3all login widget

Post by kaspir »

EDITED on this day: Updated to also show how to use phpBB UCP as the button link, instead of just WooCommerce. Changed title. This new button may be linked to almost ANYWHERE, and it's only displays for any logged in user!

Bump for recognition!
Image
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads. :P
Post Reply