2010-07-06, 02:24 AM
First of all all credits to Blindkilla who is the ex-owner of Vorbb forums. This mod replaces your username with an image. The direct link can be found here - http://vorbb.com/thread-361-post-2117.html
(2009-08-21, 06:56 PM)Blindkilla Wrote: [ -> ]This isn't a file, it only requires some file modification. What this does is give you or users an option to replace their username in the postbit with an image.
Step 1 - Adding a custom profile field
Go to - Admin CP -> Configuration -> Custom Profile Fields -> Add new field
Title and short description: add something descriptive so you don't forget what it's for later.
Field: Textbox
Max length: 0
Field length: 0
Selectable Options: leave blank
Display Order: If you haven't added any custom profile fields before then you should put 4 here
Required/Editable by user/profile fields: These three choices are up to you.
Step 2 - Editing functions.php and functions_post.php
Open /inc/functions.php and find the following function REPLACE THE WHOLE FUNCTION INCLUDING CODE INSIDE:
function build_profile_link($username="", $uid=0, $target="", $onclick="") { }
Replace the entire function with this:
function build_profile_link($username="", $uid=0, $imgg="0", $userimage="", $target="", $onclick="") { global $lang; if(!$username && $uid == 0) { // Return Guest phrase for no UID, no guest nickname return $lang->guest; } elseif($uid == 0) { // Return the guest's nickname if user is a guest but has a nickname return $username; } else { // Build the profile link for the registered user if(!empty($target)) { $target = " target=\"{$target}\""; } if(!empty($onclick)) { $onclick = " onclick=\"{$onclick}\""; } // If we're in the archive, link back a directory if ($imgg == 1){ if(IN_ARCHIVE == 1) { return "<a href=\"../../".get_profile_link($uid)."\"{$target}{$onclick}><img src=\"{$userimage}\" /></a>"; } elseif(IN_ADMINCP == 1) { return "<a href=\"../".get_profile_link($uid)."\"{$target}{$onclick}><img src=\"{$userimage}\" /></a>"; } else { return "<a href=\"".get_profile_link($uid)."\"{$target}{$onclick}><img src=\"{$userimage}\" /></a>"; } } else { if(IN_ARCHIVE == 1) { return "<a href=\"../../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>"; } elseif(IN_ADMINCP == 1) { return "<a href=\"../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>"; } else { return "<a href=\"".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>"; } } } }
Open /inc/functions_post.php and find the following line (should be 226):
$post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid']);
Underneath it add the following code:
if ($post['fid4'] != ""){ $post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid'], 1, $post['fid4']); }
Note: $post['fid4'], the 4 should be replaced with the ID of the custom profile field.
You're done, to add an image you can search the user in Admin CP like you would normally and edit it, find the custom field you added and input the link for where your image is. Ex: http://website.com/username.png
If you have any problems let me know