This is other simple example using XThreads Custom Thread Fields as plugin settings. Similar to displaying selected threads in portal. In this simple example, we will have a news bar contained selected threads. In this example, we will have more than one settings.
We need this settings for it:
Listbox to select a thread to be displayed in news bar. With this setting, we can select each news/thread whether we want to display it on every page (Global), Index, Portal Forumdisplay or Showthread. So, we can have a different news for for different area. And have some news available for all pages.
Create a custom thread fields with this setting:
Title: Display As News In
Key : xtnewsbar
Applicable Forums :select some forums
Input Field Type : Listbox
Field Input Height : 1
Values List :
Code:
Global
Index
Portal
Forumdisplay
Use file name (if the script name not given) in the Value List above for displaying a thread as newsbar for an additional page.
For example:
Code:
Games
If we have the above value inside our Value List, and there is a thread uses that value, then the thread will be displayed as newsbar on our Game Section page.
Editable by / Required Field? : Administrators.
If we want to give this "power" to some usergroups like Super Moderator and Moderator, select Custom (specify usergroups), and select those usergroups in Editable by Usergroups setting.
Display Order : 20
Modify it as our needs. Use a big number. So, it will be displayed at the very end of other custom thread fields applied in that forum. And because we use more than one setting, with this way we can make it "grouped".
We can use Settable Value Permissions setting to prevent some usergroups for displaying a thread as news to some area.
For example:
We have these values inside our Value List:
Code:
1 2 3 4 5 6
Global
Index
Portal
Games
Forumdisplay
Showthread
And we have these values inside our Settable Value Permissions setting:
Code:
Global{|}3,4
Index{|}3,4
Portal{|}3,4
Games{|}3,4
It means that only Administrators and Super Moderators have an ability to set a thread as news in the newsbar to be displayed on every page, index, portal and our games section (assuming that we set our Moderators can use this custom thread fields, it means that they can help us to set a thread as news in our newsbar for forumdisplay and showthread only).
Listbox to select a CSS class for each news bar. With this setting, we can use a different style for each news. If we want to edit the newsbar style, edit the xtnewsbar.css stylesheet inside each theme's style to edit the bars style. Please remember, if we change or add a class name, we need to change or add it to our xtnewsbar.css stylesheet too.
Create a custom thread fields with this setting:
Editable by / Required Field? : Administrators.
Or make it the same as usergroups selected in setting 1.
Display Order : 21
This will make this input field displayed bellow the setting 1.
We can use Settable Value Permissions setting to prevent some usergroups for using some styles.
Textbox to add "prefix" for each news. Not filtered fields. This is only to put some text before the thread title. With this way, we can have different "prefix" for each news.
Create a custom thread fields with this setting:
Title: News Prefix
Key : xtnewsbar_prefix
Applicable Forums :select the forum above
Input Field Type : Textbox
Editable by / Required Field? : Administrators.
Or make it the same as usergroups selected in setting 1 and 2.
Display Order : 22
This will make this input field displayed bellow the setting 2.
That is our settings
Additional Info:
If we use Thread Tooltip Preview plugin, we will have a preview in tooltip, when hovering cursor to each bar.
Because there is an option to load the newsbar globally (every page), so our newsbar uses MyBB cache system.
Use this URL to update the cache manually: xtnewsbar=1 (I don't know whether it is better or not if we use tasks system for this?).
Only Admin and Moderators can update the cache.
Example from index page:
Code:
index.php?xtnewsbar=1
If there is a thread comes from a forum that a user doesn't have permission to view it, then that bar won't be displayed for that user.