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
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #2
RE: Contents Based On Usergroup
Very nice!  This could be used as described or maybe even for some type of guest advertising...the possibilities are endless!

[Image: gallery_2_628_39582.jpg]
01-15-2011 08:52 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #3
RE: Contents Based On Usergroup
Nice Wink

[Image: logo.png]

[Image: twitter.png]
01-15-2011 11:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #4
RE: Contents Based On Usergroup
someone requested this at mybb, right? Wink

good try rateu
01-16-2011 01:14 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: Contents Based On Usergroup
Good try? Thats what we call damning with faint praise Smile

I think its great. Just gotta think of an application for it now....hmmm

/lee ponders


[Image: leelink.gif]
MYBB1.6 & XThreads
01-16-2011 07:59 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Skiilz Offline
Member
***
Posts: 198
Joined: Nov 2010
Post: #6
RE: Contents Based On Usergroup
Pretty good one. Going to use it on my forum.

[Image: 468x602b.png]
01-16-2011 10:22 AM
Find all posts by this user Quote this message in a reply
Chandy Offline
Junior Member
**
Posts: 6
Joined: Apr 2010
Post: #7
RE: Contents Based On Usergroup
Holy s** man,how many brains you have xD ?
Nice share,thanks Smile
01-16-2011 06:33 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #8
RE: Contents Based On Usergroup
Thanks Biggrin

01-17-2011 05:02 AM
Find all posts by this user Quote this message in a reply
WINBOY Offline
Member
***
Posts: 71
Joined: Nov 2012
Post: #9
RE: Contents Based On Usergroup
Excellent...One Problem is .....It not applicable on old threads as when i try to full edit old thread , there is no box for this guest message.
is any way to put this message in old thread?
thank you.
01-10-2014 04:50 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #10
RE: Contents Based On Usergroup
This affects both new and old threads.  Check that you've specified the right forums.

My Blog
01-10-2014 03:44 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: