[Request] MOD to change Username to image :)

Started by Didds, July 19, 2009, 12:10:12 PM

Previous topic - Next topic

Didds

oooo I'm so excited! I use 2.0 so I'll have to wait till you've finished it to use it :P Thanks so much for this :D
[/center]

Marcus Forsberg

Here's a version for 2.0. Remember to backup the affected files before installing!








Username Images 1.0 Beta 1.1
Replaces usernames around the forum with a automaticly generated text image.
Link to Mod | Development topic

Author: Nas
Type: New feature
Available since: July 26 2009
Latest version: 1.0 Beta 1.1
Compatible with: 1.1.x, 2.0 RC1.2
Available languages:



UNDER DEVELOPMENT
Please not that this mod is not yet finished. Though it works perfectly fine on a frsh installation of SMF, not all features are added and there are a few bugs.

What does it do?
Username Images replaces all usernames around the forum with an automaticly generated image.
Admins can choose font and size. Members can set their image color them selfs.

How does it work?
Username Images uses the GD module to generate a transparent text image using the settings set by admin, and the color choosen by each member.
The image is used in certain key locations such as board index, message index, posts, profiles and more.

How to use
To use Username Images, download the package from the SMF customization site, and install it via your Package Manger.
Then head over to the settings page* and make sure everything is set as you want it to.
Usernames all around the forum will now be changed to images, and users can select their own personal color through their profile.

* = Settings are located in
Admin > Features & settings (1.1.x)
Admin > Modifications > General (2.0)


Support & comments
If you have a problem with this mod, want to comment, or have any question, please post to the modification development topic and I will reply as soon as possible.

Other information
Original idea
o Requested by Didds in [Request] MOD to change Username to image :).
Translation of this mod
o I am always happy to get translations of my work so that more users can use it. If you have translated this modification, please post the translation in the development topic.
Please make sure you have translated everything, and that there are no spelling misstakes etc.
Also, please post both a non-UTF8 version and a UTF8 version.
Please note that repeat changes to the language fiels will occur while this modification is still in beta.
Credits
o Thanks ccbtimewiz and Robbo for helping me out when I killed my servers using the wrong code. :P

Changelog
1.0 Beta 1.1 | July 27 2009
! A bug in generateUserImage.php caused by the font setting should now be fixed.
> Swedish lanugage is added.
* Support for SMF 2.0 is added.
1.0 Beta 1 | July 26 2009
$ Development starts and Beta 1 is released.





Changelog legend
+ New feature
- Feature removal
! Bugfix
> New language
< Removed language
* New version support
$ Initial release / Big update

Versionnames
Format: $.o.x.!
Example: 3.2.4.1

$ New version
o New features added
x Bugfix
! Small bugfix / New version support


Passed versions of this mod
1.0 Beta 1


Didds

I tried to install it but it said "The package you are trying to download or install is either corrupt or not compatible with this version of SMF."

:( I'm using SMF 2.0 RC1.... :(
[/center]

Marcus Forsberg

You should upgrade to SMF 2.0 RC1.2. I only added that version to the installation as the erlier versions has got security issues.

Didds

Ok, but when I try to upgrade, I get this message:

An Error Has Occurred!
Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:
1) Download the package to your local PC and extract it into files.
2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
3) Upload all the files from the extracted package to this directory.
4) Go back to the package manager browse page and the package will be automatically found by SMF.


Can you walk me through how to do it?
[/center]


CesarManara

Hi Nas, i want to use this Mod, but i'am using portuguse_brazilian langague.
So i need the modifications parse.
Can u get me this?

Marcus Forsberg

CesarManara, this is what you need to translate and add to Modifications.portuguese.php:

