Ответы на вопросы, связанные с модами для phpBB 2.0.x, кроме относящихся к форуму Для авторов (phpBB 2.0.x) .
bartezas16
phpBB 1.2.1
Сообщения: 29 Стаж: 18 лет 2 месяца
Сообщение
bartezas16 » 18.03.2007 22:28
How to make example top 5 reputated users?
Код: Выделить всё
##############################################################
## MOD Title: Users Reputation System Mod Add On - Most Reputated User
## MOD Author: Armando Lopez (Infamy) < truth@hhmatic.com >
## MOD Description: This mod will add the most reputated user to index.
## MOD Version: 0.0.1
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit:includes/page_header.php
## language/lang_*/lang_main.php
## templates/*/index_body.tpl
## Included Files: n/a
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]---------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]---------------------------------------------
#
$template->assign_vars(array(
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
// Begin Reputation Add On - Top Reputated User
$sql = "SELECT username, user_id, user_reputation
FROM " . USERS_TABLE . "
ORDER BY user_reputation DESC
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain reputation stats", '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$top_userrep = round($row['user_reputation'],2);
$top_userrep_userid = $row['user_id'];
$top_userrep_username = $row['username'];
// End Reputation Add On - Top Reputated User
#
#-----[ FIND ]---------------------------------------------
#
'TOTAL_USERS_ONLINE' => $l_online_users,
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
'TOP_USERREP' => $top_userrep,
'TOP_USERREP_USERNAME' => $top_userrep_username,
#
#-----[ FIND ]---------------------------------------------
#
'L_REGISTER' => $lang['Register'],
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
'L_BEST_REP_USER' => $lang['Best_rep_user'],
#
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_*/lang_main.php
#
#-----[ FIND ]---------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
$lang['Best_rep_user'] = 'Top Reputated User';
#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]---------------------------------------------
#
{NEWEST_USER}
#
#-----[ AFTER, ADD ]---------------------------------------------
#
<br />{L_BEST_REP_USER}: <a href="{TOP_USERREP_USERID}">{TOP_USERREP_USERNAME}</a> ({L_REPUTATION}: <strong>{TOP_USERREP}</strong>)
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
bartezas16
Xpert
phpBB Guru
Сообщения: 5484 Стаж: 21 год 1 месяц
Поблагодарили: 2 раза
Сообщение
Xpert » 19.03.2007 0:01
Well, smth like this:
Код: Выделить всё
#
#-----[ OPEN ]---------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]---------------------------------------------
#
$template->assign_vars(array(
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
// Begin Reputation Add On - Top Reputated User
$sql = "SELECT username, user_id, user_reputation
FROM " . USERS_TABLE . "
ORDER BY user_reputation DESC
LIMIT 5";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain reputation stats", '', __LINE__, __FILE__, $sql);
}
$top_userrep_users = array();
while ( $row = $db->sql_fetchrow($result) )
{
$top_userrep = round($row['user_reputation'],2);
$top_userrep_userid = $row['user_id'];
$top_userrep_username = $row['username'];
$top_userrep_users[] = '<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)';
}
$top_userrep_list = implode($top_userrep_users, ', ');
// End Reputation Add On - Top Reputated User
#
#-----[ FIND ]---------------------------------------------
#
'TOTAL_USERS_ONLINE' => $l_online_users,
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
'TOP_USERREP' => $top_userrep_list,
#
#-----[ FIND ]---------------------------------------------
#
'L_REGISTER' => $lang['Register'],
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
'L_BEST_REP_USER' => $lang['Best_rep_user'],
#
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_*/lang_main.php
#
#-----[ FIND ]---------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
$lang['Best_rep_user'] = 'Top Reputated User';
#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]---------------------------------------------
#
{NEWEST_USER}
#
#-----[ AFTER, ADD ]---------------------------------------------
#
<br />{L_BEST_REP_USER}: {TOP_USERREP}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Didn't test, so post if it works. 8)
Эксперт - это человек, который избегает мелких ошибок на пути к грандиозному провалу.
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Xpert
bartezas16
phpBB 1.2.1
Сообщения: 29 Стаж: 18 лет 2 месяца
Сообщение
bartezas16 » 19.03.2007 17:52
Doesn't work page didn't shows after that change.I think problem is in page_header.php
Код: Выделить всё
#-----[ BEFORE, ADD ]---------------------------------------------
#
// Begin Reputation Add On - Top Reputated User
$sql = "SELECT username, user_id, user_reputation
FROM " . USERS_TABLE . "
ORDER BY user_reputation DESC
LIMIT 5";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain reputation stats", '', __LINE__, __FILE__, $sql);
}
$top_userrep_users = array();
while ( $row = $db->sql_fetchrow($result) )
{
$top_userrep = round($row['user_reputation'],2);
$top_userrep_userid = $row['user_id'];
$top_userrep_username = $row['username'];
$top_userrep_users[] = '<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)';
}
$top_userrep_list = implode($top_userrep_users, ', ');
// End Reputation Add On - Top Reputated User
#
bartezas16
Xpert
phpBB Guru
Сообщения: 5484 Стаж: 21 год 1 месяц
Поблагодарили: 2 раза
Сообщение
Xpert » 19.03.2007 18:15
FIND
Код: Выделить всё
$top_userrep_users[] = '<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)';
IN-LINE FIND
IN-LINE AFTER ADD
Эксперт - это человек, который избегает мелких ошибок на пути к грандиозному провалу.
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Xpert
bartezas16
phpBB 1.2.1
Сообщения: 29 Стаж: 18 лет 2 месяца
Сообщение
bartezas16 » 19.03.2007 19:59
Xpert писал(а): FIND
Код: Выделить всё
$top_userrep_users[] = '<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)';
IN-LINE FIND
IN-LINE AFTER ADD
Thx it works :wink: and I've second question
it's possible to work with Color groups?
Код: Выделить всё
################################################################
## COLOR GROUPS ##
## 1.2.1 ##
################################################################
##
## Description: This mod will replace the current
## name colorization with a group
## system. You may define your group
## name, group color, and group members.
##
## Compatibility: phpBB - 2.0.4 - 2.0.6, 2.0.13 - 2.0.17
## (probably works with any version above 2.0.5)
## php - 4.0.1 or above
################################################################
## This hack brought to you by donation support from Kozy. ##
## Visit him at Kozy Net (http://www.kozysplace.net) to ##
## offer your thanks. ##
################################################################
****************************************************************
** Author: Nivisec (support@nivisec.com) **
** http://www.nivisec.com **
** **
** Language **
** Files At: http://www.nivisec.com/phpbb.php?l=la **
****************************************************************
################################################################
## Installation Level: Fairly Easy
## Installation Time: 10-15 minutes
##
## Author Notes:
## Once installed, you will have a new admin panel
## option called "Color Groups" under the "Group Admin"
## area.
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ©2002-2003 Nivisec.com
##
################################################################
## ********* UPDATING *********
## Please see the goodies/updating/ directory
## for information on upgrading from a previous
## version.
################################################################
#
#-----[ UPLOAD ]------------------------------------------
# If you are having trouble understanding this section, read
# the goodies/understanding_upload.txt file.
#
nivisec_install.php to /
nivisec_schema/*.* to nivisec_schema/
admin/admin_color_groups.php to admin/
language/lang_english/lang_color_groups.php to language/lang_english/
includes/functions_color_groups.php to includes/
templates/subSilver/admin/*.* to templates/subSilver/admin/
#
#-----[ RUN ]------------------------------------------
#
nivisec_install.php
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('CATEGORIES_TABLE', $table_prefix.'categories');
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('COLOR_GROUPS_TABLE', $table_prefix.'color_groups');
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
//
// End session management
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
color_groups_setup_list();
#
#-----[ FIND ]------------------------------------------
#
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
#
#-----[REPLACE WITH ]------------------------------------------
#
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : color_group_colorize_name($forum_data[$j]['user_id']);
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------
#
[ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]
#
#-----[ REPLACE WITH ]------------------------------------------
#
{COLOR_GROUPS_LIST}
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
if (defined('SHOW_ONLINE'))
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
$style_color = '';
if ( $row['user_level'] == ADMIN )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
}
else if ( $row['user_level'] == MOD )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
}
if ( $row['user_allow_viewonline'] )
{
$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
$logged_visible_online++;
}
else
{
$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
$logged_hidden_online++;
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
$user_online_link = color_group_colorize_name($row['user_id']);
if ( $row['user_allow_viewonline'] )
{
$logged_visible_online++;
}
else
{
$logged_hidden_online++;
}
#
#-----[ OPEN ]------------------------------------------
#
viewonline.php
#
#-----[ FIND ]------------------------------------------
#
$username = $row['username'];
$style_color = '';
if ( $row['user_level'] == ADMIN )
{
$username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';
}
else if ( $row['user_level'] == MOD )
{
$username = '<b style="color:#' . $theme['fontcolor2'] . '">' . $username . '</b>';
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
$username = color_group_colorize_name($user_id, true);
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
'POSTER_NAME' => $poster,
#
#-----[ REPLACE WITH ]------------------------------------------
#
'POSTER_NAME' => ($poster_name = color_group_colorize_name($poster_id, true)) ? $poster_name : $poster,
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
'USERNAME' => $username,
#
#-----[ REPLACE WITH ]------------------------------------------
#
'USERNAME' => color_group_colorize_name($user_id, true),
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
$username_from = $privmsg['username_1'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
$username_from = color_group_colorize_name($privmsg['user_id_1'], true);
#
#-----[ FIND ]------------------------------------------
#
$username_to = $privmsg['username_2'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
$username_to = color_group_colorize_name($privmsg['user_id_2'], true);
#
#-----[ FIND ]------------------------------------------
#
'FROM' => $msg_username,
#
#-----[ REPLACE WITH ]------------------------------------------
#
'FROM' => color_group_colorize_name($msg_userid, true),
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path.'includes/functions_color_groups.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
$moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
#
#-----[ REPLACE WITH ]------------------------------------------
#
$moderators[] = color_group_colorize_name($row['user_id']);
#
#-----[ FIND ]------------------------------------------
#
$topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
#
#-----[ REPLACE WITH ]------------------------------------------
#
$topic_author = ($topic_rowset[$i]['user_id'] == ANONYMOUS ) ? (($topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] ) : color_group_colorize_name($topic_rowset[$i]['user_id']);
#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
#End
bartezas16
Xpert
phpBB Guru
Сообщения: 5484 Стаж: 21 год 1 месяц
Поблагодарили: 2 раза
Сообщение
Xpert » 19.03.2007 20:58
FIND
Код: Выделить всё
'<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)'
REPLACE WITH
Код: Выделить всё
color_group_colorize_name($top_userrep_userid) . ' (<strong>' . $top_userrep . '</strong>)';
Test please
Эксперт - это человек, который избегает мелких ошибок на пути к грандиозному провалу.
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Xpert
Палыч
Former team member
Сообщения: 9683 Стаж: 18 лет 11 месяцев
Откуда: Питер
Благодарил (а): 1 раз
Поблагодарили: 27 раз
Сообщение
Палыч » 19.03.2007 21:50
bartezas16 , please, do not abuse bbcode
Код: Выделить всё
To the most parts of a code apply "attach file"
So recommend our rules 8)
Не все то WINDOWS, что висит... phpBB только учусь.
ICQ, email, ЛС - только для личных сообщений. Вопросы по phpbb только на форумах. По найму не работаю.
Палыч
Gisher
phpBB 2.0.12
Сообщения: 857 Стаж: 18 лет 6 месяцев
Поблагодарили: 1 раз
Сообщение
Gisher » 20.03.2007 6:09
Xpert писал(а): FIND
Код: Выделить всё
'<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)'
REPLACE WITH
Код: Выделить всё
color_group_colorize_name($top_userrep_userid) . ' (<strong>' . $top_userrep . '</strong>)';
Test please
на index.php работает, показывает как нужно, а вот при обращении на профиль, выскакивает ошибка указывающая на эту строчку в includes/page_header.php
Gisher
bartezas16
phpBB 1.2.1
Сообщения: 29 Стаж: 18 лет 2 месяца
Сообщение
bartezas16 » 20.03.2007 15:52
Xpert писал(а): FIND
Код: Выделить всё
'<a href="' . append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $top_userrep_userid . '">' . $top_userrep_username . '</a> (<strong>' . $top_userrep . '</strong>)'
REPLACE WITH
Код: Выделить всё
color_group_colorize_name($top_userrep_userid) . ' (<strong>' . $top_userrep . '</strong>)';
Test please
Cool nice man it works :wink: but not working what sayd
Gisher .When i clicking on nick when not showing my forum:/
Pусские люди сами лучший!
Russia 4ever
bartezas16
rxu
phpBB Guru
Сообщения: 16947 Стаж: 18 лет 11 месяцев
Откуда: Красноярск
Благодарил (а): 549 раз
Поблагодарили: 1700 раз
Сообщение
rxu » 20.03.2007 15:56
bartezas16
Do you speak russian
rxu
bartezas16
phpBB 1.2.1
Сообщения: 29 Стаж: 18 лет 2 месяца
Сообщение
bartezas16 » 20.03.2007 17:12
rxu писал(а): bartezas16
Do you speak russian
Yes I'm speaking in russian but reading and writing not very well :/ .Anyway it's offtopic
Pусские люди сами лучший!
Russia 4ever
bartezas16
Xpert
phpBB Guru
Сообщения: 5484 Стаж: 21 год 1 месяц
Поблагодарили: 2 раза
Сообщение
Xpert » 21.03.2007 14:45
Gisher
Вроде не первый день на форуме, что пишет-то?
bartezas16
Ok, will try to solve the problem...
Эксперт - это человек, который избегает мелких ошибок на пути к грандиозному провалу.
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Xpert
bartezas16
phpBB 1.2.1
Сообщения: 29 Стаж: 18 лет 2 месяца
Сообщение
bartezas16 » 27.03.2007 17:37
Xpert писал(а): Gisher
Вроде не первый день на форуме, что пишет-то?
bartezas16
Ok, will try to solve the problem...
ok thanks and i wish you do it for short soon
Pусские люди сами лучший!
Russia 4ever
bartezas16
Gisher
phpBB 2.0.12
Сообщения: 857 Стаж: 18 лет 6 месяцев
Поблагодарили: 1 раз
Сообщение
Gisher » 31.03.2007 2:34
Xpert писал(а): Gisher
Вроде не первый день на форуме, что пишет-то?
ничё не пишет, просто цвет групп не отображается и всё, а так всё ок)
Gisher
Тоха
phpBB 1.0.0
Сообщения: 1 Стаж: 17 лет 7 месяцев
Сообщение
Тоха » 03.09.2007 13:19
извиняюсь...
Но всетаки у меня есть вопросик, буду очень признателен, если кто поможет:
как убрать из рейтинга (из этого мода) юзера Anonymous, который в базе висит под номером "-1" и у которого больше всего постов, а удалять из базы форума его по ходу нельзя?
Спасибо!
Тоха