2006-03-10, 12:35 PM
Having a lot of smilies that had been uploaded, I wanted an easier way to change the order, without having to go through every page - and this is what I came up with. It adds a small text box to each smilie with the display number inside it, and a button at the bottom to update - see the screenshot attached.
[attachment=2479]
1) inc/languages/english/admin/smilies.lang.php -> Add to the bottom:
2) admin/smilies.php -> around line 34
Find:
3) admin/smilies.php -> around line 343
Find:
4) admin/smilies.php -> around line 383
Find:
Find:
[attachment=2479]
1) inc/languages/english/admin/smilies.lang.php -> Add to the bottom:
$l['update_disp_order'] = "Update Display Order";
$l['smilie_sort_updated'] = "Display Order Updated";
2) admin/smilies.php -> around line 34
Find:
if($mybb->input['action'] == "do_add")
Replace with:if($mybb->input['action'] == "masssort")
{
if (empty($mybb->input['disporder']) || !is_array($mybb->input['disporder']))
{
cperror($lang->error_fill_form);
}
foreach ($mybb->input['disporder'] as $sid => $disporder)
{
$smilie=array("disporder" => intval($disporder));
$db->update_query(TABLE_PREFIX."smilies", $smilie, "sid='".intval($sid)."'");
}
$cache->updatesmilies();
cpredirect("smilies.php?page=$page&perpage=$perpage", $lang->smilie_sort_updated);
}
if($mybb->input['action'] == "do_add")
3) admin/smilies.php -> around line 343
Find:
makehoptolinks($hopto);
Replace with:makehoptolinks($hopto);
echo "<form action=\"smilies.php?action=masssort&page=$page&perpage=$perpage\" method=\"post\">";
4) admin/smilies.php -> around line 383
Find:
echo "<td class=\"$altbg\" align=\"center\" valign=\"bottom\" nowrap>$smilie[name]<br><br><img src=\"$image\"> <b>".stripslashes($smilie[find])."</b><br><br>";
Replace with:echo "<td class=\"$altbg\" align=\"center\" valign=\"bottom\" nowrap>$smilie[name]<br><br><img src=\"$image\"> <b>".stripslashes($smilie[find])."</b><br>";
echo "$lang->disp_order <input type=\"text\" name=\"disporder[$smilie[sid]]\" value=\"$smilie[disporder]\" size=\"3\"><br />";
5) admin/smilies.php -> around line 442Find:
if($pagelist || $prevpage || $nextpage)
{
echo "<tr><td class=\"altbg1\" colspan=\"5\">$prevpage $pagelist $nextpage</td></tr>";
}
Replace with:if($pagelist || $prevpage || $nextpage)
{
echo "<tr><td class=\"altbg1\" colspan=\"4\">$prevpage $pagelist $nextpage</td><td class=\"altbg1\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"$lang->update_disp_order\" /></td></tr></form>";
}
else
{
echo "<tr><td class=\"altbg1\" colspan=\"5\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"$lang->update_disp_order\" /></td></tr></form>";
}