Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > The Community > Comments / Feedback / Suggestions
Reload this Page Location - Distro
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Comments / Feedback / Suggestions Post bugs, comments, suggestions and anything else site related in here. Also see the Site News section for LinuxForums announcements

Reply
 
Thread Tools Display Modes
Old 02-02-2004   #1 (permalink)
Dolda2000
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
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?
Dolda2000 is offline   Reply With Quote
Old 02-02-2004   #2 (permalink)
jasonlambert
Linux Guru
 
Join Date: Apr 2003
Location: London, UK
Posts: 3,284
good idea.

/me appends it to list
jasonlambert is offline   Reply With Quote
Old 02-02-2004   #3 (permalink)
Giro
Linux Engineer
 
Giro's Avatar
 
Join Date: Jul 2003
Location: England
Posts: 1,219
Yeh im going to give this one a go sounds like a good hack.
Giro is offline   Reply With Quote
Old 02-02-2004   #4 (permalink)
loft306
Linux Guru
 
loft306's Avatar
 
Join Date: Oct 2003
Location: The DairyLand
Posts: 1,667
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
loft306 is offline   Reply With Quote
Old 02-02-2004   #5 (permalink)
whiteskin
Just 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.
whiteskin is offline   Reply With Quote
Old 02-02-2004   #6 (permalink)
heema
Just 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
__________________
\"Computers are like air conditioners - They can\'t do their job properly if you open windows.\"
heema is offline   Reply With Quote
Old 02-02-2004   #7 (permalink)
Giro
Linux Engineer
 
Giro's Avatar
 
Join Date: Jul 2003
Location: England
Posts: 1,219
Quote:
Originally Posted by whiteskin
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.
Then use your favorite you must have one?
Giro is offline   Reply With Quote
Old 02-03-2004   #8 (permalink)
microft.pt
Just Joined!
 
Join Date: Jan 2004
Location: Portugal
Posts: 93
Send a message via MSN to microft.pt
great idea
microft.pt is offline   Reply With Quote
Old 02-03-2004   #9 (permalink)
Giro
Linux Engineer
 
Giro's Avatar
 
Join Date: Jul 2003
Location: England
Posts: 1,219
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
Giro is offline   Reply With Quote
Old 02-04-2004   #10 (permalink)
Giro
Linux Engineer
 
Giro's Avatar
 
Join Date: Jul 2003
Location: England
Posts: 1,219
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'],
Giro is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 05:41 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0