[TUT] Switch Photos to Avatars (IPB 3.x)

Status
Not open for further replies.

Golden Falcon

Active Member
867
2008
16
0
[TUT] Switch Photos to Avatars (IPB 3.x)

Description: This will make it so all global photo variables show as avatar pictures instead. Meaning, all your members will have only one picture choice for their profiles.

Results
1. http://i49.tinypic.com/4pvwp5.png
2. http://i49.tinypic.com/14jukg8.png
3. http://i45.tinypic.com/15z2lp3.png

Edit Time: ~ 5 Minutes

Step 0: Please make sure you backup your files.

Step 1: Open admin/sources/base/core.php

Step 2: Find (Line 7071):
Code:
$member['pp_thumb_photo'] = ipsRegistry::$settings['upload_url'] . '/' . $member['pp_thumb_photo'];

Step 3: Replace with:
Code:
					$member['pp_thumb_photo']  = $member['avatar_location']; // all popup javascript arrows will show avatar pictures

Step 4: Find (Line 7093 - 7102):
Code:
//-----------------------------------------
			// Mini
			//-----------------------------------------

			$_data = IPSLib::scaleImage( array( 'max_height' => 25, 'max_width' => 25, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height'] ) );

			$member['pp_mini_photo']  = $member['pp_thumb_photo'];
			$member['pp_mini_width']  = $_data['img_width'];
			$member['pp_mini_height'] = $_data['img_height'];
		}

Step 5: Add after:
Code:
//Force ALL photos to be avatars.
if(!empty($member['avatar_location']) && basename($member['pp_main_photo']) === 'default_large.png'){
			$member['pp_main_photo'] = $member['avatar_location'];
			$member['pp_thumb_photo'] = $member['avatar_location'];
			$member['pp_mini_photo'] = $member['avatar_location'];
			$member['fb_photo'] = $member['avatar_location'];
			$member['fb_photo_thumb'] = $member['avatar_location'];
		}

Step 6: Save, Upload & Replace

Extras: If you want a default avatar to show for every user, just follow In Flame's instructions.

try this:

1. Go to your FTP server: /public/style_avatars
2. Delete: blank_avatar.gif
3. Upload your default avatar to: /public/style_avatars
4. Rename it to: blank_avatar.gif
5. Go to your Admin CP: Look & Feel -> IP.Board (or your skin set) -> Templates -> Global Templates -> userInfoPane
6. Find:
Code:
        <else />
            <li class='avatar'>{$author['avatar']}</li>
        </if>

7. Replace with:
Code:
        <else />
            <li class='avatar'><a href="{parse url="showuser={$author['member_id']}" template="showuser" seotitle="{$author['members_seo_name']}" base="public"}" title="{$this->lang->words['view_profile']}"><img src="{$this->settings['public_dir']}/style_avatars/blank_avatar.gif" alt=""></a></li>
        </if>
 
2 comments
Cant seem to get this working on my board. The photos are not being pulled in as avatars on the posts. Also the image on the user nav (upper right corner) does not seem to be functioning either, it does not display any image
 
Wonderful!! This is just what I needed, thank you!

However, I'm having some issues with IPB 3.1.2
This is not working with avatars that have been uploaded. It works great for offsite avatars, but it's getting the wrong location for uploaded avatars. My forum is in a /forum/ subdirectory, but it's looking in the root.

Any thoughts?
 
Status
Not open for further replies.
Back
Top