Support Forums

Old 01-23-2009, 03:38 PM   #1
Member
 
Join Date: Nov 2008
Posts: 64
Rep Power: 3
DGiscombe is on a distinguished road
Default User's city in header

Hey,

Does anybody know how to display the user's registered city on the homepage in the same way the username is displayed in the welcome note?

I'm not sure on how to code a cookie session for that.
DGiscombe is offline   Reply With Quote
Old 01-23-2009, 05:07 PM   #2
Moderator
 
 
Join Date: Mar 2006
Posts: 4,114
Rep Power: 100
Lhotch is just really niceLhotch is just really nice
Default

The login process doesnt pull any of the users address from the database when they login so to get it to display you would have to alter the login function to first collect that info. Then you would have to modify all the cookie and session related functions to include the existing data as well.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-23-2009, 06:10 PM   #3
Member
 
Join Date: Nov 2008
Posts: 64
Rep Power: 3
DGiscombe is on a distinguished road
Default

Would the altering of the function be in includes/classes/kernal/Login.php alone?
DGiscombe is offline   Reply With Quote
Old 01-23-2009, 06:38 PM   #4
Moderator
 
 
Join Date: Mar 2006
Posts: 4,114
Rep Power: 100
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by DGiscombe View Post
Would the altering of the function be in includes/classes/kernal/Login.php alone?
yep. The other session and cookie functions should be in there as well.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-23-2009, 07:56 PM   #5
Member
 
Join Date: Nov 2008
Posts: 64
Rep Power: 3
DGiscombe is on a distinguished road
Default

Sorry to bug again, I'm not too good at coding, but I made these changes:

/**
* Update the users table session information
*
* @access private
* @return void
* @internal requires that _userData be set
*/
function _saveSession()
{
$sSQL = 'UPDATE ' . PREFIX . 'users
SET
lastlogin=NOW(),
cookie=' . $this->_db->quoteInto(md5($this->_userData['username'])) . ',
cookie=' . $this->_db->quoteInto(md5($this->_userData['country'])) . ',
session = ' . $this->_db->quoteInto(session_id()) . ',
custip = ' . $this->_db->quoteInto($_SERVER['REMOTE_ADDR']) . '
WHERE id =' . $this->_userData['id'];
$this->_db->query($sSQL);
}

/**
* Set a users session
*
* @access private
* @return void
* @internal requires that _userData be set
*/
function _setUserSession()
{
$_SESSION['uid'] = $this->_userData['id'];
$_SESSION['username'] = htmlspecialchars($this->_userData['username']);
$_SESSION['country'] = htmlspecialchars($this->_userData['country']);
$_SESSION['cookie'] = md5($this->_userData['username']);
$_SESSION['cookie'] = md5($this->_userData['country']);
$_SESSION['userlevel'] = $this->_userData['level'];
$_SESSION['logged'] = true;
$_SESSION['hash'] = $this->_hash;
}

Am I heading in the right direction here?
DGiscombe is offline   Reply With Quote
Old 01-23-2009, 09:46 PM   #6
Moderator
 
 
Join Date: Mar 2006
Posts: 4,114
Rep Power: 100
Lhotch is just really niceLhotch is just really nice
Default

The changes you made simply place the a variable into a session or a cookie, but nothing you did actually collected that data from the database. Thats done by the _checklogin function (I may have that name wrong, im just going from memory).
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-24-2009, 08:39 PM   #7
Member
 
Join Date: Nov 2008
Posts: 64
Rep Power: 3
DGiscombe is on a distinguished road
Default

Am I adding a query in here somewhere?

function checkLogin($username, $password, $remember='N')
{
$password = $this->hashPassword($password);
if (defined('IN_ADMIN')) {
if (!$this->_checkAdminLogin($username, $password)) { //failed
$this->_checkLoginFailed();//assign error to template
return false;
}
$this->_setHash();
$this->_setAdminSession();
$this->_saveSession();
if ($remember <> 'N') {
$this->_setCookie();
}
return true;
}
if (!$this->_checkUserLogin($username, $password)) { //failed
$this->_checkLoginFailed();//assign error to template
return false;
}
if (!$this->_checkEmailValidation()) { //hasn't validated email
$this->_checkLoginFailed();//assign error to template
return false;
}
if ($this->_checkBanned()) { //banned
$this->_checkLoginFailed();//assign error to template
return false;
}
$this->_setHash();
$this->_setUserSession();
$this->_saveSession();
if ($remember <> 'N') {
$this->_setCookie();
}
return true;
}
DGiscombe is offline   Reply With Quote
Old 01-24-2009, 09:08 PM   #8
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110
Eric Barnes is a jewel in the rough
Default

Open Login and find the function _setUserSession().
Next inside this find:
$_SESSION['username'] = htmlspecialchars($this->_userData['username']);

Just below it add:
$_SESSION['city'] = htmlspecialchars($this->_userData['city']);

Then in the template:
{$smarty.session.city}
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 01-25-2009, 09:30 AM   #9
Member
 
Join Date: Nov 2008
Posts: 64
Rep Power: 3
DGiscombe is on a distinguished road
Default

Thanks Eric
DGiscombe is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shumen.biz - City Classified Ads SecondShoe Site Critiques 7 10-24-2008 06:58 PM
listing address different from user's addesss anna245 v4 Questions & Support 1 04-18-2008 01:42 PM
Pre-populated Town/City teg v3.1 Questions & Support 4 10-22-2007 12:49 PM
When not using Address or City Grebogreen v4 Questions & Support 2 07-05-2007 11:46 AM
User's credit ??? Unregistered Pre Sales Questions 1 06-08-2007 09:02 AM


All times are GMT -4. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0