XF 2.2 server errors - can anyone help?

Joao Prates

Active member
After following a fellow member suggestion on this thread, I ended up with a working solution (the images are showing up fine) but with lots of server errors being generated on a context I don't fully understand.

Here's an error instance example:

1593644690348.png


The template changed was message_macros, and the change is seen in the originating thread referenced above.

I'm not clever enough to understand how something that is displaying correctly and generating no errors whatsoever for almost an hour suddenly generates some dozens errors all equal like the one above.

Can any of you guys and gals help me out understand and fix this?
I really like the end result, it is displaying the group image fine, but I never had server errors and I would like to keep it that way.

Thanks
 
It seems all errors being generated relate to one thread where we had one (the only one actually) user we had to ban and delete his account.

I'm getting the idea that his posts now displaying "Deleted member 314" have no $user associated, since the account was deleted.

What's the sintax for testing if $user is null, so that I can proceed with the rest of the code for image display only if $user is not null?

By the way, since this is my first try into xf coding, is there a language reference guide somewhere?

I did a quick google, and found this:

Code:
<xf:if is="$user AND {{$user.isMemberOf(x)}}">
code here
</xf:if>

Give that syntax a try, it should read as; If the user is a Member AND a member of User Group, then display image.

We use this addon to change post authors:

Just in case you need that in the future.
 
Hi all, @Dragonfruit ,

Just to update with a status report that the logs are clean all these hours later, so the solution suggested above worked.

Don't know if this should be considered a bug in XF or not, having a post with no user account whatsoever assigned?

I'll let others decide that. For me the case is closed.

Thanks.
 
It seems all errors being generated relate to one thread where we had one (the only one actually) user we had to ban and delete his account.

I'm getting the idea that his posts now displaying "Deleted member 314" have no $user associated, since the account was deleted.

What's the sintax for testing if $user is null, so that I can proceed with the rest of the code for image display only if $user is not null?

By the way, since this is my first try into xf coding, is there a language reference guide somewhere?
 
Don't know if this should be considered a bug in XF or not, having a post with no user account whatsoever assigned?
It's not a bug - XF allows for posts from guests and also deleted accounts.

The issue was with the original modification you made, which didn't take those scenarios into account.
 
I really think I should open a new feature request, or however you call it, because allowing for group avatars is such a basic feature and it is missing.
It should IMHO not be necessary for us to write if-then-else code into the templates for such a common functionality.

On our old Community Server some 15 years ago we had this with roles, and the advantage was that anyone could click on the avatar and see the list of all users pertaining to that role.

We found this most useful, and surely (I think) it should be quite easy for the dev team to implement the functionality, am I wrong?

Where (url) do we submit theses requests into?
 
No, it was not a request to go that far, but that would be awesome, if the trouble/work would be similar from dev, then yes please.

It does pose some concerns in trusting users to upload pictures and choosing their own groups... hummm... nahhh... too tricky, I won't ask for that.
 
Top Bottom