01-15-2011, 08:42 AM
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:
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.
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):
[attachment=371]
Registered Views (can view general messages and message for Registered Usergroup only):
[attachment=372]
Awaiting Activation Views (can view general messages and message for Awaiting Activation Usergroup only):
[attachment=370]
All Message (Administrator Views, can view all message):
[attachment=367]
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:
- Title: Message For Guest
- Key: guest_msg
- Applicable Forums: 'select in whichever forums we will apply this message'
- Input Field Type: Multiline Textbox
- Editable by / Required Field?: Administrator
Modify it as our needs. - Display Parsing: Use MyBB Parser (MyCode)
- MyBB Parser Options: Check All, except the HTML, especially if we give the permission to use this fields to other usergroup beside Admin.
- Display Format:
HTML Code<br /><br /> <div class="pm_alert">{VALUE}</div>
- Viewable by Usergroups: Guest, Administrator.
Modify it as our needs. - Unviewable Value:
Code:
Variable in template for displaying this field is: {$GLOBALS['threadfields']['guest_msg']}.
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.
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):
[attachment=371]
Registered Views (can view general messages and message for Registered Usergroup only):
[attachment=372]
Awaiting Activation Views (can view general messages and message for Awaiting Activation Usergroup only):
[attachment=370]
All Message (Administrator Views, can view all message):
[attachment=367]