Requirement:
XThreads
This is a basic usage of XThreads.
Maybe this is useless for you. But I have this in one of "my" real forum to give a different contents for a different usergroup. I use this most in my Announcement Area and in my
Main Area. This is one of the
core and the
most important feature in that forum.
Yeah, each forum has a different needs, right?
In this example application, I've modified it a bit to make it more general. So, maybe we can use this for other purposes.
Basically, we will try to use a single thread that has a different message / contents for a different usergroup. And, we have a general message that viewable for all usergroup.
This is a simple example for it.
Custom Thread Fields Setting:
AdminCP -> Configuration -> Custom Thread Fields:
Multiline Textbox for Messages:
Yeah, we use multiline textbox custom thread fields only. Basically, we need to set the Permission of each our multiline textbox. So, each message filled in each textarea only viewable by a specified usergroup.
Please remember that this is for example only. We need to modify it as our needs. We will use the custom thread fields below for displaying a specific messages for Guest Usergroup.
We only need to repeat the step above. Use a different key.
Now, we need to put the variable in our template. In this example, we will put the messages in first post only. We can display some message in every post in that thread if we want.
- Create postbit_first and/or postbit_first_classic template.
- Copy and paste the entire code of our
- postbit to postbit_first template
- postbit_classic to postbit_first_classic template.
- Find {$post['message']} in those news template
- Add our variable at the end or at the beginning of the variable above. In this example, we need to put {$GLOBALS['threadfields']['guest_msg']} variable.
Now, we can set a specific message for a specific usergroup. And the message viewable by that usergroup only. Use the default textarea for contents that viewable for all usergroups.
Example screenshot:
In this example, I've created a specific message for Guest only, Registered only, and Awaiting Activation only.
Guest Views (can view general messages and message for Guest Usergroup only):
Registered Views (can view general messages and message for Registered Usergroup only):
Awaiting Activation Views (can view general messages and message for Awaiting Activation Usergroup only):
All Message (Administrator Views, can view all message):