Fixed message_user_info deleted user message count link

Pepelac

Well-known member
Hi,

I think that this can be considered as a bug.

If in the "Show author message count" style option is enabled, link from the message count number leads to the 404 page (search/member, without user_id) in case of deleted user. There should be a simple check, does user exists and this link should be added only if user exists.
 
Yeah I can confirm this.

And it doesn't just affect deleted users. It affects any guest. So, if you enable guest posting and you enable the display of the message count, then you will have broken links.

Because the deleted/guest user doesn't have a user_id, the resulting URL is broken.

In the example of a deleted user:

Before user is deleted, the number of posts is a link which takes you to the user's posts:
bug-beforedelete.webp

This results in this, where the post count is seemingly reset. The user no longer has a user_id so, clicking on the post count takes you to this URL: http://yourdomain/search/member
bug-beforefix.webp


A good fix would be to hide the message count completely if you do not have a user_id:

Change:

Rich (BB code):
<xen:if is="@messageShowMessageCount">

To:

Rich (BB code):
<xen:if is="@messageShowMessageCount AND {$user.user_id}">

This results in the following, for deleted or guest users:

bug-afterfix.webp
 
Back
Top Bottom