4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Lunat on January 15, 2009, 09:40:44 PM

Title: [MOD] Personal user's rank
Post by: Lunat on January 15, 2009, 09:40:44 PM
The mod's creator is alekinna (http://www.4homepages.de/forum/index.php?action=profile;u=21731), 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;
Title: Re: [MOD] Personal user's rank
Post by: V@no 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..
Title: Re: [MOD] Personal user's rank
Post by: sanko86 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