Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How to get email address of logged on user?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-30-2012, 08:58 AM
 
arren123 arren123 is offline
 

Member
  
Join Date: Nov 2012
Posts: 14
 

Default How to get email address of logged on user?

Sorry, I'm still new to editing X-cart. Hopefully this will be an easy one. I just want to get the email address of the logged on user so I can build an html link.

I'm editing the new archive template
/common_files/modules/News_Management/customer/news_archive.tpl

Here is the code I've written for test purposes.

Code:
{capture name=unsubdialog} <table cellspacing="1" class="data-table"> <tr> <td><a href="https://store.sweet-sugar-gliders.com/mail/unsubscribe.php?email={$email}">Click here to unsubscribe</a></td> </tr> <tr> <td>{$lng.eml_unsubscribe_information} {$http_location}/mail/unsubscribe.php?email={$email}</td> <tr> </table> {/capture} {include file="customer/dialog.tpl" title="Unsubscribe" content=$smarty.capture.unsubdialog}

What do I put in place of {$email} so it will return the e-mail address?

Arren
X-Cart Pro v 4.5.4
Reply With Quote
  #2  
Old 11-30-2012, 11:29 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How to get email address of logged on user?

If you are using email as username (which I recommend), then just try {$login}.

Another one to try if you are using product notifications: {$prod_notif_prefilled_email}

On some pages, like my account and checkout areas you can use {$userinfo.email}

Try using webmaster mode to learn what variables are assigned to the page in question.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 11-30-2012, 11:39 AM
 
arren123 arren123 is offline
 

Member
  
Join Date: Nov 2012
Posts: 14
 

Default Re: How to get email address of logged on user?

Thanks for the tip, but unfortunately the e-mail address is not being used as the username right now. I have to do a cleanup of users before I can switch to that mode.

I ran webmaster mode, but didn't see any variables for the email address when I was on the page.

So.. I guess my question is,
How do get get the e-mail address of the logged on user from the database and return it to a template so I can use it in an html link?
__________________
X-Cart Pro v4.5.5
Reply With Quote
  #4  
Old 11-30-2012, 12:09 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How to get email address of logged on user?

If we could do this from a page that had $userinfo assigned like the my account page, then this would be a snap.

It's not going to be that hard, but it is going to require some PHP and a database query. First, lets determine what php page you are working with. Can you provide a link to the page? What does it say in the address bar? Is it news.php?

If so then we are going to have to place some code in that php file, to query the DB and assign it to smarty. Open up news.php
and try adding this to the bottom:
Code:
if (!empty($logged_userid)) $smarty->assign('userinfo', func_userinfo($logged_userid, 'C'));

Add it right before:
Code:
func_display('customer/home.tpl', $smarty);

Be sure to make changes like this on your dev/test site first, and make backups if the original files, and note the change in your changelog.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
arren123 (11-30-2012)
  #5  
Old 11-30-2012, 04:01 PM
 
arren123 arren123 is offline
 

Member
  
Join Date: Nov 2012
Posts: 14
 

Default Re: How to get email address of logged on user?

Thanks! That worked like a charm!

Arren
__________________
X-Cart Pro v4.5.5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:46 PM.

   

 
X-Cart forums © 2001-2020