Descriere: Acest tutorial va poate ajuta sa va puneti icon-uri la legenda.
Fisiere de editat:
index.php, viewonline.php, adm/style/acp_groups.html, includes/cache.php, includes/functions_content.php, includes/functions_display.php, includes/functions_user.php, includes/acp/acp_board.php, includes/acp/acp_groups.php, includes/ucp/ucp_groups.php, language/en/common.php, language/en/acp/common.php, styles/prosilver/template/ucp_groups_manage.html, styles/subsilver2/template/ucp_groups_manage.html
Fisiere de urcat:
root/images/group_icons/ Urcati in Images.
Inserati in SQL:
INSERT INTO phpbb_config (config_name, config_value) VALUES ('group_icons_path', 'images/group_icons'); ALTER TABLE phpbb_users ADD user_icon varchar(255) DEFAULT '' NOT NULL; ALTER TABLE phpbb_groups ADD group_icon varchar(255) DEFAULT '' NOT NULL;
Deschideti index.php si cautati:
$sql = 'SELECT group_id, group_name, group_colour, group_type
Dupa group_name, adaugati group_icon,
Cautati:
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
Dupa g.group_name, adaugati g.group_icon,
Cautati:
$group_name = ($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>;
Dupa adaugati:
$group_icon = (!empty($row<'group_icon'>)) ? '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $row<'group_icon'> . '" alt="' . $group_name . '" title="' . $group_name . '" /> ' : '';
Cautati:
$legend<> = '<span' . $colour_text . '>' . $group_name . '</span>';
Dupa $legend<> = adaugati $group_icon.
Cautati:
$legend<> = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . $group_name . '</a>';
Dupa $legend<> = adaugati $group_icon.
Deschideti viewonline.php si cautati:
// Grab group details for legend display if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) { $sql = 'SELECT group_id, group_name, group_colour, group_type FROM ' . GROUPS_TABLE . ' WHERE group_legend = 1 ORDER BY group_name ASC'; } else { $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type FROM ' . GROUPS_TABLE . ' g LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id AND ug.user_id = ' . $user->data<'user_id'> . ' AND ug.user_pending = 0 ) WHERE g.group_legend = 1 AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data<'user_id'> . ') ORDER BY g.group_name ASC'; } $result = $db->sql_query($sql); $legend = ''; while ($row = $db->sql_fetchrow($result)) { if ($row<'group_name'> == 'BOTS') { $legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row<'group_colour'> . '">' . $user->lang<'G_BOTS'> . '</span>'; } else { $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row<'group_colour'> . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . (($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>) . '</a>'; } } $db->sql_freeresult($result);
Inlocuiti cu:
// Grab group details for legend display if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) { $sql = 'SELECT group_id, group_name, group_icon, group_colour, group_type FROM ' . GROUPS_TABLE . ' WHERE group_legend = 1 ORDER BY group_name ASC'; } else { $sql = 'SELECT g.group_id, g.group_name, g.group_icon, g.group_colour, g.group_type FROM ' . GROUPS_TABLE . ' g LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id AND ug.user_id = ' . $user->data<'user_id'> . ' AND ug.user_pending = 0 ) WHERE g.group_legend = 1 AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data<'user_id'> . ') ORDER BY g.group_name ASC'; } $result = $db->sql_query($sql); $legend = array(); while ($row = $db->sql_fetchrow($result)) { $colour_text = ($row<'group_colour'>) ? ' style="color:#' . $row<'group_colour'> . '"' : ''; $group_name = ($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>; $group_icon = (!empty($row<'group_icon'>)) ? '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $row<'group_icon'> . '" alt="' . $group_name . '" title="' . $group_name . '" /> ' : ''; if ($row<'group_name'> == 'BOTS' || ($user->data<'user_id'> != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) { $legend<> = $group_icon . '<span' . $colour_text . '>' . $group_name . '</span>'; } else { $legend<> = $group_icon . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . $group_name . '</a>'; } } $db->sql_freeresult($result); $legend = implode(', ', $legend);
Deschideti adm/style/acp_groups.html si cautati:
<!-- IF S_EDIT -->
Dupa adaugati:
<script type="text/javascript"> // <!<CDATA< function update_group_icon(newicon) { document.getElementById('icon_group').src = (newicon) ? "{GROUP_ICONS_PATH}/" + enpreURI(newicon) : "./images/spacer.gif"; } // >>></script>
Cautati:
<dl> <dt><label for="group_rank">{L_GROUP_RANK}:</label></dt> <dd><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></dd> </dl>
Inainte adaugati:
<dl> <dt><label for="group_icon">{L_GROUP_ICON}:</label></dt> <dd><select name="group_icon" id="group_icon" onchange="update_group_icon(this.options<selectedIndex>.value);">{S_FILENAME_LIST}</select> <img style="vertical-align: middle;" src="{GROUP_ICON}" id="icon_group" alt="" title="" /></dd> </dl>
Deschideti includes/cache.php si cautati:
/** * Obtain ranks */ function obtain_ranks()
Inainte adaugam:
/** * Obtain group icons */ function obtain_group_icons() { if (($group_icons = $this->get('_group_icons')) === false) { global $db, $user; $sql = 'SELECT g.group_id, g.group_name, g.group_icon, g.group_type, u.user_id FROM ' . GROUPS_TABLE . ' g LEFT JOIN ' . USERS_TABLE . ' u ON (g.group_id = u.group_id)'; $result = $db->sql_query($sql); $group_icons = array(); while ($row = $db->sql_fetchrow($result)) { if (!empty($row<'group_icon'>)){ $group_icons<$row<'user_id'>> = array( 'empty' => false, 'name' => $row<'group_name'>, 'icon' => $row<'group_icon'> ); }else{ $group_icons<$row<'user_id'>> = array( 'empty' => true ); } } $db->sql_freeresult($result); $this->put('_group_icons', $group_icons); } return $group_icons; }
Deschideti includes/functions_content.php si cautati:
function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) { static $_profile_cache; // We cache some common variables we need within this function if (empty($_profile_cache)) { global $phpbb_root_path, $phpEx; $_profile_cache<'base_url'> = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); $_profile_cache<'tpl_noprofile'> = '{USERNAME}'; $_profile_cache<'tpl_noprofile_colour'> = '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>'; $_profile_cache<'tpl_profile'> = '<a href="{PROFILE_URL}">{USERNAME}</a>'; $_profile_cache<'tpl_profile_colour'> = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>'; } global $user, $auth;
Stergeti ; de la $auth; iar dupa adaugam , $config, $group_icons, $phpbb_root_path,
Cautati:
// Build correct username colour $username_colour = ($username_colour) ? '#' . $username_colour : '';
Inainte adaugam:
// Get the group icon if available if (empty($group_icons)) { global $cache; $group_icons = $cache->obtain_group_icons(); } // Display the group icon with group name as legend if (isset($group_icons<$user_id>)) { if(!$group_icons<$user_id><'empty'>){ $group_name = (!empty($user->lang<'G_' . $group_icons<$user_id><'name'>>)) ? $user->lang<'G_' . $group_icons<$user_id><'name'>> : $group_icons<$user_id><'name'>; $group_icon = $group_icons<$user_id><'icon'>; $group_info = '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $group_icon . '" title="' . $group_name . '" /> ';//'" alt="' . $group_name . }else $group_info=''; }else{ global $cache; $cache->destroy('_group_icons'); $group_icons = $cache->obtain_group_icons(); $group_info=''; }
Cautati:
return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache<'tpl_noprofile'> : $_profile_cache<'tpl_noprofile_colour'>);
Inainte de str_replace adaugati $group_info.
Cautati:
return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache<'tpl_profile'> : $_profile_cache<'tpl_profile_colour'>);
Inainte de str_replace adaugati $group_info.
Deschideti includes/functions_display.php si cautati:
'SELECT' => 'm.*, u.user_colour, g.group_colour, g.group_type',
Dupa g.group_type’, adaugati g.group_icon,
Cautati:
$group_name = (($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>);
Dupa adaugati:
$group_icon = (!empty($row<'group_icon'>)) ? '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $row<'group_icon'> . '" alt="' . $group_name . '" title="' . $group_name . '" /> ' : '';
Cautati:
$forum_moderators<$f_id><> = '<span' . (($row<'group_colour'>) ? ' style="color:#' . $row<'group_colour'> . ';"' : '') . '>' . $group_name . '</span>';
Dupa $forum_moderators<$f_id><> = adaugam $group_icon.
Cautati:
$forum_moderators<$f_id><> = '<a' . (($row<'group_colour'>) ? ' style="color:#' . $row<'group_colour'> . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . $group_name . '</a>';
Dupa $forum_moderators<$f_id><> = adaugati $group_icon.
Deschideti includes/functions_user.php si cautati:
'group_rank' => 'int',
Inainte adaugati:
'group_icon' => 'string',
Cautati:
$user_attribute_ary = array(
Inlocuiti cu:
$user_attribute_ary = array('group_icon',
Deschideti includes/acp/acp_board.php si cautati:
'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
Dupa adaugati:
'group_icons_path' => array('lang' => 'GROUP_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
Deschideti includes/acp/acp_groups.php si cautati:
'rank' => request_var('group_rank', 0),
Inainte adaugati:
'icon' => request_var('group_icon', ''),
Cautati:
if ((isset($submit_ary<'avatar'>) && $submit_ary<'avatar'> && (!isset($group_row<'group_avatar'>))) || $delete) { if (isset($group_row<'group_avatar'>) && $group_row<'group_avatar'>) { avatar_delete('group', $group_row, true); } }
Dupa adaugati:
if (isset($submit_ary<'icon'>) && $submit_ary<'icon'> != $group_row<'group_icon'>) { $cache->destroy('_group_icons'); }
Cautati:
$test_variables = array(
Dupa adaugati:
'icon' => 'string',
Cautati:
$group_rank = $submit_ary<'rank'>;
Inainte adaugati:
$group_icon = $submit_ary<'icon'>;
Cautati:
$group_rank = 0;
Inainte adaugati:
$group_icon = '';
Cautati:
$group_rank = $group_row<'group_rank'>;
Inainte adaugati:
$group_icon = $group_row<'group_icon'>;
Cautati:
$sql = 'SELECT * FROM ' . RANKS_TABLE . ' WHERE rank_special = 1 ORDER BY rank_title'; $result = $db->sql_query($sql);
Inainte adaugati:
if (strlen($img) > 255) { continue; } $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>'; } } } $filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>' . $user->lang<'SELECT_GROUP_ICON'> . '</option>' . $filename_list; unset($existing_imgs, $imglist);
Cautati:
'S_RANK_OPTIONS' => $rank_options,
Inainte adaugati:
'GROUP_ICONS_PATH' => $phpbb_root_path . $config<'group_icons_path'>, 'GROUP_ICON' => ($edit_img) ? $phpbb_root_path . $config<'group_icons_path'> . '/' . $edit_img : $phpbb_admin_path . 'images/spacer.gif', 'S_FILENAME_LIST' => $filename_list,
Deschideti includes/ucp/ucp_groups.php si cautati:
'rank' => request_var('group_rank', 0),
Inainte adaugati:
'icon' => request_var('group_icon', ''),
Cautati:
if ((isset($submit_ary<'avatar'>) && $submit_ary<'avatar'> && (!isset($group_row<'group_avatar'>))) || $delete) { if (isset($group_row<'group_avatar'>) && $group_row<'group_avatar'>) { avatar_delete('group', $group_row, true); } }
Dupa adaugati:
if (isset($submit_ary<'icon'>) && $submit_ary<'icon'> != $group_row<'group_icon'>) { $cache->destroy('_group_icons'); }
Cautati:
$test_variables = array(
Dupa adaugam:
'icon' => 'string',
Cautati:
$group_rank = $submit_ary<'rank'>;
Inainte adaugam:
$group_icon = $submit_ary<'icon'>;
Cautati:
$group_rank = 0;
Inainte adaugati:
$group_icon = '';
Cautati:
$group_rank = $group_row<'group_rank'>;
Inainte adaugati:
$group_icon = $group_row<'group_icon'>;
Cautati:
$sql = 'SELECT * FROM ' . RANKS_TABLE . ' WHERE rank_special = 1 ORDER BY rank_title'; $result = $db->sql_query($sql);
Inainte adaugati:
// Select a group icon include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); $icons = $existing_imgs = array(); $sql = 'SELECT * FROM ' . GROUPS_TABLE . ' ORDER BY group_icon'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $existing_imgs<> = $row<'group_icon'>; if ($action == 'edit' && $group_id == $row<'group_id'>) { $icons = $row; } } $db->sql_freeresult($result); $imglist = filelist($phpbb_root_path . $config<'group_icons_path'>, ''); $edit_img = $filename_list = ''; foreach ($imglist as $path => $img_ary) { sort($img_ary); foreach ($img_ary as $img) { $img = $path . $img; // Do use the same icon for groups if (!in_array($img, $existing_imgs) || $img == $group_icon) { if ($icons && $img == $icons<'group_icon'>) { $selected = ' selected="selected"'; $edit_img = $img; } else { $selected = ''; } if (strlen($img) > 255) { continue; } $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>'; } } } $filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>' . $user->lang<'SELECT_GROUP_ICON'> . '</option>' . $filename_list; unset($existing_imgs, $imglist);
Cautati:
'S_RANK_OPTIONS' => $rank_options,
Inainte adaugati:
'GROUP_ICONS_PATH' => $phpbb_root_path . $config<'group_icons_path'>, 'GROUP_ICON' => ($edit_img) ? $phpbb_root_path . $config<'group_icons_path'> . '/' . $edit_img : $phpbb_root_path . 'images/spacer.gif', 'S_FILENAME_LIST' => $filename_list,
Deschideti language/en/common.php si cautati:
?>
Inainte adaugati:
// Group Icon $lang = array_merge($lang, array( 'GROUP_ICON' => 'Group icon', 'SELECT_GROUP_ICON' => 'Select a group icon', ));
Deschideti language/en/acp/common.php si cautati:
?>
Inainte adaugati:
// Group Icons $lang = array_merge($lang, array( 'GROUP_ICONS_PATH' => 'Group icons storage path', 'GROUP_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/group_icons</samp>.', ));
Deschideti styles/prosilver/template/ucp_groups_manage.html si cautati:
<!-- INCLUDE ucp_header.html -->
Dupa adaugati:
<script type="text/javascript"> // <!<CDATA< function update_group_icon(newicon) { document.getElementById('icon_group').src = (newicon) ? "{GROUP_ICONS_PATH}/" + enpreURI(newicon) : "./images/spacer.gif"; } // >>></script>
Cautati:
<dl> <dt><label for="group_rank">{L_GROUP_RANK}:</label></dt> <dd><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></dd> </dl>
Inainte adaugati:
<dl> <dt><label for="group_icon">{L_GROUP_ICON}:</label></dt> <dd><select name="group_icon" id="group_icon" onchange="update_group_icon(this.options<selectedIndex>.value);">{S_FILENAME_LIST}</select> <img style="vertical-align: middle;" src="{GROUP_ICON}" id="icon_group" alt="" title="" /></dd> </dl>
Deschideti styles/subsilver2/template/ucp_groups_manage.html si cautati:
<!-- INCLUDE ucp_header.html -->
Dupa adaugati:
<script type="text/javascript"> // <!<CDATA< function update_group_icon(newicon) { document.getElementById('icon_group').src = (newicon) ? "{GROUP_ICONS_PATH}/" + enpreURI(newicon) : "./images/spacer.gif"; } // >>></script>
Cautati:
<tr> <td class="row1" width="35%"><label for="group_rank">{L_GROUP_RANK}:</label></td> <td class="row2"><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></td> </tr>
Inainte adaugati:
<tr> <td class="row1" width="35%"><label for="group_icon">{L_GROUP_ICON}:</label></td> <td class="row2"><select name="group_icon" id="group_icon" onchange="update_group_icon(this.options<selectedIndex>.value);">{S_FILENAME_LIST}</select> <img style="vertical-align: middle;" src="{GROUP_ICON}" id="icon_group" alt="" title="" /></td> </tr>
Sterge-ti cache !
Refresh Template ( Sabloane ) !
Download: CLICK
Fiind un mod foarte mare recomand instalarea lui cu automod phpbb3.
[…] Icon-uri la legenda Home […]