dublacja rang na forum
Masz 2 pluginy na rangi:
viewgroups i usergroup
Dezaktywuj jeden z nich.
Dezaktywuj jeden z nich.
Prośby na PW dotyczące wsparcia z problemami będą ignorowane. Pomoc poza forum - odpłatna.
Okey dzięki,
A teraz jak je wysortować
A teraz jak je wysortować
<?php
/**
* Copyright 2006 CraKteR.
*/
if(!defined("IN_MYBB")) {
die("This file cannot be accessed directly.");
}
$plugins->add_hook("index_start", "do_legend");
function usergrouplegends_info() {
return array(
"name" => "Usergroup legends",
"description" => "Shows Usergroups legends on the index.",
"website" => "http://www.mcdcpp.net",
"author" => "CraKteR",
"authorsite" => "mailto:crakter@gmail.com",
"version" => "1.4.3"
);
}
function usergrouplegends_activate() {
global $db;
$query = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups ORDER BY `gid` DESC LIMIT 0,1");
$disporder = $db->fetch_field($query, 'gid')+1;
$setting_group = array(
"name" => "uot",
"title" => "User group legends",
"description" => "",
"disporder" => intval($disporder),
"isdefault" => "no"
);
$db->insert_query(TABLE_PREFIX."settinggroups", $setting_group);
$gid = $db->insert_id();
$s_1 = array(
"name" => "legendsdontshow",
"title" => "Groups to not show",
"description" => "Groups not to be shown on usersgroup legends. Seperate with \',\'.",
"optionscode" => "text",
"value" => "",
"disporder" => 1,
"gid" => intval($gid)
);
$db->insert_query(TABLE_PREFIX."settings", $s_1);
rebuildsettings();
$template = array(
"title" => "usergroup_legend",
"template" => "<tr><td class=\"tcat\" colspan=\"2\"><strong>Grupy użytkowników</strong></td></tr>
<tr><td class=\"trow1\" colspan=\"2\"><center>{\$usertitles}</center></td></tr>",
"sid" => -1
);
$db->insert_query(TABLE_PREFIX."templates", $template);
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#{\$whosonline}#', "{\$whosonline}\n{\$user_legend}");
}
function usergrouplegends_deactivate() {
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='usergroup_legend'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='uot'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='legendsdontshow'");
rebuildsettings();
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#(\n?){\$user_legend}#', '', 0);
}
function do_legend()
{
global $db, $mybb, $user_legend, $templates, $theme, $usertitle, $cache;
$query = $db->query("SELECT title, namestyle, gid FROM ".TABLE_PREFIX."usergroups WHERE gid!=1 ORDER BY isbannedgroup ASC, showforumteam DESC, disporder ASC, usertitle ASC");
$usertitles = "";
$dontshow = explode(',', $mybb->settings['legendsdontshow']);
while($usertitle = $db->fetch_array($query))
{
if(!in_array($usertitle['gid'], $dontshow))
{
$format = $usertitle['namestyle'];
$userin = substr_count($format, "{username}");
if($userin == 0) {
$format = "{username}";
}
$format = stripslashes($format);
$plugincache = $cache->read("plugins");
$usergroup = str_replace("{username}", $usertitle['title'], $format);
if($plugincache['active']['showgroup']) {
$usergroup = "<a href=\"./groups.php?gid=".$usertitle['gid']."\">".$usergroup."</a>";
}
$usertitles .= "[<a href=\"./memberlist.php?groups=".$usertitle['gid']."\">".$usergroup."</a>] ";
}
}
eval("\$user_legend = \"".$templates->get("usergroup_legend")."\";");
}
if(!function_exists("rebuildsettings")) {
function rebuildsettings() {
global $db;
if(!file_exists(MYBB_ROOT."inc/settings.php")) {
$mode = "x";
} else {
$mode = "w";
}
$options = array(
"order_by" => "title",
"order_dir" => "ASC"
);
$query = $db->simple_select(TABLE_PREFIX."settings", "value, name", "", $options);
while($setting = $db->fetch_array($query)) {
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);
$settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
$mybb->settings[$setting['name']] = $setting['value'];
}
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
@fwrite($file, $settings);
@fclose($file);
}
}
?>
Użytkownicy przeglądający ten wątek:
2 gości