Author Topic: [MOD] MSN & AIM User Information  (Read 17009 times)

0 Members and 1 Guest are viewing this topic.

Offline VIRA7oNET

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • http://www.vira7.net
[MOD] MSN & AIM User Information
« on: December 09, 2009, 04:49:29 AM »
So after using this script for years and years, i've finally decided to help those in awe in adding these fields. Since no one really uses ICQ anyways. This is a quick mod that adds the fields "MSN" and "AIM" to user profiles.

New MySql fields:
user_msn
user_aim

Backup these files:
includes/db_field_definitions.php
lang/yourlang/main.php
lang/yourlang/admin.php
register.php
details.php
member.php

templates modified
member_editprofile.html
member_profile.html

1. Backup those files and your MySql database.

2. Run this MySql query using phpmyadmin or something of that type.
Code: [Select]
ALTER TABLE  `4images_users` ADD  `user_msn` VARCHAR( 55 ) NOT NULL ;
ALTER TABLE  `4images_users` ADD  `user_aim` VARCHAR( 16 ) NOT NULL ;

OR

create two tables in "users" called
Code: [Select]
user_msn
user_aim

3. Open includes/db_field_definitions.php

Find:
Code: [Select]
?>
Add BEFORE it:
Code: [Select]
$additional_user_fields['user_msn'] = array($lang['user_msn'], "text", 1);
$additional_user_fields['user_aim'] = array($lang['user_aim'], "text", 1);

4. Open lang/your_lang/main.php
Find:
Code: [Select]
$lang['icq'] = "ICQ:";
Add BEFORE it:
Code: [Select]
$lang['msn'] = "MSN:";
$lang['aim'] = "AIM:";

5. Open lang/your_lang/admin.php

Find:
Code: [Select]
$lang['field_icq'] = "ICQ";
Add BEFORE it:
Code: [Select]
$lang['field_msn'] = "MSN";
$lang['field_aim'] = "AIM";

6. Open register.php

Find:
Code: [Select]
    $user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";

Add BEFORE it:
Code: [Select]
     $user_msn = (isset($HTTP_POST_VARS['user_msn'])) ? ((intval(trim($HTTP_POST_VARS['user_msn']))) ? intval(trim($HTTP_POST_VARS['user_msn'])) : "") : ""; 
$user_aim = (isset($HTTP_POST_VARS['user_aim'])) ? ((intval(trim($HTTP_POST_VARS['user_aim']))) ? intval(trim($HTTP_POST_VARS['user_aim'])) : "") : "";

Find:
Code: [Select]
     "user_icq" => $user_icq,

Add BEFORE it:
Code: [Select]
     "user_msn" => $user_msn,
      "user_aim" => $user_aim,

Find:
Code: [Select]
     "lang_icq" => $lang['icq'],

Add BEFORE it:
Code: [Select]
 "lang_msn" => $lang['msn'],
      "lang_aim" => $lang['aim'],

7. Open details.php

Find:
Code: [Select]
       $comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
        if (!empty($comment_user_icq)) {
          $comment_user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
        }

Add BEFORE it:
Code: [Select]
       $comment_user_msn = (isset($comment_row[$i][$user_table_fields['user_msn']])) ? format_url($comment_row[$i][$user_table_fields['user_msn']]) : "";
        if (!empty($comment_user_msn)) {
          $comment_user_msn_button = "<a href=\"".$comment_user_msn."\" target=\"_blank\"><img src=\"".get_gallery_image("msn.gif")."\" border=\"0\" alt=\"".$comment_user_msn."\" /></a>";
        }

        $comment_user_aim = (isset($comment_row[$i][$user_table_fields['user_aim']])) ? format_url($comment_row[$i][$user_table_fields['user_aim']]) : "";
        if (!empty($comment_user_aim)) {
          $comment_user_aim_button = "<a href=\"".$comment_user_aim."\" target=\"_blank\"><img src=\"".get_gallery_image("aim.gif")."\" border=\"0\" alt=\"".$comment_user_aim."\" /></a>";
        }

8. Open member.php

