Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Contact Us System
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Contact Us System
Requirement: XThreads
Latest Update: 7 October 2012

We can use XThreads for Contact Us system. We will combine it with Quick Thread plugin.

Here is a simple example for it:

Custom Thread Fields Setting:
  1. Textbox for Name:
    Create a Custom Thread Fields with this settings:
    • Title: Name
    • Key: contus_name
    • Applicable Forums: 'select a forum that we will apply for this system'
    • Input Field Type: Textbox
    • Editable by / Required Field?: Everyone (required)
      Variable in template for displaying this field is: {$GLOBALS['threadfields']['contus_name']}.
  2. Textbox for E-Mail:
    Create a Custom Thread Fields with this settings:
    • Title: E-Mail
    • Key: contus_email
    • Applicable Forums: 'select a forum above'
    • Input Field Type: Textbox
    • Editable by / Required Field?: Everyone (required)
    • Display Order: 2
    • Text Mask Filter: Email address
      Variable in template for displaying this field is: {$GLOBALS['threadfields']['contus_email']}.
  3. Listbox for Category:
    Create a Custom Thread Fields with this settings:
    • Title: Category
    • Key: contus_cat
    • Applicable Forums: 'select the forum above'
    • Input Field Type: Listbox
    • Field Input Height: 1
    • Values List:

      Code:
      Account
      Support
      Other

      Modify it as our needs.

    • Editable by / Required Field?: Everyone (required)
    • Display Order: 3
    • Allow Filtering: Yes
      We put the filtering url manually in template:
      Template #4 - contus_forumdisplay_inlinemoderation_col - line #18 - #20
      So, if we want to modify the value lists, we need to modify those templates too.
  4. Multiline Textbox for Message:
    Create a Custom Thread Fields with this settings:
    • Title: Message
    • Key: contus_msg
    • Applicable Forums: 'select a forum above'
    • Input Field Type: Multiline Textbox
    • Field Input Width: 62
      Modify it as our needs. This is the width of the textarea.
    • Editable by / Required Field?: Everyone (required)
    • Display Parsing: Plain text with new lines
    • Display Order: 4
      Variable in template for displaying this field is: {$GLOBALS['threadfields']['contus_msg']}.
  5. Listbox for Status:
    Create a Custom Thread Fields with this settings:
    • Title: Status
    • Key: contus_status
    • Applicable Forums: 'select the forum above'
    • Input Field Type: Listbox
    • Field Input Height: 1
    • Values List:

      Code:
      New
      Confirmed
      Ignored

      Modify it as our needs.

    • Editable by / Required Field?: Everyone
    • Display Order: 5
    • Allow Filtering: Yes
      We put the filtering url manually in template:
      Template #4 - contus_forumdisplay_inlinemoderation_col - line #11 - #13
      So, if we want to modify the value lists, we need to modify those templates too.
    • Default Value: New
    • Display Format:

      HTML Code
      <a href="{$forumurl?}filtertf_contus_status={VALUE}">{VALUE}</a>

    • Hide Input Field: Yes
      We put this input field manually in our templates:
      Template #1 - contus_editpost_first - line#23


Edit the selected forum with this XThreads Options settings:
  1. Template Prefix:

    Code:
    <if $mybb->usergroup['cancp'] then>contus_admin_,</if>contus_

  2. Language File Prefix: contus_
  3. Show first post on every showthread page: Yes
  4. Hide Forum: Yes
    We need to put this forum url manually in our templates (e.g: header template). Or, we can put this forum url in Contact Us Link under Admin CP -> Configuration -> Settings -> General Configuration -> Contact Us Link.
  5. Allow Blank Post Message: Yes
  6. Settings Overrides:
    • Setting: Showthread Options -> Post Layout
      Value: horizontal

      Code:
      postlayout=horizontal

  7. Default Thread Filter:
    • Field: contus_status
    • Value: New

    Code:
    contus_status=New

  8. Custom WOL Text:
    • Forum Display: Contact Us
    • New Thread: Using Contact Us Form


Then, we need this additional settings for that forum:
  1. Moderation Options: Yes, moderate new threads
  2. Forum Permissions:
    Don't use these settings for Administrator or user group which can manage the submitted forms (Unapproved Threads).

    Basically, we need these settings for Guest user group, so they can use the form.
    If we want registered user group has an ability to use this form, we need to set their permission like this too.

    Use these forum permissions settings for each user group which is allowed to use the Contact Us form. Only thick these options:
    • Use custom permissions (below)
    • Can view forum?
    • Can post threads?


