09 First Line Support

Started by Mindless, February 03, 2013, 07:09:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

denede

#2
thank you.
can you please post the addon for this. with the language support?

Mindless

Firstline Support by aQuatomic posted by wilba :)
Updated for 09 by Freakynutz
Xhtml valid code :)

Code (sql) Select
ALTER TABLE users ADD(support enum ('yes','no') NOT NULL default 'no');
ALTER TABLE `users` ADD `supportfor` TEXT NOT NULL;


open userdetails.php and find

Code (php) Select
$modcomment = htmlspecialchars($user["modcomment"]);

directly above it add

Code (php) Select
//===first line support
$HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_support']}</td><td colspan='2' align='left'><input type='radio' name='support' value='yes'" .($user["support"] == "yes" ? " checked" : "").">{$lang['userdetails_yes']} <input type='radio' name='support' value='no'" .($user["support"] == "no" ? " checked" : "").">{$lang['userdetails_no']} </td></tr>\n";
$supportfor = htmlspecialchars($user["supportfor"]);
$HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_supportfor']}</td><td colspan='2' align='left'><textarea cols='60' rows='6' name='supportfor'>$supportfor</textarea></td></tr>\n";
//end


@file lang\en\lang_userdetails.php add

Code (php) Select
'userdetails_support' => "Support",
'userdetails_supportfor' => "Support For",


open modtask.php add

   
Code (php) Select
// support
if ((isset($_POST['support'])) && (($support = $_POST['support']) != $user['support'])){
if ($support == 'yes')
{
$modcomment = get_date( time(), 'DATE', 1 ) . " - {$lang['modtask_fls']} " . htmlspecialchars($CURUSER['username']) . ".\n" . $modcomment;
$msg = sqlesc("{$lang['modtask_fls1']} " . htmlspecialchars($CURUSER['username']) . ".");
$added = time();
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
elseif ($support == 'no'){
$modcomment = get_date( time(), 'DATE', 1 ) . " -{$lang['modtask_fls2']} " . htmlspecialchars($CURUSER['username']) . ".\n" . $modcomment;
$msg = sqlesc("{$lang['modtask_fls3']}" . htmlspecialchars($CURUSER['username']) . ", {$lang['modtask_fls4']}.");
$added = time();
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
$updateset[] = "support = " . sqlesc($support);
}
if (isset($_POST['supportfor']) && ($supportfor = $_POST['supportfor']) != $user['supportfor']) {
$updateset[] = "supportfor = " . sqlesc($supportfor);
}
// ====end


@file lang\en\lang_modtask.php add

Code (php) Select
'modtask_fls' => "Added to First line Support by ",
'modtask_fls1' => "You have been added to First line Support by ",
'modtask_fls2' => "Removed from First line Support by ",
'modtask_fls3' => "You have been removed from First line Support by ",
'modtask_fls4' => "probably because you where inactive or asked to be removed",


@ file staff.php above

Code (php) Select
print stdhead("{$lang['stdhead_staff']}") . $HTMLOUT . stdfoot();

add

   
Code (php) Select
//FLS
$HTMLOUT .="<br />";
$dt = time() - 180;
$firstline='';
$q = mysql_query("SELECT users.id, username, email, last_access, country, status, support, supportfor, countries.flagpic, countries.name FROM users LEFT JOIN countries ON countries.id = users.country WHERE support='yes' AND status='confirmed' ORDER BY username LIMIT 20") or sqlerr();
while($a = mysql_fetch_assoc($q)) {
$firstline .= "<tr><td class='embedded'><a class='altlink' href='userdetails.php?id=".$a['id']."'>".$a['username']."</a></td>
<td class='embedded'><img style='vertical-align: middle;' src='{$TBDEV['pic_base_url']}staff".
($a['last_access']>$dt?"/online.gif":"/offline.gif" )."' border='0' alt='' /></td>".
"<td class='embedded'><a href='sendmessage.php?receiver=".$a['id']."'>"."<img style='vertical-align: middle;' src='{$TBDEV['pic_base_url']}staff/users.png' border='0'title=\"{$lang['alt_pm']}\" alt='' /></a></td>".
"<td class='embedded'><img style='vertical-align: middle;' src='{$TBDEV['pic_base_url']}flag/{$a['flagpic']}' border='0' alt='{$a['name']}' /></td>".
"<td class='embedded'>".$a['supportfor']."</td></tr>";
}
$HTMLOUT .= begin_main_frame("");
$HTMLOUT .= begin_frame("");
$HTMLOUT .= "<table cellspacing='0' width='100%'><tr><td class='colhead' align='center'><h2>{$lang['header_first']}</h2></td></tr></table>";
$HTMLOUT .= "<fieldset style='width: 740px; border:1px solid'>
<legend>{$lang['first_support']}</legend>
<table cellspacing='0' width='725'>
<tr>
<td class='embedded' colspan='11'>{$lang['text_first']}<br /><br />
</td>
</tr>
<tr>
<td class='embedded' width='30'><b>{$lang['first_name']}&nbsp; </b></td>
<td class='embedded' width='5'><b>{$lang['first_active']}&nbsp;&nbsp;&nbsp; </b></td>
<td class='embedded' width='5'><b>{$lang['first_contact']}&nbsp;&nbsp;&nbsp;&nbsp; </b>
</td>
<td class='embedded' width='85'><b>{$lang['first_lang']}</b></td>
<td class='embedded' width='200'><b>{$lang['first_supportfor']}</b></td>
</tr>
".$firstline."
</table></fieldset>";
$HTMLOUT .= end_frame();
$HTMLOUT .= end_main_frame();
//end


or use this to save a query - add to the query up top :

Code (sql) Select
support, supportfor,
   
Under :     

Code (php) Select
if($arr2["class"] == UC_SYSOP)
        $sysops[] =  $arr2;

     
Add

Code (php) Select
if($arr2['support'] == 'yes' && $arr2['class'] >= UC_MODERATOR)
        $fls[] =  $arr2;

       
bottom beside others add

Code (php) Select
$htmlout .= isset($fls) ? DoStaff($fls, "{$lang['header_fls']}<br /><br />{$lang['staff_asup']}") : DoStaff($fls=false, "{$lang['header_fls']}");

@file lang\en\lang_staff.php add

Code (php) Select
#Support
'header_first' => "FirstLine Support",
'text_first' =>"General support questions should directed
to these users.<br />
Note that they are volunteers, giving away their time and effort to help
you. Treat them accordingly. (Languages listed are those besides English.)",
'first_support' => "Support",
'first_supportfor' => "Support for:",
'first_name' => "Username",
'first_active' => "Active",
'first_lang' => "Language",
'first_contact' => "Contact"