Find:
Code: [Select]
   $user_icq = (isset($user_row['user_icq'])) ? $user_row['user_icq'] : REPLACE_EMPTY;
    if (!empty($user_icq) && $user_icq != REPLACE_EMPTY) {
      $user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$user_icq."\" /></a>";
    }
    else {
      $user_icq_button = REPLACE_EMPTY;
    }

Add BEFORE it:
Code: [Select]
   $user_msn = (isset($user_row['user_msn'])) ? format_text(format_url($user_row['user_msn']), 2) : REPLACE_EMPTY;
    if (!empty($user_msn) && $user_msn != REPLACE_EMPTY) {
      $user_msn_button = "<a href=\"".$user_msn."\" target=\"_blank\"><img src=\"".get_gallery_image("msn.gif")."\" border=\"0\" alt=\"".$user_msn."\" /></a>";
    }
    else {
      $user_msn_button = REPLACE_EMPTY;
    }

    $user_aim = (isset($user_row['user_aim'])) ? format_text(format_url($user_row['user_aim']), 2) : REPLACE_EMPTY;
    if (!empty($user_aim) && $user_aim != REPLACE_EMPTY) {
      $user_aim_button = "<a href=\"".$user_aim."\" target=\"_blank\"><img src=\"".get_gallery_image("aim.gif")."\" border=\"0\" alt=\"".$user_aim."\" /></a>";
    }
    else {
      $user_aim_button = REPLACE_EMPTY;
    }

Now let us edit some templates.

1. Open member_profile.html

Find:
Code: [Select]
       <tr>
          <td class="row1"><b>{lang_homepage}</b></td>
          <td class="row1">{if user_homepage}<a href="{user_homepage}" target="_blank">{user_homepage}</a>{endif user_homepage}</td>
        </tr>

Add AFTER it:
Code: [Select]
       <tr>
          <td class="row2"><b>MSN:</b></td>
          <td class="row2">{if user_msn}{user_msn}{endif user_msn}</td>
        </tr>
        <tr>
          <td class="row1"><b>AIM:</b></td>
          <td class="row1">{if user_aim}{user_aim}{endif user_aim}</td>
        </tr>

2. Open member_editprofile.html

Find:
Code: [Select]
         <tr>
            <td class="row1"><b>{lang_homepage}</b></td>
            <td class="row1"><input type="text" name="user_homepage"  size="30" value="{user_homepage}" class="input" /></td>
          </tr>

Add AFTER it:
Code: [Select]
         <tr>
            <td class="row2"><b>MSN:</b></td>
            <td class="row2"><input type="text" name="user_msn"  size="30" value="{user_msn}" class="input" /></td>
          </tr>
          <tr>
            <td class="row1"><b>AIM:</b></td>
            <td class="row1"><input type="text" name="user_aim"  size="30" value="{user_aim}" class="input" /></td>
          </tr>

Ciao  8)

edit; fixed and added a step.. sorry :[
« Last Edit: December 09, 2009, 05:30:12 PM by VIRA7oNET »

Rembrandt

  • Guest
Re: [MOD] MSN & AIM User Information
« Reply #1 on: December 09, 2009, 01:36:35 PM »
Hi!

Thank for your Posting!

step 1.) is no obligation
change to:

$additional_user_fields
['user_msn'] = array($lang['user_msn'], "text"0);
$additional_user_fields['user_aim'] = array($lang['user_aim'], "text"0);


step 6.) you have  a error
change to:

$user_msn 
= (isset($HTTP_POST_VARS['user_msn'])) ? ((intval(trim($HTTP_POST_VARS['user_msn']))) ? intval(trim($HTTP_POST_VARS['user_msn'])) : "") : "";  
$user_aim = (isset($HTTP_POST_VARS['user_aim'])) ? ((intval(trim($HTTP_POST_VARS['user_aim']))) ? intval(trim($HTTP_POST_VARS['user_aim'])) : "") : "";



mfg Andi

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] MSN & AIM User Information
« Reply #2 on: December 09, 2009, 03:07:15 PM »
Thank you for sharing this mod.

Since no one really uses ICQ anyways. This is a quick mod that adds the fields "MSN" and "AIM" to user profiles.
And nobody is using MSN anymore either...it's obsolete and now it's called "WLM" ;)

