Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display Logged User


ramaly

Recommended Posts

Posted

Hi,

I m new to OSC and the php scripting.

i want to display current logged username in the main page of web site,when user is logged.

pls help me to sort-out this issue.

 

actually i need to get a session variable which containing customer name.

thanks,

ramaly

Posted

A little editing in /includes/functions/general.php should sort it

 

// Return a customer greeting

function tep_customer_greeting() {

global $customer_id, $customer_first_name;

 

if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {

$greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_href_link(FILENAME_LOGOFF, '', 'SSL'),tep_output_string_protected($customer_first_name));

} else {

$greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

}

 

return $greeting_string;

}

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted

A little editing in /includes/functions/general.php should sort it

 

// Return a customer greeting

function tep_customer_greeting() {

global $customer_id, $customer_first_name;

 

if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {

$greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_href_link(FILENAME_LOGOFF, '', 'SSL'),tep_output_string_protected($customer_first_name));

} else {

$greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

}

 

return $greeting_string;

}

 

 

Hey I'm trying to do the same thing as the author of this post. I want to display it in my navigation bar. So it should say "Welcome to BestMacDiscounts. Customer name" or if not signed in "Welcome to BestMacDiscounts " . Using your code i'll be able to add a function to the General.php while but how do I call that in my breadcrumb. I know i can add this "$breadcrumb->add(NAVBAR_TITLE);" and instead of NAVBAR_TITLE would I add the function name or something else? Please advice. Also I hope the author doesn't mind me interrupting this post. Sorry if I'm

 

Thank you,

AE

Thank you in advance,

AE

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...