[solved] avatar in contact list - how?
-----
| Author | Message | |
|---|---|---|
|
jerx |
||
| Thu Aug 25, 2005 4:23 pm Post subject: [solved] avatar in contact list - how? | ||
|
Hello,
I tried to add avatars to the contact list by trying to use these instructions: Code: ######################################################## ## ## Mod Title: Avatar in memberlist ## Mod Version: 1.0.0 ## Author: Kenny aka Gordon (http://kdg.fm.pri.ee/) ## ## Description: ## This mod will add user's avatar to the memberlist ## if the user has specified it in his/her profile. ## It was designed for PHPBB 2.0+ ## ## Installation Level: Easy as *! ## Installation Time: pretty short ## ######################################################## // Directions: ----------------------------------------- ? Open /templates/themename/memberlist_body.tpl Find: >>> <th class="thCornerR" nowrap="nowrap">{L_WEBSITE}</th> After add: >>> <th class="thCornerR" nowrap="nowrap">Avatar</th> Find: >>> <td class="{memberrow.ROW_CLASS}" align="center"> {memberrow.WWW_IMG} </td> After add: >>> <td class="{memberrow.ROW_CLASS}" align="center"> {memberrow.AVATAR_IMG} </td> Find: >>> <td class="catbottom" colspan="9" NOTE: if u have installed other hacks that modify the memberlist, there could be different nunber (not 9) Replace with: >>> <td class="catbottom" colspan="10" ? Open /memberlist.php Find: >>> $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; After add: >>> $avatar_img = ($row['user_avatar'] && $row['user_avatar_type']==2 ? '<img src=' . $row['user_avatar'] . '>' : ($row['user_avatar'] && $row['user_avatar_type']==3 ? '<img src=images/avatars/gallery/' . $row['user_avatar'] . '>' : false)); Find: >>> 'WWW' => $www, After add: >>> 'AVATAR_IMG' => $avatar_img, I think the code is not right, because I had to change it to: Code: $avatar_img = ($row['user_avatar'] && $row['user_avatar_type']==1 ? '<img src=images/avatars/' . $row['user_avatar'] . '>' :($row['user_avatar'] && $row['user_avatar_type']==2 ? '<img src=' . $row['user_avatar'] . '>' : ($row['user_avatar'] && $row['user_avatar_type']==3 ? '<img src=images/avatars/gallery/' . $row['user_avatar'] . '>' : false)));
This worked for the memberlist, but I can' t get it to work on the contact list. I added the code into following files: show.tpl contactcp_show.php I also added ", user_avatar" into contactcp_edit.php ($sql = 'SELECT user_id, user_avatar FROM ' . USERS_TABLE . "WHERE username='$username'";). I think this makes it obvious that I have no idea of php and I just go the trial and error route. Can anyone help me with this problem? Last edited by jerx on Fri Aug 26, 2005 10:04 pm; edited 1 time in total |
||
|
Thoul |
||
| Thu Aug 25, 2005 9:11 pm Post subject: re: avatar in contact list - how? | ||
|
Welcome to phpBB Smith!
In class_contact.php, find this line: Code: $sql = 'SELECT ' . $fields_sql . ', u.username FROM ' . CONTACT_TABLE . ' c, ' . USERS_TABLE . ' u WHERE u.user_id = ' . $field_check_sql;
Change it to: Code: $sql = 'SELECT ' . $fields_sql . ', u.username, u.user_avatar, u.user_avatar_type FROM ' . CONTACT_TABLE . ' c, ' . USERS_TABLE . ' u WHERE u.user_id = ' . $field_check_sql;
Then in contactcp_show.php, use: Code: $avatar_img = ($val['user_avatar'] && $val['user_avatar_type']==1 ? '<img src=images/avatars/' . $val['user_avatar'] . '>' :($val['user_avatar'] && $val['user_avatar_type']==2 ? '<img src=' . $val['user_avatar'] . '>' : ($val['user_avatar'] && $val['user_avatar_type']==3 ? '<img src=images/avatars/gallery/' . $val['user_avatar'] . '>' : false)));
Give that a try, and hopefully that will be all you need to do. The edit to contactcp_edit.php isn't necessary, so you can remove that. |
||
|
jerx |
||
| Thu Aug 25, 2005 10:51 pm Post subject: re: avatar in contact list - how? | ||
|
Thank you very much, Thoul! It works great!
|
||
Page 1 of 1