Files to hack
/phpBB2/viewtopic.php
/phpBB2/templates/subSilver/profile_add_body.tpl
/phpBB2/templates/subSilver/profile_view_body.tpl
/phpBB2/templates/subSilver/viewtopic_body.tpl
/phpBB2/language/lang_english/lang_main.php
/phpBB2/includes/usercp_register.php
/phpBB2/includes/page_header.php
/phpBB2/includes/usercp_viewprofile.php
Edit database
You need to edit the database to add the user_distro coloum ill give just the SQL,
Code:
ALTER TABLE phpbb_users ADD user_distro VARCHAR(50) NULL AFTER user_email;
Setup the templates
Add the distro string to the language file by editing /phpBB2/language/lang_english/lang_main.php goto line 105 and after add,
Code:
$lang['Distro'] = 'Distro';
Hack the viewprofile template so open file /phpBB2/templates/subSilver/profile_view_body.tpl and goto line 42 and after add these lines of html,
Code:
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_USER_DISTRO}:</span></td>
<td> <span class="gen">{DISTRO}</span></td>
</tr> Now we want to edit the view topic template so open file /phpBB2/templates/subSilver/viewtopic_body.tpl and replace line 29 with this html,
Code:
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a>{postrow.POSTER_NAME}</span>
<span class="postdetails">{postrow.POSTER_RANK}
{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}
{postrow.POSTER_JOINED}
{postrow.POSTER_POSTS}
{postrow.POSTER_FROM}
{postrow.POSTER_DISTRO}</span>
</td> Now edit the edit profile/join form so open /phpBB2/templates/subSilver/profile_add_body.tpl and goto line 124 and after add these lines of html,
Code:
<tr>
<td class="row1"><span class="gen">{L_USER_DISTRO}:</span></td>
<td class="row2">
<input type="text" class="post" style="width: 200px" name="user_distro" size="35" maxlength="150" value="{DISTRO}" />
</td>
</tr> The templates are done.
Edit SQL
We need to edit the SQL ect.. for creating and updating profiles so open /phpBB2/includes/usercp_register.php first replace line 96 with this,
Code:
$strip_var_list = array('username' => 'username', 'email' => 'email', 'user_distro' => 'user_distro', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests'); Now goto line 455 and replace it with this,
Code:
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_distro='" . $user_distro . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . " And also replace line 518 and 519 with this,
Code:
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_distro, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '$user_distro', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, "; And also add this after line 167,
Code:
$user_distro = isset($HTTP_POST_VARS['user_distro']) ? ucwords($HTTP_POST_VARS['user_distro']) : $userdata['user_distro'];
Setup the vars
Now add the new language var to the header so edit /phpBB2/includes/page_header.php and goto line 379 and after add this line,
Code:
'L_USER_DISTRO' => $lang['Distro'],
Next edit /phpBB2/includes/usercp_viewprofile.php and add this after line 138,
Code:
if ( !empty($profiledata['user_distro']) )
{
$user_distro = $profiledata['user_distro'];
}
else
{
$user_distro = '';
} and this after line 207,
Code:
'DISTRO' => $user_distro,
And the last file that we need to edit is /phpBB2/viewtopic.php and goto line 383 and replace it with this,
Code:
$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, u.user_distro, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
Also add this after line 832,
Code:
$poster_distro = ( $postrow[$i]['user_distro'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Distro'] . ': ' . $postrow[$i]['user_distro'] : '';
and add this after line 1159,
Code:
'POSTER_DISTRO' => $poster_distro,
Bits missed
I missed adding a couple of vars ive added them to the end so I dont mess up line counts which may not matter? They are as follows,
Open /phpBB2/includes/usercp_register.php and add this after line 210,
Code:
$user_distro = stripslashes($user_distro);
and add this after line 688,
Code:
$user_distro = stripslashes($user_distro);
And this after line 720,
Code:
$user_distro = $userdata['user_distro'];
And this after line 862,
Code:
'DISTRO' => $user_distro,
Now we need to edit the admin section of the code.
-=-=-=-=-=-=-START ADMIN EDIT-=-=-=-=-=-=-
Files to hack
/phpBB2/templates/subSilver/admin/user_edit_body.tpl
/phpBB2/admin/admin_users.php
Setup the templates
Open /phpBB2/templates/subSilver/admin/user_edit_body.tpl and after line 96 add this,
Code:
<tr>
<td class="row1"><span class="gen">{L_USER_DISTRO}:</span></td>
<td class="row2">
<input type="text" class="post" name="user_distro" size="35" maxlength="150" value="{DISTRO}" />
</td>
</tr> Setup the vars
Open the file /phpBB2/admin/admin_users.php after line 233 add,
Code:
$user_distro = ( !empty($HTTP_POST_VARS['user_distro'])) ? ucwords(strip_tags($HTTP_POST_VARS['user_distro'])) : '';
And after line 292 add,
Code:
$user_distro = stripslashes($user_distro);
Now replace line 664 with this,
Code:
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_distro='" . $user_distro . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'","''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . " Add this after line 724,
Code:
$user_distro = stripslashes($user_distro);
Add this after line 776,
Code:
$user_distro = $this_userdata['user_distro'];
Add this after line 1010,
Code:
'DISTRO' => $user_distro,
Add this after line 1048,
Code:
'L_USER_DISTRO' => $lang['Distro'],