Author Topic: [MOD] Personal user's rank  (Read 6796 times)

0 Members and 1 Guest are viewing this topic.

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
[MOD] Personal user's rank
« on: January 15, 2009, 09:40:44 PM »
The mod's creator is alekinna, and my idea.
This mod adds possibility to write to users a personal rank from admin centre. It is displayed in comment_bit.html and member_profile.html

1. In includes/db_field_definitions.php add:
Code: [Select]
$additional_user_fields['admin_text'] = array($lang['admin_text'], "text", 0);
2. In lang/russian/main.php add:
Code: [Select]
$lang['admin_text'] = "Personal rank: ";
3. In member_profile.html use*:
Code: [Select]
{lang_admin_text}
{admin_text}
*You are can use  {if admin_text} and {endif admin_text}

4. In comment_bit.html use:
Code: [Select]
{if admin_text}
{lang_admin_text}{admin_text}
{endif admin_text}

5. In details.php:
find line with:
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name,add in this line:
Code: [Select]
u.admin_text,
find FIRST:
Code: [Select]
$admin_links = "";before add:
Code: [Select]
$admin_text = $comment_row[$i]['admin_text'];
find:
Code: [Select]
"comment_user_info" => $comment_user_info,after add:
Code: [Select]
"admin_text" => $admin_text,
        "lang_admin_text" => $lang['admin_text'],

6. In PhpMyAdmin create new parameter:
Code: [Select]
ALTER TABLE `4images_users` ADD `admin_text` TEXT NOT NULL;

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Personal user's rank
« Reply #1 on: January 16, 2009, 02:24:42 AM »
Thank you for sharing.

A little database optimization could be done by using VARCHAR(255) field type instead of TEXT.
I doubt that anyone would use even 255 characters..
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sanko86

  • Sr. Member
  • ****
  • Posts: 310
    • View Profile
    • Elemegim
Re: [MOD] Personal user's rank
« Reply #2 on: January 16, 2009, 09:05:00 AM »
1-includes/db_field_definitions.php open

Code: [Select]
?>before add
Code: [Select]
$additional_user_fields['admin_text'] = array($lang['admin_text'], "text", 0);
2-lang/yourlang/main.php open

Code: [Select]
?>before add

Code: [Select]
$lang['admin_text'] = "Personal rank: ";
3-templates/yourtheme/member_profile.html open

find
Code: [Select]
<tr>

          <td class="row2"><b>{lang_icq}</b></td>

          <td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>

        </tr>
after add
Code: [Select]
<tr>
          <td class="row1"><b>{lang_admin_text}</b></td>
          <td class="row1">{admin_text}</td>
        </tr>

4-templates/yourtheme/comment_bit.html open
find
Code: [Select]
{comment_user_info}

{if comment_user_ip}<br /><br /><b>IP:</b> {comment_user_ip}{endif comment_user_ip}
after add
Code: [Select]
<br />
<br />
{if admin_text}
{lang_admin_text}{admin_text}
{endif admin_text}

5-details.php open

find line with
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name,
add in this line:
Code: [Select]
u.admin_text,
find
Code: [Select]
$admin_links = "";before add
Code: [Select]
$admin_text = $comment_row[$i]['admin_text'];
find

Code: [Select]
"comment_user_info" => $comment_user_info,
after add

Code: [Select]
"admin_text" => $admin_text,
        "lang_admin_text" => $lang['admin_text'],

6-In PhpMyAdmin sql execute

Code: [Select]
ALTER TABLE `4images_users` ADD `admin_text` TEXT NOT NULL;
ı am live in turkey and ı can use little english
« Last Edit: January 16, 2009, 09:15:28 AM by softbal10 »
Web site:http://www.anlatiyoruz.com
Hayat zorluklarla doludur.Ama en zoru insanın insana düşmanlığıdır.