Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Contents Based On Usergroup
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Contents Based On Usergroup
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? Biggrin
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.
    • 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:
      &nbsp;

      Variable in template for displaying this field is: {$GLOBALS['threadfields']['guest_msg']}.

    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.

  1. Create postbit_first and/or postbit_first_classic template.
  2. Copy and paste the entire code of our
    • postbit to postbit_first template
    • postbit_classic to postbit_first_classic template.
  3. Find {$post['message']} in those news template
  4. 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):
   

(This post was last modified: 02-13-2011 03:21 AM by RateU.)
01-15-2011 08:42 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Contents Based On Usergroup - RateU - 01-15-2011 08:42 AM
RE: Contents Based On Usergroup - Imran - 01-15-2011, 11:59 PM
RE: Contents Based On Usergroup - 1master1 - 01-16-2011, 01:14 AM
RE: Contents Based On Usergroup - leefish - 01-16-2011, 07:59 AM
RE: Contents Based On Usergroup - Skiilz - 01-16-2011, 10:22 AM
RE: Contents Based On Usergroup - Chandy - 01-16-2011, 06:33 PM
RE: Contents Based On Usergroup - RateU - 01-17-2011, 05:02 AM
RE: Contents Based On Usergroup - WINBOY - 01-10-2014, 04:50 AM
RE: Contents Based On Usergroup - WINBOY - 01-11-2014, 04:09 AM
RE: Contents Based On Usergroup - WINBOY - 01-12-2014, 02:39 AM
RE: Contents Based On Usergroup - WINBOY - 01-23-2014, 10:24 PM
RE: Contents Based On Usergroup - WINBOY - 02-06-2014, 11:47 PM

 Standard Tools
Forum Jump: