MyBB Hacks

Full Version: Closed Thread Reason
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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.
    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
<div class="author smalltext">{$thread['profilelink']}</div>


Add this variable before the code above:

Code:
{$GLOBALS['threadfields']['ctr']}


So, the code will be like this:

HTML Code
{$GLOBALS['threadfields']['tcr']}<div class="author smalltext">{$thread['profilelink']}</div>


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

Magnificent, really magnificent. I was actually going to make such plugin (Not using XThreads), you did it first Smile
Interesting use, thanks for the tip!
Just installed, nice Smile
Where is the field should be edit for entering and typing "the reason"?
It'll show up when you (full) edit the first post.
Hi

I just installed xThreads and have added in the stuff for the Closed Thread reason. Is it possible to add the content into a table so it can be noticed (eg, using the theme table background etc)?
You can put the Closed Thread Reason in your forumdisplay_thread and/or your showthread/postbit/postbit_first template. You can style it as you want (depends on how the layout you want).

Basically, the Closed Thread Reason will be "called" by this variable in your template:

Code:
{$GLOBALS['threadfields']['tcr']}


You can style it directly from your template, or via the Display Format (again, depends on how the layout you want).

Not quite sure where and how exactly you want it to be displayed?

I mean, putting that variable inside table tags and displaying it inside a table.
Like I said before, you can style it directly in your template or in the Display Format.
If you want to style it directly in your template, put the variable inside your table tags.
If you want to style it in the Display Format, put the {VALUE} inside the table tags.
I did that, but it doesn't appear in a table. Erf
Pages: 1 2 3
Reference URL's