New members with old posts linked in profile [message #21279] |
Wed, 24 November 2004 16:35 |
treebeard
Messages: 44 Registered: April 2004 Location: Huge Universe
Karma: 0
|
Member |
|
|
In the last few weeks at the ProSoundWeb forums, we've been seeing newly registered members whose profiles show someone else's old post as their last post; even weirder, all these Nov newbies' "last posts" seem to be in August 2004 (see: http://marsh.prosoundweb.com/index.php/ml/). Any idea why this would be happening? We have 5459 registered users and are running four forums against the same database (custom setup; Ilia knows the setup).
|
|
|
Re: New members with old posts linked in profile [message #21282 is a reply to message #21279] |
Wed, 24 November 2004 16:55 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The cause is simple to explain.
The user database is shared but the message database is not, the users table happens to cache the id of the last message posted by the user.
Suppose a member posts a message inside forum A and you view their profile in forum B. If forum B has a message with the same id it'll point to that message even though it was not posted by the user.
The fix is to modify the code fetching the last post of the user on the profile page (usrinfo.php.t) to fetch this data from the database and not use the cache.
FUDforum Core Developer
|
|
|
|
Re: New members with old posts linked in profile [message #21289 is a reply to message #21288] |
Wed, 24 November 2004 17:55 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
If you open usrinfo.php.t file inside the src/ directory you will find the following condition:
if ($u->u_last_post_id) {
Inside this condition is the query and the code responsible for fetching the user's latest message.
You need to change the query in there to get the last post by looking directly inside the msg table.
FUDforum Core Developer
|
|
|
|
Re: New members with old posts linked in profile [message #21292 is a reply to message #21290] |
Wed, 24 November 2004 18:41 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The where condition of that query fetches a particular message who's id is know, this is something you cannot rely upon.
The query should be something like this:
"SELECT m.subject, m.id, m.post_stamp, t.forum_id
FROM {SQL_TABLE_PREFIX}msg m
INNER JOIN {SQL_TABLE_PREFIX}thread t ON m.thread_id=t.id WHERE m.apr=1 AND m.poster_id=".$u->id."
ORDER BY m.post_stamp DESC LIMIT 1"
FUDforum Core Developer
|
|
|
|
|
|
Re: New members with old posts linked in profile [message #21312 is a reply to message #21311] |
Wed, 24 November 2004 19:36 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Modify the
if ($usr->users_opt & 1048576 || !empty($frm_perms[$r[3]])) {
condition to be
if ($r && ($usr->users_opt & 1048576 || !empty($frm_perms[$r[3]]))) {
FUDforum Core Developer
|
|
|
|