09-23-2010, 06:28 AM
Requirement: The latest XThreads Version (at least v1.32).
Now, XThreads has a fantastic conditional feature. Amazing. Really really amazing!
This is a simple example application that use that feature.
Adding a reason for closed thread.
Now, we need to put {$GLOBALS['threadfields']['ctr']} variable in our forumdisplay_thread template or template_prefix_forumdisplay_thread template if we use template prefix for the forum.
Find this code:
Now, XThreads has a fantastic conditional feature. Amazing. Really really amazing!
This is a simple example application that use that feature.
Adding a reason for closed thread.
-
Create a custom thread fields with this settings:
- Title: Closed Thread Reason
- Key: ctr
- Applicable Forums : Select forum that we want to appliy it
- Input Field Type : Textbox
- Editable by / Required Field?: Administrators
Modify it as our needs. Basically, we should give this power to usergroups which has an ability to closed a thread.
We can choose Custom (specify usergroups) from the list, then select those usergroup in the Editable by Usergroups list. - Blank Replacement Value :
HTML Code<if $thread['closed'] == 1 then> <div class="smalltext"><strong>Closed Thread Reason:</strong></div> <div class="smalltext" style="color: red;"><em>Not specified</em></div> </if>
Modify it as our needs. This layout will be displayed if the thread closed without any reason (the Closed Thread Reason textbox not filled).
- Display Format :
HTML Code<if $thread['closed'] == 1 then> <div class="smalltext"><strong>Closed Thread Reason:</strong></div> <div class="smalltext" style="color: red;"><em>{VALUE}</em></div> </if>
Now, we need to put {$GLOBALS['threadfields']['ctr']} variable in our forumdisplay_thread template or template_prefix_forumdisplay_thread template if we use template prefix for the forum.
Find this code:
HTML Code
|
Add this variable before the code above:
Code:
|
So, the code will be like this:
HTML Code
|
Do that with search_results_threads_thread template too if we want the reason displayed in search result.
Screenshot:
Threadlist and search result
[attachment=211] [attachment=212]
Live Demo:
http://mynie.6te.net/demo/forumdisplay.php?fid=33