Results 1 to 10 of 10
Just a suggestion - in the same way that there is a Location attribute for each user, wouldn't it be really useful to have a Distro attribute that is displayed ...
- 02-02-2004 #1Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Location - Distro
Just a suggestion - in the same way that there is a Location attribute for each user, wouldn't it be really useful to have a Distro attribute that is displayed in the same way?
- 02-02-2004 #2Linux Guru
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 3,284
good idea.
/me appends it to list
- 02-02-2004 #3
Yeh im going to give this one a go sounds like a good hack.
- 02-02-2004 #4
Most useful!
~Mike ~~~ Forum Rules
Testing? What's that? If it compiles, it is good, if it boots up, it is perfect. ~ Linus Torvalds
http://loft306.org
- 02-02-2004 #5Just Joined!
- Join Date
- Jan 2004
- Posts
- 70
Could do a lot of good.... except that you have to be able to specify multiple distros for those of us who use lots of distros.
- 02-02-2004 #6Just Joined!
- Join Date
- Jan 2004
- Location
- Egypt
- Posts
- 54
its used in linuxquestions.org and its a gr8 idea since u dont have to ask "which distro u use ? " every time somebody asks a question
- 02-02-2004 #7Then use your favorite you must have one?
Originally Posted by whiteskin
- 02-03-2004 #8Just Joined!
- Join Date
- Jan 2004
- Location
- Portugal
- Posts
- 93
great idea
- 02-03-2004 #9
Hi guys ive nearly finished it just need to display the distro from the database in view_topic.tpl. Then clean up the setup instructions. You can have a look at it here -> http://sub.gotdns.org/phpBB2/index.php
- 02-04-2004 #10
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,
Setup the templatesCode:ALTER TABLE phpbb_users ADD user_distro VARCHAR(50) NULL AFTER user_email;
Add the distro string to the language file by editing /phpBB2/language/lang_english/lang_main.php goto line 105 and after add,
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:$lang['Distro'] = 'Distro';
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:<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 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:<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>
The templates are done.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>
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,
Now goto line 455 and replace it 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');
And also replace line 518 and 519 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 add this after line 167,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, ";
Setup the varsCode:$user_distro = isset($HTTP_POST_VARS['user_distro']) ? ucwords($HTTP_POST_VARS['user_distro']) : $userdata['user_distro'];
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,
Next edit /phpBB2/includes/usercp_viewprofile.php and add this after line 138,Code:'L_USER_DISTRO' => $lang['Distro'],
and this after line 207,Code:if ( !empty($profiledata['user_distro']) ) { $user_distro = $profiledata['user_distro']; } else { $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:'DISTRO' => $user_distro,
Also add this after line 832,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
and add this after line 1159,Code:$poster_distro = ( $postrow[$i]['user_distro'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Distro'] . ': ' . $postrow[$i]['user_distro'] : '';
Bits missedCode:'POSTER_DISTRO' => $poster_distro,
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,
and add this after line 688,Code:$user_distro = stripslashes($user_distro);
And this after line 720,Code:$user_distro = stripslashes($user_distro);
And this after line 862,Code:$user_distro = $userdata['user_distro'];
Now we need to edit the admin section of the code.Code:'DISTRO' => $user_distro,
-=-=-=-=-=-=-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,
Setup the varsCode:<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>
Open the file /phpBB2/admin/admin_users.php after line 233 add,
And after line 292 add,Code:$user_distro = ( !empty($HTTP_POST_VARS['user_distro'])) ? ucwords(strip_tags($HTTP_POST_VARS['user_distro'])) : '';
Code:$user_distro = stripslashes($user_distro);
Now replace line 664 with this,
Add this after line 724,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 776,Code:$user_distro = stripslashes($user_distro);
Add this after line 1010,Code:$user_distro = $this_userdata['user_distro'];
Add this after line 1048,Code:'DISTRO' => $user_distro,
Code:'L_USER_DISTRO' => $lang['Distro'],


Reply With Quote