// Username Images modification by Nas
$txt['ui_font'] = 'Font <div class="smalltext">The font used in the username images. The fonts listed are the default fonts in SMF.';
$txt['ui_width'] = 'Image width <div class="smalltext">The width of the username images.';
$txt['ui_height'] = 'Image height <div class="smalltext">The height of the username images.';
$txt['ui_fontsize'] = 'Font size <div class="smalltext">The font size used in the username images.';
$txt['ui_useshadows'] = 'Use shadows <div class="smalltext">Enable this to add a shadow to each username image.';
$txt['ui_defaultcolor'] = 'Default color <div class="smalltext">This color will be used if an user has not set any color themself. (Hex color code, <b>without leading <i>#</i></b>)';
$txt['ui_forgottb'] = 'Forgottb';
$txt['ui_kimbalt'] = 'Kimbalt';
$txt['ui_screenge'] = 'Screenge';
$txt['ui_walshes'] = 'Walshes';
$txt['ui_venusris'] = 'Venusris';
// Username Images modification by Nas


Also, feel free to hand the translation over to me and I can add it to the default package. :)

CesarManara

$txt['ui_forgottb'] = 'Forgottb';
$txt['ui_kimbalt'] = 'Kimbalt';
$txt['ui_screenge'] = 'Screenge';
$txt['ui_walshes'] = 'Walshes';
$txt['ui_venusris'] = 'Venusris';

These are names? Don't know how to translate.

Marcus Forsberg

Those are font names and does not require any translation at all. :)

CesarManara

So:

Modifications.portuguese_brazilian.php
// Username Images modification by Nas
$txt['ui_font'] = 'Fonte <div class="smalltext">A fonte usada nas imagens dos nomes dos usuários. As fontes listadas são as padrão do SMF.';
$txt['ui_width'] = 'Largura da imagem <div class="smalltext">A largura da imagem do nome dos usuários.';
$txt['ui_height'] = 'Altura da imagem <div class="smalltext">A altura da imagem do nome dos usuários.';
$txt['ui_fontsize'] = 'Tamanho da fonte <div class="smalltext">O tamanho da fonte da imagem do nome dos usuários.';
$txt['ui_useshadows'] = 'Usar sombras <div class="smalltext">Habilite isto para adicionar sombreamento nas imagens.';
$txt['ui_defaultcolor'] = 'Cor padrão <div class="smalltext">Esta cor vai ser usada se o usuário não escolher uma cor. (Código Hex, <b>Sem usar o prefixo <i>#</i></b>)';
$txt['ui_forgottb'] = 'Forgottb';
$txt['ui_kimbalt'] = 'Kimbalt';
$txt['ui_screenge'] = 'Screenge';
$txt['ui_walshes'] = 'Walshes';
$txt['ui_venusris'] = 'Venusris';
// Username Images modification by Nas

Marcus Forsberg

That's correct. Would you like me to include this translation in the package in the next update? :)

CesarManara

#72
Quote from: Nas on July 27, 2009, 12:47:56 PM
That's correct. Would you like me to include this translation in the package in the next update? :)

Yeah. this will be a nice thing.

But i'am getting erros when install the mod =/
Will edit here with the errors.

Edit: the red things are Error.

Edit2: I've translated another mod by you.
http://www.simplemachines.org/community/index.php?topic=321247.msg2175427#msg2175427

Marcus Forsberg

CesarManara, that must be because of other mods conflicting.




I added this tonight:
http://www.forentadatorerna.se/index.php?action=projects

It a WIP, but feel free to sign up and report bugs or reuqest features for this, and my other mods.
To report/request, log in and click on "Report issue" while viewing a project.:)

t2noob

Can you make it so I can use the parser with this mod?
I was trying to see so I can edit as necessary to use with my mod but I got this error when I used the parser
Note: If a file does not exist in your theme, it doesn't matter (as the file from the Default theme will be used).

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 252: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xE4 0x6E 0x64 0x73 in /home/dragonfl/public_html/resourcez/PackageParser/index.php on line 450

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: $txt['ui_font'] = 'Typsnitt <div class="smalltext">Det tyspnitt som anv�nds i an in /home/dragonfl/public_html/resourcez/PackageParser/index.php on line 450

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/dragonfl/public_html/resourcez/PackageParser/index.php on line 450

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/dragonfl/public_html/resourcez/PackageParser/index.php:450 Stack trace: #0 /home/dragonfl/public_html/resourcez/PackageParser/index.php(450): SimpleXMLElement->__construct('<?xml version="...') #1 /home/dragonfl/public_html/resourcez/PackageParser/index.php(419): parseModificationXML('/tmp/install1.1...', Object(SimpleXMLElement), 'theme') #2 /home/dragonfl/public_html/resourcez/PackageParser/index.php(94): parsePackageInfoXML('/tmp/package-in...', 'install', 'theme') #3 /home/dragonfl/public_html/resourcez/PackageParser/index.php(777): parseArchive() #4 {main} thrown in /home/dragonfl/public_html/resourcez/PackageParser/index.php on line 450