Also, I think you are missing at least two steps (or have one unnecessary step 6). In details.php new variables created, but no step to register these variables in template. And then no step to add new template tags in details.html template. I think step 6 can be removed completely, because the new fields will register automatically, and then add all the links and whatnot in templates itself.
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 didoman

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: [MOD] MSN & AIM User Information
« Reply #3 on: June 30, 2010, 03:18:08 PM »
I left step 6 out as Vano suggested.

I see step 7 updated the details.php so an icon shows up in your comments eg. homepage etc...

Not sure what to put in comments_bit.html

I noticed it contains {comment_user_homepage_button} {comment_user_icq_button} etc etc .... , so I assumed it would go something like {comment_user_msn_button}

but it doesn't work.

What am i doing wrong.

Offline didoman

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: [MOD] MSN & AIM User Information
« Reply #4 on: July 06, 2010, 03:34:20 AM »
I figured it out.

Quoting from Vano on other posts, You cannot use $user_table_fields array for custom fields or get_user_table_field() functions for additional fields.
So did some tweaking and added the following...

First you need to get the database entry, that you filled out in your profile... eg MSN account

In details.php go to the section for Show Comments and find the line that begins with     $sql = "SELECT

Now add this to the very end of the line   , u.user_msn


Second thing you need to do is to find the line that begins with   $comment_user_msn

And replace it with this

$comment_user_msn = (isset($comment_row[$i]['user_msn'])) ? format_text($comment_row[$i]['user_msn']) : "";

Or if you want it to show up as a url with http:// in front of the field then use format_url eg.
$comment_user_msn = (isset($comment_row[$i]['user_msn'])) ? format_url($comment_row[$i]['user_msn']) : "";


All I did here was add the sql bit to retrieve the database field and used the format $comment_row[$i]['user_msn' instead


Then you can add the {comment_user_msn_button} in the comments_bit.html or where ever you want, and it will reflect the database field your users fill in on their profile and show up in their comments.
Oh yes you also have to make a little new 16x16.gif file and upload it to where ever you keep your image files.... Look at the ICQ example in your code as a guide...

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD] MSN & AIM User Information
« Reply #6 on: October 27, 2010, 12:43:41 AM »
Hi,

if i edit my profile, i have to fill in something in both msn and aim field else
the form gives an error to fill the fields...

How can i turn of that this fields need to be filled?


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] MSN & AIM User Information
« Reply #7 on: October 27, 2010, 02:24:47 AM »
Hi,

if i edit my profile, i have to fill in something in both msn and aim field else
the form gives an error to fill the fields...

How can i turn of that this fields need to be filled?


Greetz X23

In step #3 change the 1 to a 0 and then the fields will not be required input.
It will look like this instead...
Code: [Select]
$additional_user_fields['user_msn'] = array($lang['user_msn'], "text", 0);
$additional_user_fields['user_aim'] = array($lang['user_aim'], "text", 0);
Buddy Duke
www.budduke.com

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD] MSN & AIM User Information
« Reply #8 on: October 27, 2010, 06:46:40 AM »
In step #3 change the 1 to a 0 and then the fields will not be required input.
It will look like this instead...
Code: [Select]
$additional_user_fields['user_msn'] = array($lang['user_msn'], "text", 0);
$additional_user_fields['user_aim'] = array($lang['user_aim'], "text", 0);

Hi,

thx  :thumbup:


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [MOD] MSN & AIM User Information
« Reply #9 on: December 29, 2010, 03:46:33 AM »
Help  Help Help..!!!!

applied you mod..and my site showing white page only..no errors and no site..

whats wrongs??


www.cusitonline.com

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] MSN & AIM User Information
« Reply #10 on: December 29, 2010, 03:52:33 AM »
Restore backups and try again
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 haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [MOD] MSN & AIM User Information
« Reply #11 on: December 29, 2010, 10:45:38 PM »
Restore backups and try again

Yes My fault.. i did mistake in language file..thats why i was receving only white page..

But now..want little more of this mod if any one can help..

i want to show it on registration page too?

i mean when user register..the user can enter the details there during registration..

Actually i made custom field to set ID which is of four numeric digits..

so is it possible that also restrict them to put only 4 numeric digits? just like transaction PIN..

how to make it possible??