Find the answer to your Linux question:
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux 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?

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    good idea.

    /me appends it to list

  3. #3
    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.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru loft306's Avatar
    Join Date
    Oct 2003
    Location
    The DairyLand
    Posts
    1,666
    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

  6. #5
    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.

  7. #6
    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

  8. #7
    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?

  9. #8
    Just Joined!
    Join Date
    Jan 2004
    Location
    Portugal
    Posts
    93
    great idea

  10. #9
    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

  11. #10
    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">&#123;L_USER_DISTRO&#125;&#58;</span></td>
      <td> <span class="gen">&#123;DISTRO&#125;</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="&#123;postrow.ROW_CLASS&#125;"><span class="name"><a name="&#123;postrow.U_POST_ID&#125;"></a>&#123;postrow.POSTER_NAME&#125;</span>
    <span class="postdetails">&#123;postrow.POSTER_RANK&#125;
    &#123;postrow.RANK_IMAGE&#125;&#123;postrow.POSTER_AVATAR&#125;
    
    &#123;postrow.POSTER_JOINED&#125;
    &#123;postrow.POSTER_POSTS&#125;
    &#123;postrow.POSTER_FROM&#125;
    &#123;postrow.POSTER_DISTRO&#125;</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">&#123;L_USER_DISTRO&#125;&#58;</span></td>
      <td class="row2"> 
        <input type="text" class="post" style="width&#58; 200px" name="user_distro" size="35" maxlength="150" value="&#123;DISTRO&#125;" />
      </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&#40;'username' => 'username', 'email' => 'email', 'user_distro' => 'user_distro', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests'&#41;;
    Now goto line 455 and replace it with this,

    Code:
    SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace&#40;"\'", "''", $email&#41; ."', user_distro='" . $user_distro . "', user_icq = '" . str_replace&#40;"\'", "''", $icq&#41; . "', user_website = '" . str_replace&#40;"\'", "''", $website&#41; . "', user_occ = '" . str_replace&#40;"\'", "''", $occupation&#41; . "', user_from = '" . str_replace&#40;"\'", "''", $location&#41; . "', user_interests = '" . str_replace&#40;"\'", "''", $interests&#41; . "', user_sig = '" . str_replace&#40;"\'", "''", $signature&#41; . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace&#40;"\'", "''", str_replace&#40;' ', '+', $aim&#41;&#41; . "', user_yim = '" . str_replace&#40;"\'", "''", $yim&#41; . "', user_msnm = '" . str_replace&#40;"\'", "''", $msn&#41; . "', 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&#40;"\'", "''", $user_dateformat&#41; . "', user_lang = '" . str_replace&#40;"\'", "''", $user_lang&#41; . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace&#40;"\'", "''", $user_actkey&#41; . "'" . $avatar_sql . "
    And also replace line 518 and 519 with this,
    Code:
    $sql = "INSERT INTO " . USERS_TABLE . "	&#40;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&#41;
    				VALUES &#40;$user_id, '" . str_replace&#40;"\'", "''", $username&#41; . "', " . time&#40;&#41; . ", '" . str_replace&#40;"\'", "''", $new_password&#41; . "', '" . str_replace&#40;"\'", "''", $email&#41; . "', '$user_distro', '" . str_replace&#40;"\'", "''", $icq&#41; . "', '" . str_replace&#40;"\'", "''", $website&#41; . "', '" . str_replace&#40;"\'", "''", $occupation&#41; . "', '" . str_replace&#40;"\'", "''", $location&#41; . "', '" . str_replace&#40;"\'", "''", $interests&#41; . "', '" . str_replace&#40;"\'", "''", $signature&#41; . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace&#40;"\'", "''", str_replace&#40;' ', '+', $aim&#41;&#41; . "', '" . str_replace&#40;"\'", "''", $yim&#41; . "', '" . str_replace&#40;"\'", "''", $msn&#41; . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace&#40;"\'", "''", $user_dateformat&#41; . "', '" . str_replace&#40;"\'", "''", $user_lang&#41; . "', $user_style, 0, 1, ";
    And also add this after line 167,
    Code:
    $user_distro = isset&#40;$HTTP_POST_VARS&#91;'user_distro'&#93;&#41; ? ucwords&#40;$HTTP_POST_VARS&#91;'user_distro'&#93;&#41; &#58; $userdata&#91;'user_distro'&#93;;
    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&#91;'Distro'&#93;,
    Next edit /phpBB2/includes/usercp_viewprofile.php and add this after line 138,

    Code:
    if &#40; !empty&#40;$profiledata&#91;'user_distro'&#93;&#41; &#41;
    &#123;
    	$user_distro = $profiledata&#91;'user_distro'&#93;;
    &#125;
    else
    &#123;
    	$user_distro = '';
    &#125;
    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 = &#40; $postrow&#91;$i&#93;&#91;'user_distro'&#93; && $postrow&#91;$i&#93;&#91;'user_id'&#93; != ANONYMOUS &#41; ? $lang&#91;'Distro'&#93; . '&#58; ' . $postrow&#91;$i&#93;&#91;'user_distro'&#93; &#58; '';
    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&#40;$user_distro&#41;;
    and add this after line 688,

    Code:
    $user_distro = stripslashes&#40;$user_distro&#41;;
    And this after line 720,

    Code:
    $user_distro = $userdata&#91;'user_distro'&#93;;
    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">&#123;L_USER_DISTRO&#125;&#58;</span></td>
      <td class="row2">
        <input type="text" class="post" name="user_distro" size="35" maxlength="150" value="&#123;DISTRO&#125;" />
      </td>
    </tr>
    Setup the vars
    Open the file /phpBB2/admin/admin_users.php after line 233 add,

    Code:
    $user_distro = &#40; !empty&#40;$HTTP_POST_VARS&#91;'user_distro'&#93;&#41;&#41; ? ucwords&#40;strip_tags&#40;$HTTP_POST_VARS&#91;'user_distro'&#93;&#41;&#41; &#58; '';
    And after line 292 add,

    Code:
    $user_distro = stripslashes&#40;$user_distro&#41;;

    Now replace line 664 with this,

    Code:
    SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace&#40;"\'", "''", $email&#41; ."', user_distro='" . $user_distro . "', user_icq = '" . str_replace&#40;"\'", "''", $icq&#41; . "', user_website = '" . str_replace&#40;"\'", "''", $website&#41; . "', user_occ = '" . str_replace&#40;"\'", "''", $occupation&#41; . "', user_from = '" . str_replace&#40;"\'", "''", $location&#41; . "', user_interests = '" . str_replace&#40;"\'", "''", $interests&#41; . "', user_sig = '" . str_replace&#40;"\'", "''", $signature&#41; . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace&#40;"\'", "''", str_replace&#40;' ', '+', $aim&#41;&#41; . "', user_yim = '" . str_replace&#40;"\'","''", $yim&#41; . "', user_msnm = '" . str_replace&#40;"\'", "''", $msn&#41; . "', 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&#40;"\'", "''", $user_dateformat&#41; . "', user_lang = '" . str_replace&#40;"\'", "''", $user_lang&#41; . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace&#40;"\'", "''", $user_actkey&#41; . "'" . $avatar_sql . "
    Add this after line 724,

    Code:
    $user_distro = stripslashes&#40;$user_distro&#41;;
    Add this after line 776,

    Code:
    $user_distro = $this_userdata&#91;'user_distro'&#93;;
    Add this after line 1010,

    Code:
    'DISTRO' => $user_distro,
    Add this after line 1048,

    Code:
    'L_USER_DISTRO' => $lang&#91;'Distro'&#93;,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •