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

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: [How-to] Add a 'My Account' button to w3all login widget

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

by kaspir » Wed Nov 15, 2017 8:01 am

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!

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

by kaspir » Mon Oct 16, 2017 9:07 am

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 } ?>

Top