My-Little-Forum / mylittleforum

A simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure)
GNU General Public License v3.0
124 stars 48 forks source link

Unexpected behaviour if searching for postings of a specific author #716

Closed auge8472 closed 5 months ago

auge8472 commented 5 months ago

If using the search feature in the project forum instance for postings of one specific author with his name, the search only finds posting from the time he was posting as a visitor (not with a registered account) but not a single posting from the later time when he posted from his registered account. In contrast, if I search for my own postings, the search finds both old entries as a visitor as well as newer postings as a registered user.

The issue may be a matter of the specific spelling of the username of this specific user.

loesler commented 5 months ago

717 should solve this issue.

auge8472 commented 5 months ago

@loesler Thank you for your rework of the queries. Can you explain why I can find all of my posts, but find with the name of the other author[^1] only the posts he made without being logged in?

[^1]: If you need to know the name for further investigation, I'll send it on another way. I don't want to name him here publicly.

loesler commented 5 months ago

If a user is not registered, the name is saved within the posting. If the user is registered, the name is not saved with the posting but the user id is saved. To obtain the name, you have to select the name from the user table using the user id. My modification adds the user name of registered user to the query.

Concerning you question: You always sign you postings with your user name. Your user name is, therefore, also part of the content. However, if a registered user does not sign the post with their nickname, the user name was not part of the post and was, therefore, not included in the query.

auge8472 commented 5 months ago

Concerning you question: You always sign you postings with your user name. Your user name is, therefore, also part of the content. However, if a registered user does not sign the post with their nickname, the user name was not part of the post and was, therefore, not included in the query.

That reads very plausible. 😆👍

auge8472 commented 5 months ago

I think, it's done.