Кой какъв стил използва – в профилите на потребителите
Здравейте мили фенчета на PHPBB модовете.
Ето тук е мястото да ви покажем как да направите
така, че в профила на даден регистриран потребител
да пише кой стил от форума използва 😀
#
#-----[ ОТВОРИ ]------------------------------------------
#
admin/admin_board.php
#
#-----[ НАМЕРИ ]------------------------------------------
#
message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
}
#
#-----[ СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
if( $config_name == 'default_style' )
{
$sql = 'UPDATE ' . USERS_TABLE . " SET user_style='" . $config_value . "'
WHERE user_id='" . ANONYMOUS . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Failed to update anonymous user board style', '', __LINE__, __FILE__, $sql);
}
}
//
// MOD: -END-
//
#
#-----[ ОТВОРИ ]------------------------------------------
#
viewtopic.php
#
#-----[ НАМЕРИ ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//
#
#-----[ СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
$style_counts = get_style_counts();
//
// MOD: -END-
//
#
#-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
#
#-----[ В СЪЩИЯ РЕД ДОБАВИ ]------------------------------------------
#
, u.user_style, t.style_name
#
#-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
#
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
#
#-----[ В СЪЩИЯ РЕД ДОБАВИ ]------------------------------------------
#
, " . THEMES_TABLE . " t
#
#-----[ НАМЕРИ ]------------------------------------------
#
AND u.user_id = p.poster_id
#
#-----[ СЛЕД ТОВА ДОБАВИ ]------------------------------------------
#
AND t.themes_id = u.user_style
#
#-----[ НАМЕРИ ]------------------------------------------
#
$post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : '';
#
#-----[ ПРЕДИ ТОВА ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
$style_name = $postrow[$i]['style_name'];
$theme_id = $postrow[$i]['user_style'];
$theme_num = sprintf($lang['Style_theme_num'], $style_counts[$postrow[$i]['user_style'>);
$l_style = $lang['Style'];
//
// MOD: -END-
//
#
#-----[ НАМЕРИ ]------------------------------------------
#
'U_MINI_POST' => $mini_post_url,
#
#-----[ ПРЕДИ ТОВА ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
'L_STYLE' => $l_style,
'STYLE_NAME' => $style_name,
'THEME_ID' => $theme_id,
'THEME_NUM' => $theme_num,
//
// MOD: -END-
//
#
#-----[ ОТВОРИ ]------------------------------------------
#
includes/functions.php
#
#-----[ НАМЕРИ ]------------------------------------------
#
?>
#
#-----[ ПРЕДИ ТОВА ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
function get_style_counts()
{
global $db, $lang;
$style_counts = array();
$sql = 'SELECT user_style, COUNT(*) as total FROM ' . USERS_TABLE . ' GROUP BY user_style';
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Style_counts_error', '', __LINE__, __FILE__, $sql);
}
while( $style_row = $db->sql_fetchrow($result) )
{
$style_counts[$style_row['user_style'> = $style_row['total'];
}
return $style_counts;
}
//
// MOD: -END-
//
#
#-----[ ОТВОРИ ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ НАМЕРИ ]------------------------------------------
#
//
// Output page header and profile_view template
//
#
#-----[ ПРЕДИ ТОВА ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
$sql = 'SELECT style_name
FROM ' . THEMES_TABLE . '
WHERE themes_id = ' . $profiledata['user_style'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Style_profile_error', '', __LINE__, __FILE__, $sql);
}
$stylerow = array();
while ( $row = $db->sql_fetchrow($result) )
{
$stylerow = $row;
}
$db->sql_freeresult($result);
$style_counts = get_style_counts();
$user_style = $stylerow['style_name'];
//
// MOD: -END-
//
#
#-----[ НАМЕРИ ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ СЛЕД ТОВА ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
'L_USER_STYLE' => $lang['Style'],
'USER_STYLE' => $user_style,
'STYLE_NUM' => sprintf($lang['Style_theme_num'], $style_counts[$profiledata['user_style'>),
'THEME_ID' => $profiledata['user_style'],
//
// MOD: -END-
//
#
#-----[ ОТВОРИ ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#-----[ СЛЕД ТОВА ДОБАВИ ]------------------------------------------
#
//
// MOD: Style Under Username
//
$lang['Style'] = 'Style: ';
$lang['Style_theme_num'] = '(%d)';
$lang['Style_profile_error'] = 'Could not obtain style information';
$lang['Style_counts_error'] = 'Could not obtain user style counts.';
//
// MOD: -END-
//
#
#-----[ ОТВОРИ ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ В СЪщИЯ РЕД НАМЕРИ ]------------------------------------------
#
{postrow.POSTER_POSTS}<br />
#
#-----[ В СЪщИЯ РЕД ДОБАВИ ]------------------------------------------
#
# Автор: Ако вие не ползвате мода за сменяне на стила напишете това:
#
{postrow.L_STYLE}{postrow.STYLE_NAME} {postrow.THEME_NUM}<br />
#
#-----[ ИЛИ ]------------------------------------------
#
# Автор: Ако вие ползвате мода за сменяне на стила напишете това:
#
{postrow.L_STYLE}<a href="changestyle.php?s={postrow.THEME_ID}">{postrow.STYLE_NAME}</a> {postrow.THEME_NUM}<br />
#
#-----[ ОТВОРИ ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ НАМЕРИ ]------------------------------------------
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_INTERESTS}:</span></td>
<td> <b><span class="gen">{INTERESTS}</span></b></td>
</tr>
#
#-----[ СЛЕД ТОВА ДОБАВИ ]------------------------------------------
#
# Автор: Ако вие не ползвате мода за сменяне на стила напишете това:
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_USER_STYLE}</span></td>
<td><span class="gen"><b>{USER_STYLE} {STYLE_NUM}</b></span></td>
</tr>
#
#-----[ ИЛИ ]------------------------------------------
#
# Автор: Ако вие ползвате мода за сменяне на стила напишете това:
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_USER_STYLE}</span></td>
<td><span class="gen"><b><a href="changestyle.php?s={THEME_ID}">{USER_STYLE}</a> {STYLE_NUM}</b></span></td>
</tr>
#
#-----[ SAVE & ЗАТВОРИ ВСИЧКИ ФАЙЛОВЕ ]------------------------------------------
#
#За проблеми, въпроси и допитвания
можете да ползвате форума ни!