Marcus Forsberg

#75
Here are the manual installation inctructions for SMF 1.1.x. I'll post the edits for 2.0 in a bit.
Please backup all affected files and your database before follwoing this, incase I made a misstake in the guide.





Manual installation of Username Images

SMF 1.1.x



./Sources/BoardIndex.php

Code (Find) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>'
Code (Replace with) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . generateUsernameImage($row_board['modRealName']) . '</a>'




Code (Find) Select
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : $row_board['realName']) : $txt[470],
Code (Replace with) Select
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . generateUsernameImage($row_board['realName']). '</a>' : $row_board['realName']) : $txt[470],




Code (Find) Select
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

Code (Replace with) Select
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . generateUsernameImage($row['realName']) . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . generateUsernameImage($row['realName']) . '</a>';









./Sources/MessageIndex.php

Code (Find) Select
'username' => $row_board['posterName'] != '' ? $row_board['posterName'] : $txt[470],
'name' => $row_board['realName'],
'href' => !empty($row_board['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] : '',
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : $row_board['realName']) : $txt[470],

Code (Replace with) Select
'username' => generateUsernameImage($row_board['posterName']) != '' ? generateUsernameImage($row_board['posterName']) : $txt[470],
'name' => generateUsernameImage($row_board['realName']),
'href' => !empty($row_board['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] : '',
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . generateUsernameImage($row_board['realName']) . '</a>' : generateUsernameImage($row_board['realName'])) : $txt[470],
),





Code (Find) Select
'name' => $row_board['modRealName'],
'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>'
);
$context['boards'][$row_board['ID_BOARD']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>';

Code (Replace) Select
'name' => generateUsernameImage($row_board['modRealName']),
'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . generateUsernameImage($row_board['modRealName']) . '</a>'
);
$context['boards'][$row_board['ID_BOARD']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . generateUsernameImage($row_board['modRealName']) . '</a>';





Code (Find) Select
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

Code (Replace with) Select
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . generateUsernameImage($row['realName']) . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . generateUsernameImage($row['realName']) . '</a>';





Code (Find) Select
'username' => $row['memberName'],
Code (Replace with) Select
'username' => generateUsernameImage($row['memberName']),




Code (Find) Select
'member' => array(
'username' => $row['firstMemberName'],
'name' => $row['firstDisplayName'],
'id' => $row['firstID_MEMBER'],
'href' => !empty($row['firstID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] : '',
'link' => !empty($row['firstID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstDisplayName'] . '">' . $row['firstDisplayName'] . '</a>' : $row['firstDisplayName']
),

Code (Replace with) Select
'member' => array(
'username' => generateUsernameImage($row['firstMemberName']),
'name' => generateUsernameImage($row['firstDisplayName']),
'id' => $row['firstID_MEMBER'],
'href' => !empty($row['firstID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] : '',
'link' => !empty($row['firstID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstDisplayName'] . '">' . generateUsernameImage($row['firstDisplayName']) . '</a>' : generateUsernameImage($row['firstDisplayName'])
),





Code (Find) Select
'member' => array(
'username' => $row['lastMemberName'],
'name' => $row['lastDisplayName'],
'id' => $row['lastID_MEMBER'],
'href' => !empty($row['lastID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] : '',
'link' => !empty($row['lastID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] . '">' . $row['lastDisplayName'] . '</a>' : $row['lastDisplayName']
),

Code (Replace with) Select
'member' => array(
'username' => generateUsernameImage($row['lastMemberName']),
'name' => generateUsernameImage($row['lastDisplayName']),
'id' => $row['lastID_MEMBER'],
'href' => !empty($row['lastID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] : '',
'link' => !empty($row['lastID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] . '">' . generateUsernameImage($row['lastDisplayName']) . '</a>' : generateUsernameImage($row['lastDisplayName'])
),









./Sources/Subs.php

Code (Find) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '">' . $modSettings['latestRealName'] . '</a>',
Code (Replace with) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '">' . generateUsernameImage($modSettings['latestRealName']) . '</a>',




Code (Add to end of file (Before ?>)) Select
// Turn a regular username into an image (Username Image Mod by Nas)
function generateUsernameImage($username)
{
global $boardurl, $db_prefix, $modSettings;

$request = db_query("
SELECT nameColor
FROM {$db_prefix}members
WHERE realName = '$username'
LIMIT 1", __FILE__, __LINE__);

$row = mysql_fetch_assoc($request);

    mysql_free_result($request);

return '<img src="' . $boardurl. '/generateUserImage.php?username=' . $username . ';color=' . $row['nameColor'] . '" alt="' . $username . '" border="0" />';

sleep(1);
}









./Sources/Display.php

Code (Find) Select
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

Code (Replace with) Select
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . generateUsernameImage($row['realName']) . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . generateUsernameImage($row['realName']) . '</a>';





Code (Find) Select
'name' => $row['realName'],
Code (Replace with) Select
'name' => generateUsernameImage($row['realName']),







./Sources/Load.php

Code (Find) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>',
Code (Replace with) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . generateUsernameImage($profile['realName']) . '</a>',




Code (Find) Select
'blurb' => &$profile['personalText'],
Code (Add below this line) Select
'nameColor' => &$profile['nameColor'],




Code (Find) Select
mem.signature, mem.personalText, mem.location, mem.gender, mem.avatar, mem.ID_MEMBER, mem.memberName,
Code (Replace with) Select
mem.signature, mem.personalText, mem.location, mem.gender, mem.avatar, mem.ID_MEMBER, mem.memberName, mem.nameColor,




Code (Find) Select
mem.realName, mem.emailAddress, mem.hideEmail, mem.dateRegistered, mem.websiteTitle, mem.websiteUrl,
Code (Replace with) Select
mem.realName, mem.emailAddress, mem.hideEmail, mem.dateRegistered, mem.websiteTitle, mem.websiteUrl, mem.nameColor,








./Sources/ModSettings.php

Code (Find) Select
// Basic stuff, user languages, titles, flash, permissions...
Code (Add below line) Select
// The Username Image modification by Nas.
array('select', 'ui_font', array(&$txt['ui_forgottb'], &$txt['ui_kimbalt'], &$txt['ui_screenge'], &$txt['ui_walshes'], &$txt['ui_venusris'])),
array('int', 'ui_fontsize'),
array('text', 'ui_defaultcolor'),
array('int', 'ui_width'),
array('int', 'ui_height'),
array('check', 'ui_useshadows'),
'',







./Sources/Profile.php

Code (Find) Select
'gender' => array('name' => empty($user_profile[$memID]['gender']) ? '' : ($user_profile[$memID]['gender'] == 2 ? 'f' : 'm')),
Code (Add below line) Select
'nameColor' => empty($user_profile[$memID]['nameColor']) ? '' : $user_profile[$memID]['nameColor'],




Code (Find) Select
'signature', 'personalText', 'avatar',
Code (Replace with) Select
'signature', 'personalText', 'avatar', 'nameColor',




Code (Find) Select
'blurb' => !isset($_POST['personalText']) ? '' : str_replace(array('<', '>', '&amp;#039;'), array('&lt;', '&gt;', '&#039;'), stripslashes($_POST['personalText'])),
Code (Add below line) Select
'nameColor' => !isset($_POST['nameColor']) ? '' : $_POST['nameColor'],







./Themes/{your_theme}/index.template.php

Code (Find) Select
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
Code (Replace with) Select
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', generateUsernameImage($context['user']['name']) , '</b></span>







./Themes/default/Profile.template.php

Code (Find) Select
', $txt['summary'], ' - ', $context['member']['name'], '
Code (Replace with) Select
', $txt['summary'], ' - ', generateUsernameImage($context['member']['name']), '




Code (Find) Select
<td>', $context['member']['name'], '</td>
Code (Replace with) Select
<td>', generateUsernameImage($context['member']['name']), '</td>




Code (Find) Select
// Personal text...
echo '
<tr>
<td width="40%"><b>', $txt[228], ': </b></td>
<td><input type="text" name="personalText" size="50" maxlength="50" value="', $context['member']['blurb'], '" /></td>
</tr>
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr>';

Code (Replace with) Select
// Personal text...
echo '
<tr>
<td width="40%"><b>', $txt[228], ': </b></td>
<td><input type="text" name="personalText" size="50" maxlength="50" value="', $context['member']['blurb'], '" /></td>
</tr>';

// Let them choose their username color.
echo '
<tr>
<td width="40%"><b>', $txt['ui_namecolor'], ': </b><div class="smalltext">', $txt['ui_namecolor_desc'], '</div></td>
<td><input type="text" name="nameColor" size="6" maxlength="6" value="', $context['member']['nameColor'], '" /></td>
</tr>
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr>';









./Themes/default/Who.template.php

Code (Find) Select
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt[92] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '</span>';
Code (Replace with) Select
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt[92] . ' ' . $member['name'] . '">' . generateUsernameImage($member['name']) . '</a>', '</span>';







./Themes/default/Admin.template.php

Code (Find) Select
<b>', $txt['hello_guest'], ' ', $context['user']['name'], '!</b>
Code (Replace with) Select
<b>', $txt['hello_guest'], ' ', generateUsernameImage($context['user']['name']), '</b>







./Themes/default/languages/Modifications.english.php

Code (Add to the end of the file (Before ?>)) Select
// Username Images modification by Nas
//Admin settings
$txt['ui_font'] = 'Font <div class="smalltext">The font used in the username images. The fonts listed are the default fonts in SMF.</div>';
$txt['ui_width'] = 'Image width <div class="smalltext">The width of the username images.</div>';
$txt['ui_height'] = 'Image height <div class="smalltext">The height of the username images.</div>';
$txt['ui_fontsize'] = 'Font size <div class="smalltext">The font size used in the username images.</div>';
$txt['ui_useshadows'] = 'Use shadows <div class="smalltext">Enable this to add a shadow to each username image.</div>';
$txt['ui_defaultcolor'] = 'Default color <div class="smalltext">This color will be used if an user has not set any color themself. (Hex color code, <b>without leading <i>#</i></b>)</div>';

// Fonts
$txt['ui_forgottb'] = 'Forgottb';
$txt['ui_kimbalt'] = 'Kimbalt';
$txt['ui_screenge'] = 'Screenge';
$txt['ui_walshes'] = 'Walshes';
$txt['ui_venusris'] = 'Venusris';

// Others
$txt['ui_namecolor'] = 'Username color';
$txt['ui_namecolor_desc'] = 'Your username image will have this color. Leave empty for default. (Hex color code, <b>without leading <i>#</i></b>)';
// Username Images modification by Nas









Move the included file generateUserImage.php to your SMF root directory.








Run the included file dbModification_1.1.x.php







Marcus Forsberg

#76
Here are the insturctions for SMF 2.0. Again, make backups, please!





Manual installation of Username Images

SMF 2.0



./Sources/Subs-BoardIndex.php

Code (Find) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_moderator'] . '" title="' . $txt['board_moderator'] . '">' . $row_board['mod_real_name'] . '</a>'
Code (Replace with) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_moderator'] . '" title="' . $txt['board_moderator'] . '">' . generateUsernameImage($row_board['mod_real_name']) . '</a>'




Code (Find) Select
'link' => $row_board['poster_name'] != '' ? (!empty($row_board['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_member'] . '">' . $row_board['real_name'] . '</a>' : $row_board['real_name']) : $txt['not_applicable'],
Code (Replace with) Select
'link' => $row_board['poster_name'] != '' ? (!empty($row_board['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_member'] . '">' . generateUsernameImage($row_board['real_name']) . '</a>' : generateUsernameImage($row_board['real_name'])) : $txt['not_applicable'],








./Sources/MessageIndex.php

Code (Find) Select
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';

Code (Replace with) Select
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . generateUsernameImage($row['real_name']) . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . generateUsernameImage($row['real_name']) . '</a>';





Code (Find) Select
$context['view_members'][$row['log_time'] . $row['member_name']] = array(
'id' => $row['id_member'],
'username' => $row['member_name'],
'name' => $row['real_name'],

Code (Replace with) Select
$context['view_members'][$row['log_time'] . $row['member_name']] = array(
'id' => $row['id_member'],
'username' => generateUsernameImage($row['member_name']),
'name' => generateUsernameImage($row['real_name']),





Code (Find) Select
'member' => array(
'username' => $row['first_member_name'],
'name' => $row['first_display_name'],
'id' => $row['first_id_member'],
'href' => !empty($row['first_id_member']) ? $scripturl . '?action=profile;u=' . $row['first_id_member'] : '',
'link' => !empty($row['first_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['first_id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_display_name'] . '">' . $row['first_display_name'] . '</a>' : $row['first_display_name']
),

Code (Replace with) Select
'member' => array(
'username' => generateUsernameImage($row['first_member_name']),
'name' => generateUsernameImage($row['first_display_name']),
'id' => $row['first_id_member'],
'href' => !empty($row['first_id_member']) ? $scripturl . '?action=profile;u=' . $row['first_id_member'] : '',
'link' => !empty($row['first_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['first_id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_display_name'] . '">' . generateUsernameImage($row['first_display_name']) . '</a>' : generateUsernameImage($row['first_display_name'])
),





Code (Find) Select
'member' => array(
'username' => $row['last_member_name'],
'name' => $row['last_display_name'],
'id' => $row['last_id_member'],
'href' => !empty($row['last_id_member']) ? $scripturl . '?action=profile;u=' . $row['last_id_member'] : '',
'link' => !empty($row['last_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['last_id_member'] . '">' . $row['last_display_name'] . '</a>' : $row['last_display_name']
),

Code (Replace with) Select
'member' => array(
'username' => generateUsernameImage($row['last_member_name']),
'name' => generateUsernameImage($row['last_display_name']),
'id' => $row['last_id_member'],
'href' => !empty($row['last_id_member']) ? $scripturl . '?action=profile;u=' . $row['last_id_member'] : '',
'link' => !empty($row['last_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['last_id_member'] . '">' . generateUsernameImage($row['last_display_name']) . '</a>' : generateUsernameImage($row['last_display_name'])
),










./Sources/Subs.php

Code (Find) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '">' . $modSettings['latestRealName'] . '</a>',
Code (Replace with) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '">' . generateUsernameImage($modSettings['latestRealName']) . '</a>',




Code (Add to the end of the file (Before ?)) Select
// Turn a regular username into an image (Username Image Mod by Nas)
function generateUsernameImage($username)
{
global $boardurl, $db_prefix, $smcFunc, $modSettings;

$request = $smcFunc['db_query']('', '
SELECT nameColor
FROM {db_prefix}members
WHERE real_name = {string:username}',
array(
'username' => $username,
)
);

$row = $smcFunc['db_fetch_assoc']($request);

    $smcFunc['db_free_result']($request);

return '<img src="' . $boardurl. '/generateUserImage.php?username=' . $username . ';color=' . $row['nameColor'] . '" alt="' . $username . '" border="0" />';

sleep(1);
}










./Sources/Display.php

Code (Find) Select
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';

Code (Replace with) Select
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . generateUsernameImage($row['real_name']) . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . generateUsernameImage($row['real_name']) . '</a>';









./Sources/Load.php

Code (Find) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '">' . $profile['real_name'] . '</a>',
Code (Replace with) Select
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '">' . generateUsernameImage($profile['real_name']) . '</a>',




Code (Find) Select
'blurb' => $profile['personal_text'],
Code (Add below line) Select
'blurb' => $profile['nameColor'],




Code (Find) Select
mem.signature, mem.personal_text, mem.location, mem.gender, mem.avatar, mem.id_member, mem.member_name,
Code (Replace with) Select
mem.signature, mem.personal_text, mem.location, mem.gender, mem.avatar, mem.id_member, mem.member_name, mem.nameColor,




Code (Find) Select
mem.real_name, mem.email_address, mem.hide_email, mem.date_registered, mem.website_title, mem.website_url,
Code (Replace with) Select
mem.real_name, mem.email_address, mem.hide_email, mem.date_registered, mem.website_title, mem.website_url, mem.nameColor,








./Sources/ManageSettings.php

Code (Find) Select
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!
Code (Add below this line) Select
// The Username Image modification by Nas.
array('select', 'ui_font', array(&$txt['ui_forgottb'], &$txt['ui_kimbalt'], &$txt['ui_screenge'], &$txt['ui_walshes'], &$txt['ui_venusris'])),
array('int', 'ui_fontsize'),
array('text', 'ui_defaultcolor'),
array('int', 'ui_width'),
array('int', 'ui_height'),
array('check', 'ui_useshadows'),
'',









./Sources/Profile-Modify.php

Code (Find) Select
'avatar_choice', 'personal_text', 'hr',
Code (Replace with) Select
'avatar_choice', 'personal_text', 'hr', 'nameColor',





Code (Find) Select
'personal_text' => array(
'type' => 'text',
'label' => $txt['personal_text'],
'log_change' => true,
'input_attr' => array('maxlength="50"'),
'size' => 50,
'permission' => 'profile_extra',
),

Code (Replace with) Select
'nameColor' => array(
'type' => 'text',
'label' => $txt['ui_namecolor'],
'subtext' => $txt['ui_namecolor_desc'],
'log_change' => false,
'input_attr' => array('maxlength="6"'),
'size' => 6,
'permission' => 'profile_extra',
),









./Sources/Subs-MembersOnline.php

Code (Find) Select
// Some basic color coding...
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';

Code (Replace with) Select
// Some basic color coding...
if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . generateUsernameImage($row['real_name']). '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . generateUsernameImage($row['real_name']) . '</a>';









./Themes/{your_theme}/index.template.php

Code (Find) Select
<li id="name">', $txt['hello_member_ndt'], ' <em>', $context['user']['name'], '</em></li>';
Code (Replace with) Select
<li id="name">', $txt['hello_member_ndt'], ' <em>', generateUsernameImage($context['user']['name']), '</em></li>';








./Themes/default/Profile.template.php

Code (Find) Select
<h4>', $context['member']['name'], ' <span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span></h4>
Code (Replace with) Select
<h4>', generateUsernameImage($context['member']['name']), ' <span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span></h4>








./Themes/default/Who.template.php

Code (Find) Select
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '</span>';
Code (Replace with) Select
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . generateUsernameImage($member['name']) . '</a>', '</span>';








./Themes/default/Admin.template.php

Code (Find) Select
<b>', $txt['hello_guest'], ' ', $context['user']['name'], '!</b>
Code (Replace with) Select
<b>', $txt['hello_guest'], ' ', generateUsernameImage($context['user']['name']), '</b>








./Themes/default/ModerationCenter.template.php

Code (Find) Select
<b>', $txt['hello_guest'], ' ', $context['user']['name'], '!</b>
Code (Replace with) Select
<b>', $txt['hello_guest'], ' ', generateUsernameImage($context['user']['name']), '</b>








./Themes/default/languages/Modifications.english.php

Code (Add to the end of the file (Before ?>)) Select
// Username Images modification by Nas
//Admin settings
$txt['ui_font'] = 'Font <div class="smalltext">The font used in the username images. The fonts listed are the default fonts in SMF.</div>';
$txt['ui_width'] = 'Image width <div class="smalltext">The width of the username images.</div>';
$txt['ui_height'] = 'Image height <div class="smalltext">The height of the username images.</div>';
$txt['ui_fontsize'] = 'Font size <div class="smalltext">The font size used in the username images.</div>';
$txt['ui_useshadows'] = 'Use shadows <div class="smalltext">Enable this to add a shadow to each username image.</div>';
$txt['ui_defaultcolor'] = 'Default color <div class="smalltext">This color will be used if an user has not set any color themself. (Hex color code, <b>without leading <i>#</i></b>)</div>';

// Fonts
$txt['ui_forgottb'] = 'Forgottb';
$txt['ui_kimbalt'] = 'Kimbalt';
$txt['ui_screenge'] = 'Screenge';
$txt['ui_walshes'] = 'Walshes';
$txt['ui_venusris'] = 'Venusris';

// Others
$txt['ui_namecolor'] = 'Username color';
$txt['ui_namecolor_desc'] = 'Your username image will have this color. Leave empty for default. (Hex color code, <b>without leading <i>#</i></b>)';
// Username Images modification by Nas









Move the included file generateUserImage.php to your SMF root directory.








Run the included file dbModification_2.0.php








Marcus Forsberg

Beta 2 is ready and attached. As usual, please backup before installing! If you find a bug or want to request a feature, please post a file here (No registration required).








Username Images 1.0 Beta 2
Replaces usernames around the forum with a automaticly generated text image.
Link to Mod | Development topic | Bugreports / Feature requests

Author: Nas
Type: New feature
Available since: July 26 2009
Latest version: 1.0 Beta 2
Compatible with: 1.1.x, 2.0 RC1.2
Available languages:



UNDER DEVELOPMENT
Please not that this mod is not yet finished. Though it works perfectly fine on a frsh installation of SMF, not all features are added and there are a few bugs.

What does it do?
Username Images replaces all usernames around the forum with an automaticly generated image.
Admins can choose font and size. Members can set their image color them selfs.

How does it work?
Username Images uses the GD module to generate a transparent text image using the settings set by admin, and the color choosen by each member.
The image is used in certain key locations such as board index, message index, posts, profiles and more.

How to use
To use Username Images, download the package from the SMF customization site, and install it via your Package Manger.
Then head over to the settings page* and make sure everything is set as you want it to.
Usernames all around the forum will now be changed to images, and users can select their own personal color through their profile.

* = Settings are located in
Admin > Features & settings (1.1.x)
Admin > Modifications > General (2.0)


Support & comments
If you have a problem with this mod, want to comment, or have any question, please post to the modification development topic and I will reply as soon as possible.

Other information
Original idea
o Requested by Didds in [Request] MOD to change Username to image :).
Translation of this mod
o I am always happy to get translations of my work so that more users can use it. If you have translated this modification, please post the translation in the development topic.
Please make sure you have translated everything, and that there are no spelling misstakes etc.
Also, please post both a non-UTF8 version and a UTF8 version.
Please note that repeat changes to the language fiels will occur while this modification is still in beta.
Credits
o Thanks ccbtimewiz and Robbo for helping me out when I killed my servers using the wrong code. :P

Changelog
1.0 Beta 2 | July 29 2009
! An unnoticed parse error in MessageIndex.php fixed. (SMF 1.1.x)
! Images were not displayed in user online at the board index. (SMF 2.0)
! A bad query killed the forum.
! A typo hid three of the fonts in the ACP.
+ Users can now choose their own color through their profiles.
> Portugueze_brazilian lanugage is added. Thanks to CesarMana.
1.0 Beta 1.1 | July 27 2009
! A bug in generateUserImage.php caused by the font setting should now be fixed.
> Swedish lanugage is added.
* Support for SMF 2.0 is added.
1.0 Beta 1 | July 26 2009
$ Development starts and Beta 1 is released.





Changelog legend
+ New feature
- Feature removal
! Bugfix
> New language
< Removed language
* New version support
$ Initial release / Big update

Versionnames
Format: $.o.x.!
Example: 3.2.4.1

$ New version
o New features added
x Bugfix
! Small bugfix / New version support


Passed versions of this mod
1.0 Beta 1.1
1.0 Beta 1


Didds

Cooooool :)

Still haven't been able to get FTP access yet, so I still can't use it :( But I'm excited for it :D
[/center]

t2noob

Is there a  way to add a font style to the mod?

Advertisement: