MyBB Hacks

Full Version: Suggestion Forum
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Requirement: XThreads
Last Updated: 7 October 2012

This idea based on the MyBB Ideas section. When viewing the section, I think we can use XThreads to create a similar system for our forum. But we will try to make it for more general purpose.

Here is a simple example to do that:

Create or edit a forum with these settings:
  • Template Prefix: xtsug_
  • Show first post on every showthread page: Yes
  • Settings Overrides:
    • Setting: Showthread Options -> Post Layout
      Value: horizontal

      Code:
      postlayout=horizontal

  • Custom WOL Text:
    • Forum Display:

      HTML Code
      Viewing <a href="{1}">{2}</a>

    • New Thread:

      HTML Code
      Submitting a new suggestion

    • New Reply:

      HTML Code
      Commenting <a href="{1}">{2}</a> suggestion

    • Show Thread:

      HTML Code
      Reading <a href="{1}">{2}</a> suggestion

    Maybe we can disable the img and video tag and the post icons here (optional).

Create a Custom Thread Fields with these settings:
AdminCP -> Configuration -> Custom Thread Fields
  • Title: Status
  • Key: xtsug_status
  • Applicable Forums: 'select our suggestion forum.'
  • Input Field Type: Option Buttons
  • Values List:

    Code:
    Confirmed
    Implemented
    Rejected

  • Editable by / Required Field?: Administrators
  • Allow Filtering: Yes
  • Blank Replacement Value and Display Format:

    Code:
    <if $thread['replies'] > 0 then><div style="padding-top: 9px;"><a href="{$threadurl}#posts"><img src="images/comment.jpg" alt="" title="" /> {$thread['replies']}<if $thread['replies'] == 1 then> Comment<else> Comments</if></a></div></if>

    This status can be used to set whether a suggestion already implemented, or already confirmed and in progress to be implemented, or rejected (we don't want to implement it). This status can be used for a very simple bug report.


Create new templates in Global Template:
AdminCP -> Templates & Style -> Templates -> Global Templates
  1. xtsug_forumdisplay_thread

    HTML Code
    <tr>
    	{$rating}
    	<td class="trow1{$thread_type_class}">
    		<div>
    			<strong><a href="{$thread['threadlink']}" class="{$inline_edit_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a></strong>
    		</div>
    		<div class="author smalltext" style="padding-top: 3px;">
    			Submitted by: {$thread['profilelink']}, {$thread['threaddate']}, {$thread['threadtime']}
    		</div>
    		<div style="padding-top: 7px;">{$thread['postpreview']}</div>
    		{$GLOBALS['threadfields']['xtsug_status']}
    	</td>
    	{$modbit}
    </tr>

  2. xtsug_forumdisplay_threadlist

    HTML Code
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
    	<tr>
    		<td class="thead" colspan="{$colspan}">
    			<div class="largetext" style="text-align: center;"><strong>{$foruminfo['name']}</strong></div>
    		</td>
    	</tr>
    	<tr>
    		<td class="tcat" colspan="2">
    			<div class="float_right">
    				<strong>Filter:</strong>
    				<strong><a href="{$forumurl_q}filtertf_xtsug_status=Confirmed">Confirmed</a></strong> |
    				<strong><a href="{$forumurl_q}filtertf_xtsug_status=Implemented">Implemented</a></strong> |
    				<strong><a href="{$forumurl_q}filtertf_xtsug_status=Rejected">Rejected</a></strong>
    			</div>
    			<div class="float_left">
    				<strong>Sort:</strong>
    				<strong><a href="{$sorturl}&amp;sortby=started&amp;order=asc">Recent Suggested</a></strong> |
    				<strong><a href="{$sorturl}&amp;sortby=replies&amp;order=desc">Most Comments</a></strong>
    				{$ratingcol}
    			</div>
    		</td>
    		{$inlinemodcol}
    	</tr>
    	{$selectall}
    	{$announcementlist}
    	{$threads}{$nullthreads}
    </table>
    <div class="float_left">
    	{$multipage}
    </div>
    <div class="float_right" style="margin-top: 4px;">
    	{$newthread}
    </div>
    <br style="clear: both;" />
    <br />
    <div class="float_right" style="text-align: right;">
    	{$inlinemod}
    	{$searchforum}
    	{$forumjump}
    </div>
    <br style="clear: both" />
    <div class="smalltext" align="center">
    	{$foruminfo['name']}<br />Powered By <a href="http://mybbhacks.zingaburga.com">XThreads</a> - <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
    </div>
    {$inline_edit_js}

  3. xtsug_forumdisplay_threadlist_rating

    HTML Code
    &nbsp;| <strong><a href="{$sorturl}&amp;sortby=numratings&amp;order=desc">Votes</a></strong>

  4. xtsug_forumdisplay_thread_rating

    HTML Code
    <td align="center" class="{$bgcolor}{$thread_type_class}" id="rating_table_{$thread['tid']}" width="1" valign="top">
    	<a href="ratethread.php?tid={$thread['tid']}&amp;rating=1&amp;my_post_key={$mybb->post_code}"><img src="images/rate.jpg" alt="Vote" title="Vote" /></a>
    	<div><strong>{$thread['numratings']}</strong> Votes</div>
    </td>

  5. xtsug_postbit

    HTML Code
    {$ignore_bit}
    <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}" class="tborder">
    	<tbody>
    		<tr>
    			<td class="trow1 {$unapproved_shade}">
    				<div class="float_left smalltext">
    					by: <a href="{$post['profilelink_plain']}" id="profile_{$post['pid']}">{$post['username_formatted']}</a>
    					<br />{$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
    				</div>
    				{$post['posturl']}
    				<div class="post_body clear" id="pid_{$post['pid']}">{$post['message']}</div>
    				<div class="post_meta" id="post_meta_{$post['pid']}">{$post['iplogged']}</div>
    				<div id="profile_{$post['pid']}_popup" class="popup_menu" style="display: none;">
    					<div class="popup_item_container">
    						<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
    							<tr>
    								<td class="trow1" valign="top" align="center">
    									<div><strong>{$post['profilelink']}</strong></div>
    									<div class="smalltext">{$post['useravatar']}</div>
    									<div class="smalltext">{$post['usertitle']}</div>
    									<div class="smalltext">{$post['userstars']}</div>
    									<div class="smalltext">{$post['groupimage']}</div>
    									<div class="smalltext">{$post['user_details']}</div>
    								</td>
    							</tr>
    							<tr>
    								<td class="tcat" align="center">
    									{$post['button_email']}
    									{$post['button_pm']}
    									{$post['button_www']}
    									{$post['button_find']}
    									{$post['button_rep']}
    								</td>
    							</tr>
    						</table>
    					</div>
    				</div>
    				<div class="post_management_buttons float_right clear">
    					{$post['button_edit']}
    					{$post['button_quickdelete']}
    					{$post['button_quote']}
    					{$post['button_multiquote']}
    					{$post['button_report']}
    					{$post['button_warn']}
    				</div>
    			</td>
    		</tr>
    	</tbody>
    </table>
    <script type="text/javascript">
    // <!--
    	if(use_xmlhttprequest == "1")
    	{
    		new PopupMenu("profile_{$post['pid']}");
    	}
    // -->
    </script>

  6. xtsug_postbit_first

    HTML Code
    {$ignore_bit}
    <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}" width="100%">
    	<tbody>
    		<tr>
    			<td class="trow1 {$unapproved_shade}">
    				<div class="float_left smalltext">
    					Submitted by: <a href="{$post['profilelink_plain']}" id="profile_{$post['pid']}">{$post['username_formatted']}</a>, {$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
    				</div>
    				{$post['posturl']}
    				<div class="post_body clear" id="pid_{$post['pid']}">{$post['message']}</div>
    				<div class="post_meta" id="post_meta_{$post['pid']}">{$post['iplogged']}</div>
    				<div id="profile_{$post['pid']}_popup" class="popup_menu" style="display: none;">
    					<div class="popup_item_container">
    						<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
    							<tr>
    								<td class="trow1" valign="top" align="center">
    									<div><strong>{$post['profilelink']}</strong></div>
    									<div class="smalltext">{$post['useravatar']}</div>
    									<div class="smalltext">{$post['usertitle']}</div>
    									<div class="smalltext">{$post['userstars']}</div>
    									<div class="smalltext">{$post['groupimage']}</div>
    									<div class="smalltext">{$post['user_details']}</div>
    								</td>
    							</tr>
    							<tr>
    								<td class="tcat" align="center">
    									{$post['button_email']}
    									{$post['button_pm']}
    									{$post['button_www']}
    									{$post['button_find']}
    									{$post['button_rep']}
    								</td>
    							</tr>
    						</table>
    					</div>
    				</div>
    				<div class="post_management_buttons float_right clear">
    					{$post['button_edit']}
    					{$post['button_quickdelete']}
    					{$post['button_quote']}
    					{$post['button_multiquote']}
    					{$post['button_report']}
    					{$post['button_warn']}
    				</div>
    			</td>
    		</tr>
    	</tbody>
    </table>
    <script type="text/javascript">
    // <!--
    	if(use_xmlhttprequest == "1")
    	{
    		new PopupMenu("profile_{$post['pid']}");
    	}
    // -->
    </script>

  7. xtsug_postbit_first_posturl

    HTML Code
    <div style="float: right; width: auto; vertical-align: top">{$post['inlinecheck']}</div>

  8. xtsug_postbit_posturl

    HTML Code
    <div style="float: right; width: auto; vertical-align: top"><span class="smalltext"><strong><a href="{$post['postlink']}#pid{$post['pid']}">#{$postcounter}</a></strong>{$post['inlinecheck']}</span></div>

  9. xtsug_showthread

    HTML Code
    <html>
    <head>
    <title>{$thread['subject']}</title>
    {$headerinclude}
    <script type="text/javascript">
    <!--
    	var quickdelete_confirm = "{$lang->quickdelete_confirm}";
    // -->
    </script>
    <script type="text/javascript" src="jscripts/thread.js?ver=1600"></script>
    </head>
    <body>
    {$header}
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both;">
    	<tr>
    		<td class="thead" colspan="2">
    			<div>
    				<strong>{$thread['subject']}</strong>
    			</div>
    		</td>
    	</tr>
    	<tr>
    		{$ratethread}
    		<td class="trow1">
    			{$first_post}
    		</td>
    	</tr>
    </table>
    <br class="clear" />
    <div class="largetext float_right clear">Comments</div>
    <div id="posts" class="clear">
    	{$posts}
    </div>
    <div class="float_left">
    	{$multipage}
    </div>
    <div style="padding-top: 4px;" class="float_right">
    	{$newreply}
    </div>
    <br style="clear: both;" />
    {$quickreply}
    {$threadexbox}
    {$similarthreads}
    <br />
    <div class="float_right" style="text-align: right;">
    	{$moderationoptions}
    	{$forumjump}
    </div>
    <br style="clear: both;" />
    {$usersbrowsing}
    <div class="smalltext" align="center">
    	{$forum['name']}<br />Powered By <a href="http://mybbhacks.zingaburga.com">XThreads</a> - <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
    </div>
    {$footer}
    </body>
    </html>

  10. xtsug_showthread_noreplies

    HTML Code
    <table border="0" cellspacing="{$GLOBALS['theme']['borderwidth']}" cellpadding="{$GLOBALS['theme']['tablespace']}" id="xthreads_noreplies" class="tborder">
    	<tbody>
    		<tr>
    			<td class="trow1">
    				<div style="text-align: center;" class="post_body">There are no comments in this suggestion</div>
    			</td>
    		</tr>
    	</tbody>
    </table>

  11. xtsug_showthread_ratethread

    HTML Code
    <td align="center" class="trow1" valign="top">
    	<a href="ratethread.php?tid={$thread['tid']}&amp;rating=1&amp;my_post_key={$mybb->post_code}"><img src="images/rate.jpg" alt="Vote" title="Vote" /></a>
    	<div><strong>{$thread['numratings']}</strong> Votes</div>
    </td>



Additional Info:
  • For displaying the suggestion preview in threadlist, like the screenshot, we need to install the Thread Tooltip Preview plugin.
  • There are two optional images needed: images/rate.jpg and images/comment.jpg.
  • I don't have many idea, so, I just use a similar layout there. But it is depends on our themes though. So, just modify it as our needs.
  • The templates above based on MyBB 1.6 template.

Screenshots:
Threadlist - Showthread
[attachment=399] [attachment=400]

Live Demo: http://www.14.mynie.co.cc/forumdisplay.php?fid=18

Please tell me if I do something wrong. I'm still learning Smile

Change Logs: 05 February 2011
Great job RateU. Just to let everyone know, you need to add the comment.jpg, and vote.jpg yourself.
I added mine to match my site.

http://fbfanatics.tk/showthread.php?tid=29
(01-27-2011 07:49 AM)x-Treme Wrote: [ -> ]Just to let everyone know, you need to add the comment.jpg, and vote.jpg yourself.

Forgot to say that Biggrin
Thanks Smile

You have a very nice theme there Smile
Thank you.
Ugh... Forgot (again) to say this Biggrin
If we want to display the suggestion preview in threadlist, like the screenshot, we need to install Thread Tooltip Preview plugin. The templates above already used the variable for displaying the preview.
Thanks for the tutorial RateU!
Yes, thanks RateU!  Another outstanding tutorial!
Thank you RateU. Another great tutorial Smile
Smashing stuff - thats really good Smile
Update:
xtsug_forumdisplay_threadlist_rating template:

HTML Code
&nbsp;| <strong><a href="{$sorturl}&amp;sortby=numratings&amp;order=desc">Votes</a></strong>

Pages: 1 2 3 4
Reference URL's