Now, we need to create new templates in Global Template.
Admin CP -> Templates & Style -> Templates -> Global Templates:
  1. Template Name: contus_editpost_first

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    <html>
    <head>
    <title>{$mybb->settings['bbname']} - {$lang->edit_post}</title>
    {$headerinclude}
    <script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
    </head>
    <body>
    {$header}
    <form action="editpost.php?pid={$pid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
    	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    	<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
    		<tr>
    			<td></td>
    			<td width="620">
    				{$preview}
    				{$post_errors}
    				<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
    					<tr>
    						<td colspan="2" class="thead">
    							<strong>{$lang->edit_post}</strong>
    						</td>
    					</tr>
    					{$tfinputrow['contus_status']}
    					<tr>
    						<td class="trow1" width="22%">
    							<strong>{$lang->subject}</strong>
    						</td>
    						<td class="trow1">
    							<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" />
    						</td>
    					</tr>
    					{$extra_threadfields}
    					<tr style="display: none;">
    						<td class="trow2" valign="top">
    							<strong>{$lang->your_message}:</strong>
    						</td>
    						<td class="trow2">
    							<textarea name="message" id="message" rows="20" cols="70" tabindex="3">{$message}</textarea>
    						</td>
    					</tr>
    					<tr>
    						<td colspan="2" align="center" class="tfoot">
    							<input type="submit" class="button" name="submit" value="{$lang->update_post}" tabindex="3" />
    							<input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="4" />
    						</td>
    					</tr>
    				</table>
    			</td>
    			<td></td>
    		</tr>
    	</table>
    	<input type="hidden" name="action" value="do_editpost" />
    	<input type="hidden" name="posthash" value="{$posthash}" />
    	<input type="hidden" name="attachmentaid" value="" />
    	<input type="hidden" name="attachmentact" value="" />
    </form>
    <br />
    <form action="editpost.php" method="post" name="editpost">
    	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
    		<tr>
    			<td colspan="3" class="thead">
    				<strong>{$lang->delete_post}</strong>
    			</td>
    		</tr>
    		<tr>
    			<td class="trow1" style="white-space: nowrap; width: 15%;" align="center">
    				<input type="checkbox" class="checkbox" name="delete" value="1" tabindex="9" /><br />
    				<strong>{$lang->delete_q}</strong>
    			</td>
    			<td class="trow1" width="70%">
    				{$lang->delete_1}<br />
    				<span class="smalltext">{$lang->delete_2}</span>
    			</td>
    			<td class="trow1">
    				<input type="submit" class="button" name="submit" value="{$lang->delete_now}" tabindex="10" />
    			</td>
    		</tr>
    	</table>
    	<input type="hidden" name="action" value="deletepost" />
    	<input type="hidden" name="pid" value="{$pid}" />
    </form>
    {$footer}
    </body>
    </html>

  2. Template Name: contus_forumdisplay

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <html>
    <head>
    <title>{$mybb->settings['bbname']} - {$foruminfo['name']} </title>
    {$headerinclude}
    {$rssdiscovery}
    <script type="text/javascript">
    <!--
    	lang.no_new_posts = "{$lang->no_new_posts}";
    	lang.click_mark_read = "{$lang->click_mark_read}";
    // -->
    </script>
    </head>
    <body>
    {$header}
    {$usersbrowsing}
    {$rules}
    {$quickthread}
    {$threadslist}
    {$footer}
    </body>
    </html>

  3. Template Name: contus_forumdisplay_inlinemoderation
    For 1.4:

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    </table>
    </td>
    </tr>
    <tr>
    	<td align="right">
    		<script type="text/javascript" src="jscripts/inline_moderation.js?ver=1400"></script>
    		<form action="moderation.php" method="post">
    			<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    			<input type="hidden" name="fid" value="{$fid}" />
    			<input type="hidden" name="modtype" value="inlinethread" />
    			<span class="smalltext"><strong>{$lang->inline_thread_moderation}</strong></span>
    			<select name="action">
    				<optgroup label="{$lang->standard_mod_tools}">
    					<option value="multiclosethreads">{$lang->close_threads}</option>
    					<option value="multiopenthreads">{$lang->open_threads}</option>
    					<option value="multistickthreads">{$lang->stick_threads}</option>
    					<option value="multiunstickthreads">{$lang->unstick_threads}</option>
    					<option value="multideletethreads">{$lang->delete_threads}</option>
    					<option value="multimovethreads">{$lang->move_threads}</option>
    					<option value="multiunapprovethreads">{$lang->unapprove_threads}</option>
    				</optgroup>
    				{$customthreadtools}
    			</select>
    			<input type="submit" class="button" name="go" value="{$lang->inline_go} ({$inlinecount})" id="inline_go" />&nbsp;
    			<input type="button" onclick="javascript:inlineModeration.clearChecked();" value="{$lang->clear}" class="button" />
    		</form>
    		<script type="text/javascript">
    		<!--
    			var go_text = "{$lang->inline_go}";
    			var inlineType = "forum";
    			var inlineId = {$fid};
    		// -->
    		</script>
    	</td>
    </tr>


    For 1.6:

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    </table>
    </td>
    </tr>
    <tr>
    	<td align="right">
    		<script type="text/javascript" src="jscripts/inline_moderation.js?ver=1600"></script>
    		<form action="moderation.php" method="post">
    			<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    			<input type="hidden" name="fid" value="{$fid}" />
    			<input type="hidden" name="modtype" value="inlinethread" />
    			<span class="smalltext"><strong>{$lang->inline_thread_moderation}</strong></span>
    			<select name="action">
    				<option value="delayedmoderation">{$lang->delayed_moderation}</option>
    				<optgroup label="{$lang->standard_mod_tools}">
    					<option value="multiclosethreads" selected="selected">{$lang->close_threads}</option>
    					<option value="multiopenthreads">{$lang->open_threads}</option>
    					<option value="multistickthreads">{$lang->stick_threads}</option>
    					<option value="multiunstickthreads">{$lang->unstick_threads}</option>
    					<option value="multideletethreads">{$lang->delete_threads}</option>
    					<option value="multimovethreads">{$lang->move_threads}</option>
    					<option value="multiunapprovethreads">{$lang->unapprove_threads}</option>
    				</optgroup>
    				{$customthreadtools}
    			</select>
    			<input type="submit" class="button" name="go" value="{$lang->inline_go} ({$inlinecount})" id="inline_go" />&nbsp;
    			<input type="button" onclick="javascript:inlineModeration.clearChecked();" value="{$lang->clear}" class="button" />
    		</form>
    		<script type="text/javascript">
    		<!--
    			var go_text = "{$lang->inline_go}";
    			var all_text = "{$threadcount}";
    			var inlineType = "forum";
    			var inlineId = {$fid};
    		// -->
    		</script>
    	</td>
    </tr>

  4. Template Name: contus_forumdisplay_inlinemoderation_col

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    <tr>
    	<td>&nbsp;</td>
    </tr>
    <tr>
    	<td>
    		<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both;">
    			<tr>
    				<td colspan="9" class="thead">
    					<div class="float_left smalltext">
    						<strong>Status Filter:
    							<a href="{$forumurl_q}filtertf_contus_status=New">New</a> |
    							<a href="{$forumurl_q}filtertf_contus_status=Confirmed">Confirmed</a> |
    							<a href="{$forumurl_q}filtertf_contus_status=Ignored">Ignored</a>
    						</strong>
    					</div>
    					<div class="float_right smalltext">
    						<strong>Category Filter:
    							<a href="{$forumurl_q}filtertf_contus_cat=Account">Account</a> |
    							<a href="{$forumurl_q}filtertf_contus_cat=Support">Support</a> |
    							<a href="{$forumurl_q}filtertf_contus_cat=Other">Other</a>
    						</strong>
    					</div>
    					<div align="center">
    						<a href="{$forumurl}"><strong>Submitted Forms</strong></a>
    					</div>
    				</td>
    			</tr>
    			<tr>
    				<td class="tcat" align="center" width="1">
    					<input type="checkbox" name="allbox" onclick="inlineModeration.checkAll(this)" />
    				</td>
    				<td class="tcat smalltext" align="center">
    					<strong>{$lang->thread}</strong>
    				</td>
    				<td class="tcat smalltext" align="center">
    					<strong>Status</strong>
    				</td>
    				<td class="tcat smalltext" align="center">
    					<strong>Category</strong>
    				</td>
    				<td class="tcat smalltext" align="center">
    					<strong>{$lang->replies}</strong>
    				</td>
    				<td class="tcat smalltext" align="center">
    					<strong>{$lang->views}</strong>
    				</td>
    				<td class="tcat smalltext" align="center">
    					<strong>{$lang->lastpost}</strong>
    				</td>
    			</tr>

  5. Template Name: contus_forumdisplay_nothreads

    HTML Code
    <tr><td></td></tr>

  6. Template Name: contus_forumdisplay_quick_thread

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    <form method="post" action="newthread.php?fid={$fid}&amp;processed=1" name="quick_thread_form" id="quick_thread_form">
    	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    	<input type="hidden" name="action" value="do_newthread" />
    	<input type="hidden" name="posthash" value="{$posthash}" id="posthash" />
    	<input type="hidden" name="xthreads_contus_status" value="New" />
    	<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
    		<tr>
    			<td></td>
    			<td width="620">
    				<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
    					<thead>
    						<tr>
    							<td colspan="2" class="thead">
    								<div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['quickthread']}.gif" id="quickthread_img" class="expander" alt="[-]" title="[-]" /></div>
    								<div><strong>Contact Us</strong></div>
    							</td>
    						</tr>
    					</thead>
    					<tbody style="{$collapsed['quickthread_e']}" id="quickthread_e">
    						<tr>
    							<td valign="top" width="22%" class="trow1">
    								<strong>{$lang->subject}</strong>
    							</td>
    							<td class="trow1">
    								<div style="width: 95%">
    									<input type="text" class="textbox" name="subject" size="40" maxlength="85" tabindex="1" />
    								</div>
    							</td>
    						</tr>
    						{$GLOBALS['extra_threadfields']}
    						{$captcha}
    						<tr>
    							<td colspan="2" align="center" class="tfoot">
    								<input type="submit" class="button" value="Submit" tabindex="2" accesskey="s" id="quick_thread_submit" />
    								<input type="submit" class="button" name="previewpost" value="Preview" tabindex="3" />
    							</td>
    						</tr>
    					</tbody>
    				</table>
    				<br />
    				<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
    					<tr>
    						<td valign="middle" align="center" class="smalltext">
    							Contact Us
    							<div>
    								Powered By <a href="http://mybbhacks.zingaburga.com/showthread.php?tid=288">XThreads</a> - <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
    							</div>
    						</td>
    					</tr>
    				</table>
    			</td>
    			<td></td>
    		</tr>
    	</table>
    </form>

  7. Template Name: contus_admin_forumdisplay_quick_thread

    HTML Code
    <div></div>

  8. Template Name: contus_forumdisplay_thread

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    <tr>
    	{$modbit}
    	<td class="{$bgcolor}">
    		{$attachment_count}
    		<div>
    			<span>{$prefix} {$gotounread}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>
    			<div class="author smalltext">{$thread['threaddate']}, {$thread['threadtime']}</div>
    		</div>
    	</td>
    	<td align="center" class="{$bgcolor}">
    		{$GLOBALS['threadfields']['contus_status']}
    	</td>
    	<td align="center" class="{$bgcolor}">
    		<a href="{$forumurl_q}filtertf_contus_cat={$GLOBALS['threadfields']['contus_cat']}">{$GLOBALS['threadfields']['contus_cat']}</a>
    	</td>
    	<td align="center" class="{$bgcolor}">
    		<a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a>{$unapproved_posts}
    	</td>
    	<td align="center" class="{$bgcolor}">
    		{$thread['views']}
    	</td>
    	<td class="{$bgcolor}" style="white-space: nowrap; text-align: right;" colspan="2">
    		<span class="lastpost smalltext">{$lastpostdate} {$lastposttime}<br />
    		<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}</span>
    	</td>
    </tr>

  9. Template Name: contus_forumdisplay_threadlist

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%" style="clear: both;">
    	{$inlinemodcol}
    	{$threads}{$nullthreads}
    	{$inlinemod}
    </table>
    <div class="float_left">
    	{$multipage}
    </div>
    <br style="clear: both;" />
    <div class="float_right" style="text-align: right;">
    	{$searchforum}
    </div>
    <br style="clear: both" />
    {$inline_edit_js}

  10. Template Name: contus_newthread

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    <html>
    <head>
    <title>Contact Us</title>
    {$headerinclude}
    <script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
    </head>
    <body>
    {$header}
    <form action="newthread.php?fid={$fid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
    	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    	<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
    		<tr>
    			<td></td>
    			<td width="620">
    				{$thread_errors}
    				{$preview}
    				<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
    					<thead>
    						<tr>
    							<td colspan="2" class="thead">
    								<div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['quickthread']}.gif" id="quickthread_img" class="expander" alt="[-]" title="[-]" /></div>
    								<div><strong>Contact Us</strong></div>
    							</td>
    						</tr>
    					</thead>
    					<tbody style="{$collapsed['quickthread_e']}" id="quickthread_e">
    						<tr>
    							<td width="22%" class="trow1">
    								<strong>Subject</strong>
    							</td>
    							<td class="trow1">
    								<div style="width: 95%">
    									<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" />
    								</div>
    							</td>
    						</tr>
    						{$extra_threadfields}
    						{$captcha}
    						<tr>
    							<td colspan="2" align="center" class="tfoot">
    								<input type="submit" class="button" name="submit" value="Submit" tabindex="4" accesskey="s" />
    								<input type="submit" class="button" name="previewpost" value="Preview" tabindex="5" />
    							</td>
    						</tr>
    					</tbody>
    				</table>
    				<br />
    				<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
    					<tr>
    						<td valign="middle" align="center" class="smalltext">
    							Contact Us
    							<div>
    								Powered By <a href="http://mybbhacks.zingaburga.com/showthread.php?tid=288">XThreads</a> - <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
    							</div>
    						</td>
    					</tr>
    				</table>
    			</td>
    			<td></td>
    		</tr>
    	</table>
    	<br />
    	<input type="hidden" name="action" value="do_newthread" />
    	<input type="hidden" name="posthash" value="{$posthash}" />
    	<input type="hidden" name="xthreads_contus_status" value="New" />
    	<input type="hidden" name="attachmentaid" value="" />
    	<input type="hidden" name="attachmentact" value="" />
    	<input type="hidden" name="quoted_ids" value="{$quoted_ids}" />
    	<input type="hidden" name="tid" value="{$tid}" />
    	{$editdraftpid}
    </form>
    {$footer}
    </body>
    </html>

  11. Template Name: contus_postbit_first

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    {$ignore_bit}
    <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
    	<tbody>
    		<tr>
    			<td class="tcat">
    				<div class="float_left smalltext">
    					{$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
    				</div>
    				{$post['posturl']}
    			</td>
    		</tr>
    		<tr>
    			<td class="trow1 post_content {$unapproved_shade}" style="border-bottom: 2px solid #0F5C8E;" colspan="2">
    				<table border="0" width="100%">
    					<tr>
    						<td valign="top" colspan="3"><strong>{$GLOBALS['threadfields']['contus_status']}</strong></td>
    					</tr>
    					<tr>
    						<td width="75" valign="top">Subject</td>
    						<td width="1" valign="top">:</td>
    						<td valign="top">{$post['subject']} {$post['subject_extra']}</td>
    					</tr>
    					<tr>
    						<td width="75" valign="top">Name</td>
    						<td width="1" valign="top">:</td>
    						<td valign="top">{$GLOBALS['threadfields']['contus_name']}</td>
    					</tr>
    					<tr>
    						<td width="75" valign="top">E-Mail</td>
    						<td width="1" valign="top">:</td>
    						<td valign="top">{$GLOBALS['threadfields']['contus_email']}</td>
    					</tr>
    					<tr>
    						<td width="75" valign="top">Category</td>
    						<td width="1" valign="top">:</td>
    						<td valign="top">{$GLOBALS['threadfields']['contus_cat']}</td>
    					</tr>
    					<tr>
    						<td valign="top" colspan="3"><br />{$GLOBALS['threadfields']['contus_msg']}</td>
    					</tr>
    				</table>
    				<div class="post_meta" id="post_meta_{$post['pid']}">
    					{$post['iplogged']}
    				</div>
    				<br class="clear" />
    				<div class="author_buttons float_left">
    					{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}
    				</div>
    				<div class="post_management_buttons float_right">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
    				</div>
    			</td>
    		</tr>
    	</tbody>
    </table>

  12. Template Name: contus_post_captcha

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    <tr id="captcha_trow">
    	<td valign="top" colspan="2" class="tcat">
    		<strong>{$lang->image_verification}</strong>
    	</td>
    </tr>
    <tr>
    	<td colspan="2" class="trow1">
    		<script type="text/javascript" src="jscripts/captcha.js?ver=1400"></script>
    		<table style="width: 100%; padding: 4px;">
    			<tr>
    				<td width="40%" align="center">
    					<img src="captcha.php?imagehash={$imagehash}" alt="{$lang->image_verification}" title="{$lang->image_verification}" id="captcha_img" /><br />
    					<span style="color: red;" class="smalltext">{$lang->verification_subnote}</span>
    					<script type="text/javascript">
    					<!--
    						if(use_xmlhttprequest == "1")
    						{
    							document.write('<br \/><input type="button" class="button" name="refresh" value="{$lang->refresh}" onclick="return captcha.refresh();" \/>');
    						}
    					// -->
    					</script>
    				</td>
    				<td valign="top">
    					<div class="smalltext">{$lang->verification_note}</div>
    					<br />
    					<div align="center">
    						<input type="text" class="textbox" name="imagestring" value="" id="imagestring" /><input type="hidden" name="imagehash" value="{$imagehash}" id="imagehash" />
    					</div>
    				</td>
    			</tr>
    		</table>
    	</td>
    </tr>

  13. Template Name: contus_threadfields_inputrow

    HTML Code
    <tr>
    	<td class="trow1"><strong>{$tf['title']}</strong></td>
    	<td class="trow1">{$inputfield}<small style="display: block;">{$tf['desc']}</small></td>
    </tr>



We can do anything with the submitted form (unapproved thread) in this forum, like edit, delete, change their status, edit their category and etc. But please, don't ever to approve it. If we approve a thread in this forum id, the thread will be shown in the thread list, below the contact us form. And because XThreads tightly integrated to MyBB, we have a full control for it, like adding field to the form, removing some fields, editing some field in our contact us form, using MyBB forum permissions, managing the submitted form (the unapproved threads) and etc. Yeah, Yumi does a lot of magics to XThreads.

Edit Log:
15 September 2010 - 11 February 2011 - 19 March 2011 - 21 July 2011


Screenshoots:

1. Here is our contact us form. And this is how the thread list layout should be viewed by Guest or other user group which has access to the form.
   

2. XThreads and MyBB validation error. Of course.
   

3. We still have the built in MyBB preview thread function.
   

4. This is how the layout for Admin. With this way we have an ability to manage the submitted form (unapproved threads)
   

5. Editing the thread will give us an access to an hidden thread fields. In the example above, Status. The field can be accessed from editing page only. It will make us easier to track whether the submitted form already responded - Confirmed, or not responded yet - New, or even a spam - Ignored. We already have a filtering url for this in thread list.
       
Like said before, the only thing that we can't do in this forum is approving a thread.

6. Postbit. Yeah, standard postbit. We use it only to read the submitted form / thread contents.
   

Additional Info:
We use language file prefix for redirect message (attached). Upload it to our inc/languages/english/ folder or edit/modify it, and upload it to our language folder.

Live Demo:
http://www.14.mynie.co.cc/forumdisplay.php?fid=26
You can try the Contact Us form there. Just use a fake name and a fake e-mail address.
That is a forum in a free host and free domain. Please forgive me if the forum down for an hour, even all a day.


Attached File(s)
.7z  contus_newthread.lang.php.7z (Size: 397 bytes / Downloads: 896)

(This post was last modified: 10-08-2012 02:53 AM by RateU.)
07-11-2010 12:55 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Contact Us System
Holy cow, I never even thought such a thing would be possible.  You've got a very creative mind there RateU Smile

BTW, you could also possibly remove the approve/unapprove thread option from moderation options dropdown (if you haven't already) but it's not a big deal as only admins are viewing the threads.

My Blog
07-11-2010 03:27 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: Contact Us System
Hi RateU - I tested and it looks awesome. I did notice the redirect text was standard:

Quote:Thank you, your thread has been posted.
The administrator has specified that all new threads require moderation. You will now be returned to the thread listing.

I don't know if that could be changed to something like thank you for contacting us we will get back to you... It would just be added awesomeness.


[Image: leelink.gif]
MYBB1.6 & XThreads
07-11-2010 08:18 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Contact Us System
That would need an additional plugin unfortunately.  Maybe I'll implement some language string overrider, but I doubt it at this stage.

General gist of the plugin (contus.php) should be like:

PHP Code:
1
2
3
4
5
6
7
8
9
10
$plugins->add_hook('newthread_do_newthread_end', 'lang_override');
function lang_override() {
 if($GLOBALS['fid'] != 2) return; // replace "2" with the fid of the forum
 global $visible, $lang;
 if(!$visible) $lang->redirect_newthread = 'Thank you for contacting us.';
}

function contus_info() {
 return array('name' => 'Contact Us Forum language override');
}


My Blog
07-11-2010 09:13 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #5
RE: Contact Us System
(07-11-2010 03:27 PM)ZiNgA BuRgA Wrote:  BTW, you could also possibly remove the approve/unapprove thread option from moderation options dropdown (if you haven't already) but it's not a big deal as only admins are viewing the threads.

Ah, yes, yes. I never thought removing the approve posts option there. I think it's important to prevent "missed" operation there. Thank you very much, Yumi Smile I have edited it.

(07-11-2010 08:18 PM)leefish Wrote:  Hi RateU - I tested and it looks awesome. I did notice the redirect text was standard:

Quote:Thank you, your thread has been posted.
The administrator has specified that all new threads require moderation. You will now be returned to the thread listing.

I don't know if that could be changed to something like thank you for contacting us we will get back to you... It would just be added awesomeness.

Hi... hi... hi... I knew it before creating this example, Lee Biggrin But I don't want to give a "bad" way for this in template level. If you try to submit a form again, you will view the custom message. But, yes, it is the "bad way" in template level in that forum id. That's why i didn't put that template modification in this example. I think it is better to do it in plugin level.

(07-11-2010 09:13 PM)ZiNgA BuRgA Wrote:  General gist of the plugin (contus.php) should be like:

PHP Code:
1
2
3
4
5
6
$plugins->add_hook('newthread_do_newthread_end', 'lang_override');
function lang_override() {
 if($GLOBALS['fid'] != 2) return; // replace "2" with the fid of the forum
 global $visible, $lang;
 if(!$visible) $lang->redirect_newthread = 'Thank you for contacting us.';
}


Hi... hi... hi... I think I did it wrong, Yumi. What I did to one of my friend's forum (I use this contact us form in that forum) is, bumping the guest to a "customized" error page after the thread has been created Biggrin Something like this:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
$plugins->add_hook('newthread_do_newthread_end', 'xtcu_bump');
function xtcu_bump()
{
	if($GLOBALS['fid'] == 16 && !$GLOBALS['visible'])
	{
		error('
			<div align="center">
				Your form submission has been submitted successfully.<br />
				We will respond it as soon as possible
			</div>
			', 'Form Submitted');
	}
}

Thanks again, Yumi Smile


07-12-2010 08: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: #6
RE: Contact Us System
^ Hey, that's probably a nicer solution, as it doesn't redirect the user back.  Nice thinking there Smile

My Blog
07-12-2010 09:15 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #7
RE: Contact Us System
Very nice Smile

[Image: logo.png]

[Image: twitter.png]
08-04-2010 06:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: Contact Us System
This is super awesome and I have installed on my forum. I JUST updated to 1.6 and now I have a problem with this layout allowing a blank message. I checked my forum and category setting (this is in a separate category and forum of its own) and both are set to allow posts with no message. I can post it all ok, but not edit it later - I am getting an attach error regarding no message. Any idea what I may be doing wrong? It was fine before the upgrade.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 08-13-2010 12:34 PM by leefish.)
08-11-2010 11:03 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #9
RE: Contact Us System
I didn't "play" much with 1.6 Biggrin But I hope this can help, Lee:

At least there are two problem found applying this Contact Us to MyBB v1.6:

1. When editing a thread, we are prompted with an error message "The message is missing. Please enter a message.".
Solution:
Add this code after {$extra_threadfields} variable in contus_editpost_first template.

HTML Code
1
2
3
4
5
6
7
8
<tr style="display: none;">
	<td class="trow2" valign="top">
		<strong>{$lang->your_message}:</strong>
	</td>
	<td class="trow2">
		<textarea name="message" id="message" rows="20" cols="70" tabindex="3">{$message}</textarea>
	</td>
</tr>

Because this change doesn't impact 1.4, so, we apply it to 1.4. Thanks to Lee for finding this issue.

Or, if we didn't change anything from the contus_editpost_first template, just replace the template with this one (I've edited this template in the first post):

HTML Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->edit_post}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
</head>
<body>
{$header}
<form action="editpost.php?pid={$pid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
		<tr>
			<td></td>
			<td width="620">
				{$preview}
				{$post_errors}
				<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%">
					<tr>
						<td colspan="2" style="background: #D6ECA6; border-top: 2px solid #8DC93E; border-bottom: 2px solid #8DC93E;">
							<strong>{$lang->edit_post}</strong>
						</td>
					</tr>
					{$tfinputrow['contus_status']}
					<tr>
						<td width="22%">
							<strong>{$lang->subject}</strong>
						</td>
						<td>
							<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" />
						</td>
					</tr>
					{$extra_threadfields}
					<tr style="display: none;">
						<td class="trow2" valign="top">
							<strong>{$lang->your_message}:</strong>
						</td>
						<td class="trow2">
							<textarea name="message" id="message" rows="20" cols="70" tabindex="3">{$message}</textarea>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="border-bottom: 2px solid #8DC93E;"></td>
					</tr>
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr>
						<td colspan="2" align="center" style="background: #ADCBE7; border-top: 2px solid #0F5C8E; border-bottom: 2px solid #0F5C8E;">
							<input type="submit" class="button" name="submit" value="{$lang->update_post}" tabindex="3" />
							<input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="4" />
						</td>
					</tr>
				</table>
			</td>
			<td></td>
		</tr>
	</table>
	<input type="hidden" name="action" value="do_editpost" />
	<input type="hidden" name="posthash" value="{$posthash}" />
	<input type="hidden" name="attachmentaid" value="" />
	<input type="hidden" name="attachmentact" value="" />
</form>
<br />
<form action="editpost.php" method="post" name="editpost">
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%">
		<tr>
			<td colspan="3" style="background: #FFF6BF; border-top: 2px solid #FFD324; border-bottom: 2px solid #FFD324;">
				<strong>{$lang->delete_post}</strong>
			</td>
		</tr>
		<tr>
			<td style="white-space: nowrap; width: 15%;" align="center">
				<input type="checkbox" class="checkbox" name="delete" value="1" tabindex="9" /><br />
				<strong>{$lang->delete_q}</strong>
			</td>
			<td width="70%">
				{$lang->delete_1}<br />
				<span class="smalltext">{$lang->delete_2}</span>
			</td>
			<td>
				<input type="submit" class="button" name="submit" value="{$lang->delete_now}" tabindex="10" />
			</td>
		</tr>
		<tr>
			<td colspan="3" style="border-bottom: 2px solid #FFD324;"></td>
		</tr>
	</table>
	<input type="hidden" name="action" value="deletepost" />
	<input type="hidden" name="pid" value="{$pid}" />
</form>
{$footer}
</body>
</html>


2. Clicking the inline moderation column won't count all thread. If any action applied to them, we will get the error message "Sorry, but you did not select any threads to perform inline moderation on, or your previous moderation session has expired (Automatically after 1 hour of inactivity). Please select some threads and try again.".
Solution:
Replace the contus_forumdisplay_inlinemoderation template with this one (only for MyBB 1.6):

HTML Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</table>
</td>
</tr>
<tr>
	<td align="right">
		<script type="text/javascript" src="jscripts/inline_moderation.js?ver=1600"></script>
		<form action="moderation.php" method="post">
			<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
			<input type="hidden" name="fid" value="{$fid}" />
			<input type="hidden" name="modtype" value="inlinethread" />
			<span class="smalltext"><strong>{$lang->inline_thread_moderation}</strong></span>
			<select name="action">
				<option value="delayedmoderation">{$lang->delayed_moderation}</option>
				<optgroup label="{$lang->standard_mod_tools}">
					<option value="multiclosethreads" selected="selected">{$lang->close_threads}</option>
					<option value="multiopenthreads">{$lang->open_threads}</option>
					<option value="multistickthreads">{$lang->stick_threads}</option>
					<option value="multiunstickthreads">{$lang->unstick_threads}</option>
					<option value="multideletethreads">{$lang->delete_threads}</option>
					<option value="multimovethreads">{$lang->move_threads}</option>
					<option value="multiunapprovethreads">{$lang->unapprove_threads}</option>
				</optgroup>
				{$customthreadtools}
			</select>
			<input type="submit" class="button" name="go" value="{$lang->inline_go} ({$inlinecount})" id="inline_go" />&nbsp;
			<input type="button" onclick="javascript:inlineModeration.clearChecked();" value="{$lang->clear}" class="button" />
		</form>
		<script type="text/javascript">
		<!--
			var go_text = "{$lang->inline_go}";
			var all_text = "{$threadcount}";
			var inlineType = "forum";
			var inlineId = {$fid};
		// -->
		</script>
	</td>
</tr>


Thank you very much for the report, Lee.


08-12-2010 04:29 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #10
RE: Contact Us System
Thanks for coming with a fix so fast RateU - this is a really nifty system and I like it a lot Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
08-12-2010 12:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: