,
.
: DEMO
:


#
#-----[ ]--------------------------------------------
#
templates/subSilver/profile_add_body.tpl

#
#-----[ ]--------------------------------------------
#
<!-- END switch_avatar_block -->

#
#-----[ , ]--------------------------------------
#
<!-- BEGIN switch_user_logged_out -->
<tr>
<td class="catSides" colspan="2" height="28"> </td>
</tr>
<tr>
<th class="thSides" colspan="2" height="12" valign="middle">{L_AVATAR_PANEL}</th>
</tr>
<tr>
<td class="row1"><span class="gen">{L_AVATAR_SELECT}<br /></span><span class="gensmall">{L_AVATAR_SELECT_EXPLAIN}</span></td>
<td class="row2">
<table><tr>
<td><select name="avatar_select" onChange="if (this.value!='') document.images['avatar_select'].src = '{AVATAR_GALLERY_PATH}/' + this.value; else document.images['avatar_select'].src = '{AVATAR_SELECT_START}';" ><option value="">{L_NO_AVATAR}</option>{AVATAR_SELECT_OPTIONS}</select>     </td>
<td><img src="{AVATAR_SELECT_START}" name="avatar_select" /></td>
</tr></table>
</td>
</tr>
<!-- END switch_user_logged_out -->

#
#-----[ ]--------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ ]--------------------------------------------
#
//
// That's all Folks!

#
#-----[ , ]-------------------------------------
#
// Avatar Select on Register MOD
$lang['NO_AVATAR'] = 'NO AVATAR';
$lang['Avatar_register_explain'] = 'Nastroikite za avatara mojete da gi redaktirate sled registriraneto Vi.';


#
#-----[ ]--------------------------------------------
#
includes/usercp_register.php

#
#-----[ ]--------------------------------------------
#
if ( !$error )
{
if ( $avatar_sql == '' )
{
$avatar_sql = ( $mode == 'editprofile' ) ? '' : "'', " . USER_AVATAR_NONE;
}

#
#-----[ ]-------------------------------------
#
if ( !$error )
{
if ( $avatar_sql == '' )
{
if ($mode == 'editprofile')
{
$avatar_sql = '';
}
else
{
$avatar_register = isset($HTTP_POST_VARS['avatar_select']) ? str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['avatar_select']))) : '';
$avatar_sql = ( $avatar_register != '' ) ? "'$avatar_register', " . USER_AVATAR_GALLERY : "'', " . USER_AVATAR_NONE;
}
}

#
#-----[ ]--------------------------------------------
#
$template->assign_vars(array(
'USERNAME' => $username,
'CUR_PASSWORD' => $cur_password,
'NEW_PASSWORD' => $new_password,

#
#-----[ ]-------------------------------------
#
//
// Avatar Select on Register MOD
//
// we must do a brutal work, scanning all the avatar gallery directories
// some codes below i borrowed from usercp_avatar.php
if ($mode == 'register')
{
$dir = @opendir($board_config['avatar_gallery_path']);

$avatar_images = array();
$avatar_names = array();
$avatar_count = 0;
while( $avatar_category = @readdir($dir) )
{
if( $avatar_category != '.' && $avatar_category != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $avatar_category) && !is_link($board_config['avatar_gallery_path'] . '/' . $avatar_category) )
{
$sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $avatar_category);

while( $avatar_file = @readdir($sub_dir) )
{
if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $avatar_file) )
{
$avatar_images[$avatar_count] = $avatar_category . '/' . $avatar_file;
$avatar_names[$avatar_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $avatar_category))) . ' - ' . ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $avatar_file)));
$avatar_count++;
}
}
}
}

@closedir($dir);

@ksort($avatar_images);
@reset($avatar_images);

// Here we dump arrays above to a long string :)
$avatar_select_options = '';
for ($i = 0; $i < $avatar_count; $i++)
{
$avatar_select_options .= '<option value="' . $avatar_images[$i] . '">' . $avatar_names[$i] . '</option>';
}
}
// END Avatar Select on Register MOD ----------------------------
//

#
#-----[ ]--------------------------------------------
#
'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'],
'L_DELETE_AVATAR' => $lang['Delete_Image'],
'L_CURRENT_IMAGE' => $lang['Current_Image'],

#
#-----[ , ]--------------------------------------
#
// Avatar Select on Register
'L_AVATAR_SELECT' => $lang['Select_avatar'],
'L_AVATAR_SELECT_EXPLAIN' => $lang['Avatar_register_explain'],
'AVATAR_SELECT_START' => isset($images['default_avatar']) ? $images['default_avatar'] : 'images/spacer.gif', // hehe... Default Avatar MOD compatible ;)
'L_NO_AVATAR' => $lang['NO_AVATAR'],
'AVATAR_GALLERY_PATH' => $board_config['avatar_gallery_path'],
'AVATAR_SELECT_OPTIONS' => $avatar_select_options,

#
#-----[ SAVE & ]------------------------------------------
#



DEMO

Smile

/ /