Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Support Form
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: Support Form
Wow, nice.
Actually, I had a plan to do this myself but never got around to finishing it :/

If you're interested, I had a "best solution" thing with mine.  This is what I wrote a long long time ago - and untested, so I dunno if it works.  Looks ugly, so if you want to adapt it, you probably want to change it, but if interested, here's what I wrote:

  • Add custom thread field:
    Title: Solution Post
    Key: xtspt_solvepost
    Applicable Forums: select the forum that was just added
    Input Field Type: Textbox
    Maximum Text Length: 10
    Field Input Width: 20
    Display Order: 2 (or anything larger than the Issue Status' Display Order) (side note: this is actually rather critical, because it forces the Issue Status field to be evaluated first, so that we can use it in the conditional below)
    Capture Tab Key: No
    Blank Replacement Value:

    Code:
    <if $mybb->user['uid'] == $thread['uid'] || is_moderator($fid, '', $mybb->user['uid']) then>
    	<setvar firstpost>get_post($thread['firstpost'])</setvar>
    	<setvar solvebutton1>' --><form action="editpost.php" method="post"><input type="hidden" name="my_post_key" value="'.$mybb->post_code.'" /><input type="hidden" name="action" value="do_editpost" /><input type="hidden" name="prefix" value="'.$thread['prefix'].'" /><input type="hidden" name="subject" value="'.htmlspecialchars_uni($tplvars['firstpost']['subject']).'" /><input type="hidden" name="icon" value="'.$tplvars['firstpost']['icon'].'" /><input type="hidden" name="message" value="'.htmlspecialchars_uni($tplvars['firstpost']['message']).'" /><input type="hidden" name="options[signature]" value="'.$tplvars['firstpost']['includesig'].'" /><input type="hidden" name="options[disablesmilies]" value="'.$tplvars['firstpost']['smilieoff'].'" /><input type="hidden" name="pid" value="'.$thread['firstpost'].'" /><input type="hidden" name="sis" value="Solved" /><input type="hidden" name="xthreads_xtspt_solvepost" value="'</setvar>
    	<setvar solvebutton2>'" /><input type="submit" value="Mark this post as solution" /></form><!-- '</setvar>
    </if>

    Display Format:

    Code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <if $mybb->user['uid'] == $thread['uid'] || is_moderator($fid, '', $mybb->user['uid']) then>
    	<setvar firstpost>get_post($thread['firstpost'])</setvar>
    	<setvar solvebutton1>' --><form action="editpost.php" method="post"><input type="hidden" name="my_post_key" value="'.$mybb->post_code.'" /><input type="hidden" name="action" value="do_editpost" /><input type="hidden" name="prefix" value="'.$thread['prefix'].'" /><input type="hidden" name="subject" value="'.htmlspecialchars_uni($tplvars['firstpost']['subject']).'" /><input type="hidden" name="icon" value="'.$tplvars['firstpost']['icon'].'" /><input type="hidden" name="message" value="'.htmlspecialchars_uni($tplvars['firstpost']['message']).'" /><input type="hidden" name="options[signature]" value="'.$tplvars['firstpost']['includesig'].'" /><input type="hidden" name="options[disablesmilies]" value="'.$tplvars['firstpost']['smilieoff'].'" /><input type="hidden" name="pid" value="'.$thread['firstpost'].'" /><input type="hidden" name="sis" value="Solved" /><input type="hidden" name="xthreads_xtspt_solvepost" value="'</setvar>
    	<setvar solvebutton2>'" /><input type="submit" value="Mark this post as solution" /></form><!-- '</setvar>
    </if>
    <if {VALUE} && $threadfields['sis'] == 'Solved' then>
    	<setvar post>get_post(intval({VALUE}))</setvar>
    	<if $tplvars['post']['pid'] && $tplvars['post']['tid'] == $thread['tid'] && $tplvars['post']['visible'] then>
    		<br /><a href="{$threadurl_q}pid={$tplvars['post']['pid']}#pid{$tplvars['post']['pid']}">Jump to post which solved this problem</a>
    		<setvar solvepostcss>array($tplvars['post']['pid'] => 'background: #D0FFD0;')</setvar>
    	</if>
    </if>

    Underlying Data Type: Integer (unsigned)
    Hide Input Field: Yes

  • Create template xtsupport_showthread from showthread.
    Find:

    HTML Code
    {$pollbox}

    Add after:

    HTML Code
    {$threadfields['xtspt_solvepost']}

  • Create template xtsupport_postbit from postbit (also apply to xtsupport_postbit_first)
    Find:

    HTML Code
    <span class="smalltext"><strong>{$post['icon']}{$post['subject']} {$post['subject_extra']}</strong></span>

    Add before:

    HTML Code
    <span style="float: right;"><!--{$GLOBALS['tplvars']['solvebutton1']}{$post['pid']}{$GLOBALS['tplvars']['solvebutton2']}--></span>

    Find (all 3 instances of):

    HTML Code
    {$unapproved_shade}"

    Add after:

    HTML Code
     style="{$GLOBALS['tplvars']['solvepostcss'][$post['pid']]}"

  • Create template xtspt_postbit_classic from postbit_classic (also apply to xtsupport_postbit_first_classic)
    Find:

    HTML Code
    <div id="pid_{$post['pid']}" style="padding: 5px 0 5px 0;">

    Add before:

    HTML Code
    <span style="float: right;"><!--{$GLOBALS['tplvars']['solvebutton1']}{$post['pid']}{$GLOBALS['tplvars']['solvebutton2']}--></span>

    Find:

    HTML Code
    <td class="{$altbg}" width="15%" valign="top" style="white-space: nowrap; text-align: center;">

    Replace with:

    HTML Code
    <td class="{$altbg}" width="15%" valign="top" style="white-space: nowrap; text-align: center;{$GLOBALS['tplvars']['solvepostcss'][$post['pid']]}">

    Find:

    HTML Code
    <td class="{$altbg}" valign="top">

    Replace with:

    HTML Code
    <td class="{$altbg}" valign="top" style="{$GLOBALS['tplvars']['solvepostcss'][$post['pid']]}">

    Find:

    HTML Code
    <td class="{$altbg}" style="white-space: nowrap; text-align: center; vertical-align: middle;">

    Replace with:

    HTML Code
    <td class="{$altbg}" style="white-space: nowrap; text-align: center; vertical-align: middle;{$GLOBALS['tplvars']['solvepostcss'][$post['pid']]}">

    Find:

    HTML Code
    <td class="{$altbg}" style="vertical-align: middle;">

    Replace with:

    HTML Code
    <td class="{$altbg}" style="vertical-align: middle;{$GLOBALS['tplvars']['solvepostcss'][$post['pid']]}">


Known issues
  • AJAX quick reply - the "mark best answer" thing won't show up when quick replying, but will after a page refresh (might possible workaround, though a bit "dirty")
  • unfortunately, the entire first post needs to be copied internally; this is somewhat due to MyBB's stupid editpost.php not accepting blank values >_>

My Blog
(This post was last modified: 03-06-2011 04:11 PM by ZiNgA BuRgA.)
03-06-2011 04:09 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Support Form - RateU - 03-06-2011, 09:50 AM
RE: Support Form - techu - 03-06-2011, 12:48 PM
RE: Support Form - ZiNgA BuRgA - 03-06-2011 04:09 PM
RE: Support Form - RateU - 03-07-2011, 10:51 AM
RE: Support Form - ZiNgA BuRgA - 03-07-2011, 05:45 PM
RE: Support Form - MattR - 03-08-2011, 07:36 AM
RE: Support Form - RateU - 03-08-2011, 08:03 AM
RE: Support Form - RateU - 03-11-2011, 07:40 AM
RE: Support Form - RateU - 07-18-2011, 03:19 AM
RE: Support Form - blakefire - 08-10-2011, 06:41 PM
RE: Support Form - RateU - 08-11-2011, 04:11 AM
RE: Support Form - bogdan - 08-11-2011, 04:23 AM
RE: Support Form - RateU - 08-11-2011, 05:26 AM
RE: Support Form - bogdan - 08-11-2011, 05:45 AM
RE: Support Form - RateU - 08-12-2011, 01:54 AM
RE: Support Form - bogdan - 08-12-2011, 05:24 AM
RE: Support Form - RateU - 08-23-2011, 05:22 AM
RE: Support Form - Alan11 - 08-28-2011, 09:37 AM
RE: Support Form - Seabody - 12-23-2012, 01:03 PM
RE: Support Form - Andre - 02-11-2013, 05:31 PM
RE: Support Form - ZiNgA BuRgA - 02-12-2013, 09:17 AM
RE: Support Form - RateU - 02-13-2013, 01:59 AM
RE: Support Form - Andre - 02-13-2013, 09:48 AM
RE: Support Form - RateU - 02-14-2013, 03:07 AM
RE: Support Form - Andre - 02-15-2013, 11:55 PM
RE: Support Form - RateU - 02-16-2013, 01:08 AM
RE: Support Form - Andre - 02-16-2013, 02:13 AM
RE: Support Form - lion - 02-18-2016, 11:13 PM
RE: Support Form - ZiNgA BuRgA - 02-19-2016, 12:52 PM
RE: Support Form - lion - 02-19-2016, 05:29 PM
RE: Support Form - lion - 02-19-2016, 10:22 PM
RE: Support Form - lion - 02-21-2016, 04:27 AM
RE: Support Form - xensor - 06-09-2016, 04:46 AM
RE: Support Form - Yoda - 06-19-2018, 01:39 PM

 Standard Tools
Forum Jump: