MyBB Hacks

Full Version: Contact Us System
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
If you're using the "Group Post CSS" plugin, can you try this code edit on it?
Find all instances (4) of the following line and delete them

PHP Code:
eval("\$postbit = \"".$templates->get("postbit")."\";");


Personally, I fail to actually see the purpose of these lines (other than disrupt operation of XThreads Tongue).

Update:
  1. Forum settings:
    1. Template Prefix:

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

    2. Language File Prefix: contus_

  2. Additional Template:
    contus_admin_forumdisplay_quick_thread

    HTML Code
    <div></div>

  3. Language Prefix (attached in first post) for redirect message.


Now, administrator doesn't need to view the contact us form in threadlist. Admin only view the form submitted / unapproved threads Biggrin. And we can give a custom redirect message after a form submitted by Guest.

I've updated the first post and screenshot.
Update:
XThreads Options in Forum Settings:
Default Thread Filter:
  • Field: contus_status
  • Value: New

Code:
contus_status=New


Now, we can concentrate with the [New] status form submitted only.

Update:
Since XThreads 1.43, we can design our Quick Thread form as we like Smile
Basically, we need to put the {$extra_threadfields} variable in our Quick Thread form.

This update will also put the default MyBB class back to the template, so, the Contact Us form layout will depends on our themes layout.

  1. contus_forumdisplay_quick_thread

    HTML Code
    <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>

  2. contus_editpost_first

    HTML Code
    <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>

  3. contus_newthread

    HTML Code
    <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>

  4. contus_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']}" 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>

  5. contus_post_captcha

    HTML Code
    <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>

  6. 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>

  7. Remove the contus_previewpost template


I've updated the first post and some screenshoots to reflect these changes (based on the default MyBB theme).
Testing it now, but is it compatible with MYBB 1.6.5 ?
I've just tried it here (use MyBB 1.6.5):
http://xtest.byethost7.com/newthread.php?fid=14

If you use reCAPTCHA option from the CAPTCHA setting, you need to add this template to your Global Templates (and maybe you need to use newthread URL for your Contact Us URL, not threadlist/forumdisplay URL):

contus_post_captcha_recaptcha

HTML Code
<tr>
	<td colspan="2" class="tcat">
		<strong>{$lang->image_verification}</strong>
	</td>
</tr>
<tr id="captcha_trow">
	<td colspan="2" class="trow1">
		<script type="text/javascript">
		<!--
			var RecaptchaOptions = {
				theme: 'clean'
			};
		// -->
		</script>
		<table style="width: 100%; padding: 4px;">
			<tr>
				<td><span class="smalltext">{$lang->verification_note}</span></td>
			</tr>
			<tr>
				<td><script type="text/javascript" src="{$server}/challenge?k={$public_key}"></script></td>
			</tr>
		</table>
	</td>
</tr>

Cool...thanks rateu !
Form doesn't appear on my forum Frown  If I'm admin I can view "Submitted Forms", but if I'm guest or registred I see nothing.

Permissions for Contact Us Forum:
Guest: view and post new threads;
Registred: view and post new threads

The problem is maybe default captcha disabled? thanks
Did you install the Quick Thread plugin? Try accessing the newthread page for that forum id. Does the form appear?
Thank you! Yes, I didn't install the Quick Thread plugin :x

But now if an user registrer/guest tries to sent message, there is an error: Invalid value supplied for "Status".

In custom thread fields I have:
Title: Status , key: contus_status, input field type: Listbox, editable by: Everyone
Pages: 1 2 3 4 5 6 7 8 9 10
Reference URL's