FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » "Last visit" in "members"
Show: Today's Messages :: Unread Messages :: Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
"Last visit" in "members" [message #29033] Sun, 27 November 2005 06:06 Go to next message
confridín is currently offline  confridín   France
Messages: 11
Registered: November 2005
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Is there a hack to add the information "Last visit" of each member in the page "members"
Re: "Last visit" in "members" [message #29040 is a reply to message #29033] Sun, 27 November 2005 11:21 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
No, but you can add it easily enough by modifying the fetch query to get the last_visit field from the users table.

FUDforum Core Developer
Re: "Last visit" in "members" [message #29049 is a reply to message #29033] Sun, 27 November 2005 12:24 Go to previous messageGo to next message
confridín is currently offline  confridín   France
Messages: 11
Registered: November 2005
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I don't know what is the "fetch query" and how to add a new column to have this informations.

Can you help me please? Thanks for your help.
Re: "Last visit" in "members" [message #29071 is a reply to message #29049] Sun, 27 November 2005 19:46 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
You need to edit the main retrieval query to fetch the last_visit field, which you can then use to display the user's time of last visit.

FUDforum Core Developer
Re: "Last visit" in "members" [message #31066 is a reply to message #29033] Thu, 30 March 2006 03:25 Go to previous messageGo to next message
confridín is currently offline  confridín   France
Messages: 11
Registered: November 2005
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Hello.

I tried to add the information "last_visit" in the "finduser" file.

But i've got a small problem. I'm a novice in php and i tried to understand how it works but i made a mistake.


Here is my problem:

- If i "clic" on "s'est connecté la dernière fois" (last time connected on the forum), it doesn't sort the last_visit date and i don't know why.


In finduser.tmpl, i added:
<th nowrap><div align="center"><a href="{TEMPLATE: FINDUSER_PAGE_lnk2}" class="thLnk">{MSG: finduser_lastvisit}</a></div></th>

after
<th nowrap><div align="center"><a href="{TEMPLATE: FINDUSER_PAGE_lnk2}" class="thLnk">{MSG: finduser_joindate}</a></div></th>


and

<td class="DateText nw">{TEMPLATE: finduser_last_visit}</td>

after
<td class="DateText nw">{TEMPLATE: finduser_join_date}</td>





In finduser.php, i added:
<td class="DateText nw">'.strftime("%a, %d %B %Y", $r->last_visit).'</td>

after
<td class="DateText nw">'.strftime("%a, %d %B %Y", $r->join_date).'</td>


<th nowrap><div align="center"><a href="index.php?t=finduser&amp;usr_login=<?php echo urlencode($usr_login); ?>&amp;<?php echo _rsid; ?>&amp;btn_submit=Find&amp" class="thLnk">s'est connecté la dernière fois le</a></div></th>

after
<th nowrap><div align="center"><a href="index.php?t=finduser&amp;usr_login=<?php echo urlencode($usr_login); ?>&amp;<?php echo _rsid; ?>&amp;btn_submit=Find&amp" class="thLnk">s'est inscrit le</a></div></th>




Thanks for your help.
  • Attachment: myfiles.zip
    (Size: 7.37KB, Downloaded 1506 times)
Re: "Last visit" in "members" [message #31074 is a reply to message #31066] Thu, 30 March 2006 14:53 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
You need to update the SQL query to fetch the last_visit field.

FUDforum Core Developer
Re: "Last visit" in "members" [message #31083 is a reply to message #29033] Thu, 30 March 2006 16:23 Go to previous messageGo to next message
confridín is currently offline  confridín   France
Messages: 11
Registered: November 2005
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
How can i do that? Thanks for your help.

Here is the link to the forum:

http://www.rochmedia.com/morrowind/nueronuh_forum/index.php?t=finduser
Re: "Last visit" in "members" [message #31101 is a reply to message #31083] Sat, 01 April 2006 13:05 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
You need to modify the SQL query inside the finduser.php.t to select the "last_visit" column.

FUDforum Core Developer
Re: "Last visit" in "members" [message #31127 is a reply to message #29033] Mon, 03 April 2006 14:57 Go to previous messageGo to next message
confridín is currently offline  confridín   France
Messages: 11
Registered: November 2005
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Ok.

I tried several modifications but nothing works...

I know i'm a real novice at php but where can i modify the SQL query inside the "finduser.php.t" file in order to select the "last_visit" column?


I think it's in this part but i don't know what to do...


/*{POST_HTML_PHP}*/

	if (!isset($_GET['start']) || !($start = (int)$_GET['start'])) {
		$start = 0;
	}

	if (isset($_GET['pc'])) {
		$ord = 'posted_msg_count DESC';
	} else if (isset($_GET['us'])) {
		$ord = 'alias';
	} else {
		$ord = 'id DESC';
	}


	$usr_login = !empty($_GET['usr_login']) ? trim((string)$_GET['usr_login']) : '';

	if ($usr_login) {
		$qry = 'alias LIKE '._esc(char_fix(htmlspecialchars(addcslashes($usr_login.'%','\\')))).' AND';
	} else {
		$qry = '';
	}

	$find_user_data = '';
	$c = uq('SELECT /*!40000 SQL_CALC_FOUND_ROWS */ home_page, users_opt, alias, join_date, posted_msg_count, id FROM {SQL_TABLE_PREFIX}users WHERE ' . $qry . ' id>1 ORDER BY ' . $ord . ' LIMIT '.qry_limit($MEMBERS_PER_PAGE, $start));
	while ($r = db_rowobj($c)) {
		$find_user_data .= '{TEMPLATE: find_user_entry}';
	}
	unset($c);
	if (!$find_user_data) {
		$find_user_data = '{TEMPLATE: find_user_no_results}';
	}

	$pager = '';
	if (($total = (int) q_singleval('SELECT /*!40000 FOUND_ROWS(), */ -1')) < 0) {
		$total = q_singleval('SELECT count(*) FROM {SQL_TABLE_PREFIX}users WHERE ' . $qry . ' id > 1');
	}
	if ($total > $MEMBERS_PER_PAGE) {
		if ($FUD_OPT_2 & 32768) {
			$pg = '{ROOT}/ml/';
			if (isset($_GET['pc'])) {
				$pg .= '1/';
			} else if (isset($_GET['us'])) {
				$pg .= '2/';
			} else {
				$pg .= '0/';
			}

			$ul = $usr_login ? urlencode($usr_login) : 0;
			$pg2 = '/' . $ul . '/';

			if (isset($_GET['js_redr'])) {
				$pg2 .= '1/';
			}
			$pg2 .= _rsid;

			$pager = tmpl_create_pager($start, $MEMBERS_PER_PAGE, $total, $pg, $pg2);
		} else {
			$pg = '{ROOT}?t=finduser&amp;' . _rsid . '&amp;';
			if ($usr_login) {
				$pg .= 'usr_login='.urlencode($usr_login) . '&amp;';
			}
			if (isset($_GET['pc'])) {
				$pg .= 'pc=1&amp;';
			}
			if (isset($_GET['us'])) {
				$pg .= 'us=1&amp;';
			}
			if (isset($_GET['js_redr'])) {
				$pg .= 'js_redr='.urlencode($_GET['js_redr']).'&amp;';
			}
			$pager = tmpl_create_pager($start, $MEMBERS_PER_PAGE, $total, $pg);
		}
	}

/*{POST_PAGE_PHP_CODE}*/


Thanks for your help.

[Updated on: Wed, 05 April 2006 03:09]

Report message to a moderator

Re: "Last visit" in "members" [message #31137 is a reply to message #31127] Tue, 04 April 2006 09:44 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
You need to edit the big SELECT query at the top part of the page.

FUDforum Core Developer
Re: "Last visit" in "members" [message #31202 is a reply to message #29033] Sat, 08 April 2006 13:36 Go to previous messageGo to next message
confridín is currently offline  confridín   France
Messages: 11
Registered: November 2005
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I don't know anything about php and SQL.

What is the "BIG select query"?
Re: "Last visit" in "members" [message #31207 is a reply to message #31202] Sun, 09 April 2006 13:12 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
I ment the term literarly, the long select query in the code...

FUDforum Core Developer
Odp: "Last visit" in "members" [message #32636 is a reply to message #29033] Wed, 12 July 2006 07:47 Go to previous message
kroku is currently offline  kroku   Poland
Messages: 30
Registered: July 2006
Karma: 0
Member
add to buddy list
ignore all messages by this user
Hi, I made some changes in files and mod works fine, but it's one thing i can't do. When I click on tilte "Last visit" data should be sorted by last visit date, by they are still sorted by registration date.
I've edited some things, some added to sort by last visit date, but it doesn't work. Could you check what I've forgot to add or edit? I've already no idea what to do.
Here are my edited files (v2.7.5)
  • Attachment: lastvisit.zip
    (Size: 24.70KB, Downloaded 1246 times)
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Fetch search-results via API ?
Next Topic: Viewing the same message from different threads
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Feb 13 10:12:18 EST 2025

Total time taken to generate the page: 0.03854 seconds