XF 2.2 Forum and thread types

1596357716555.webp
Forums contain threads and threads contain posts. It's been the essential framework of forums on the Internet since the public migrated from usenet to the web.

The structure is well known and well understood - though the origins of some of the terminology are lost in the mists of time. Who ever came up with the notion of your site being a forum, but these separate containers for related threads also being forums? 🤷🏼‍♂️

But back on topic, and we all know that visiting a forum (the second type) will usually show a list of threads ordered with the most recently updated near the top, and that clicking on any of those threads will show a page with the oldest post first and newer posts underneath and on subsequent pages.

Bending discussion forums to varying purposes

Over the years, forum administrators have been inventive and used the simple messages-in-named-containers structure of forums to build all sorts of content - let's look at the XenForo community as an example.

First, we have announcements and these "Have you seen" threads. These are quite focused on the initial post (or first few posts in some HYS threads), with these posts containing a lot of information... a bit like an article with subsequent comments.

Then we have the suggestions forums, where we ask people to up-vote the ideas they're interested in.

There are also support forums where people are looking for answers to questions or solutions to problems.

And of course there are also forums for general chat and discussions, which most closely fit the original notion of a discussion thread and where you can't really say the threads fit the same model as the other types.

Up until now, these forums and the threads within have all been displayed the same way.

But not any more

With XenForo 2.2, we are introducing the concept of Forum and thread types. This is a massive change with enormous ramifications for forums. Today, we're only really going to talk about the admin and user experience of the new systems, but in a few days we're going to follow up with a developer-focused HYS where we will talk about what's going on behind the scenes here, because we're really rather excited about the potential it unlocks.

There is a lot to talk about, but let's just dive into some examples...

tl;dr

We're prefer you to read all the details below, but if you just want the juicy bits:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
Last edited by a moderator:
@Kier - About disabling mark-own-post-as-solution I mentioned in my previous post:

It is simply a template modification:
Template: post_question_macros
Find: <xf:if is="$post.canMarkAsQuestionSolution()">
Replace: <xf:if is="$post.canMarkAsQuestionSolution() && $thread.User != $post.User">

However, it is a simply GET request, so they can basically use /posts/XXXXXXX/mark-solution as a workaround.

Then we have to extend the controller to make it work!

Is this really necessary? Couldn't we have a simply admin option for this?
I strongly believe this is a vital setting.

(Edited template mod to change $xf.visitor as $thread.User - It should probably also check if the visitor is admin to allow that)
 
Last edited:
What about if we don't want members to accept their own posts as the solution in their questions? I really hope that I am missing it, but I can't find any option to turn this off - which is really a must.
User Group Permissions, as per screenshot in post you quoted.
/admin.php?permissions/user-groups/
 
The permission text has changed slightly -- Mark post as solution to own question thread (when applicable) -- but it's still the same permission.
 
User Group Permissions, as per screenshot in post you quoted.
/admin.php?permissions/user-groups/

@Mouth - that's what I am looking at:

1603070371468.webp


It is simply for letting a user to mark a post as the solution or not.
Here is the scenario: I posted a question. Then received many answers, but then I implemented my own solution by changing some answers, however the answer was completely provided by someone else.
Then I just clicked the button in my post to mark it as a solution.
So I marked my own post as the solution in my own question.

It is StackOverflow style, however it is not what we want. It should be an option.

And I am still hoping that you are going to tell me "yes, there is an option that you obviously didn't see!".
 
Set the permission on the screenshot in your post to No.
Use /admin.php?permissions/analyze on an example username, to ensure it's No and not inherited a Yes on this permission from another user group.
That's what I am doing already. If I do that then user cannot mark any post as solution, which makes sense, because title says that.
That option basically avoid user to mark "any" post as solution.

What I am talking about, avoiding users to mark their own "post" in their own "thread". Original poster, who is asking the question, should be only able to mark an answer provided by the others, not their own replies in that thread.
 
Are you saying you want moderators to be able to mark any post other than in their own threads as the solution?
 
Are you saying you want moderators to be able to mark any post other than in their own threads as the solution?

1- I just got registered in a forum. Posted a question.
2- I am lucky, some programmer sent me an amazing solution.
3- I changed a few lines of code, or I just wanted to increase my solution count, and posted the new code, then marked it as the solution.
4- Ok - forget about #3, I just sent a post contains "Thank you!" and selected that post as the solution!

I, as the one who asked the original question, marked my own post in my own question thread as the question.

There is nothing about moderating or anything else. I shouldn't increase my own solution statistics. At least, it should be optional to allow that or not.

Am I really that bad to explain my problem?

Thank you :)

=====

Following is the only way to avoid "mark your own post in your own question thread" by using template modification.

Template: post_question_macros
Find: <xf:if is="$post.canMarkAsQuestionSolution()">
Replace: <xf:if is="$post.canMarkAsQuestionSolution() && ($thread.User != $post.User || $xf.visitor != $thread.User)">

It will allow the admin to edit someone else's selection with the second condition.
Edit: However, this will not avoid using the simple URL for getting there. It requires controller extension.
 
That's not currently possible without modification.

It's not really a valid use case for most communities though I would have thought.

I wouldn't want random members on my site marking posts as the solution to question threads they have no involvement with.

I would only entrust that to specific members or staff, and if they are trusted to mark any other post then I don't see why they can't mark their own.
 
@Brogan - This is a great example. Please see the question I asked today and that you helped me.

I initially selected your post as the solution, because it is, however, I just changed it to select my "Thank you" post as the solution.

Does this look right?
Or, sure, it might look right. But do I really create my customization to make it work as I need, or couldn't we have a simple option in the admin to allow this or not.
 
I think I get what you're asking for now.

You can still only mark posts as the solution in your own question threads, just not your own posts.

That's still going to require custom dev to apply the check in PHP.

You can make a suggestion if there isn't one already.

However, there are valid cases when your own post is the solution.
We see it all the time here.
 
For the most part the conditional check will be fine.

Very few people will know how to manually craft a URL to bypass it.
 
For the most part the conditional check will be fine.

Very few people will know how to manually craft a URL to bypass it.
Yes.

Extending canMarkAsQuestionSolution function looks to be the real solution. I hate touching the core entities, but the developer team obviously gives no choice other than that. I thought submitting a suggestion for this, but then I realized it took me an hour to explain here. It is likely not something necessary for the majority.

One tiny simple option in the panel - "Do not allow member to mark their own posts as solution in their own questions" :) Not even a user group permission. :)

Thank you for your replies.
 
I hate touching the core entities, but the developer team obviously gives no choice other than that.
It can be extended with an add-on.

The software has been designed to be easily extended in that manner for this very reason.
 
It can be extended with an add-on.

The software has been designed to be easily extended in that manner for this very reason.
Oh sure. When I say extending a core entity, I mean with add-on.

I love XenForo framework. You can practically create any kind of application that would need ACL or API. That's awesome for developers.
As a forum, there is only one thing missing - nested posts in the answers like StackOverflow. The structure is already implemented for the Profile Posts, so it is hard to understand why it is not also used for the question threads.

For now, I just used the template modification solution as I posted above (just in case someone else might need this kind of setting). I'll create the add-on later. Thank you.
 
Top Bottom