View Full Version : Specify Avatar on Registration
Chroder
05-12-2006, 10:00 PM
This plugin just lets users upload their custom avatar on registration.
In the vB Options, you can choose to disable the URL or upload field (if you only want one or the other). The options are under 'User Registration Options'.
To Install
Install the product, then look in the attached install.txt for the template mod. You need to modify one template (register).
Avatar Permissions
Permissions (max width/height, filesize, animated etc) are gathered from the regsitered user groups permissions (usergroupid 2). To change them, just do it through the usergroup manager.
Updates
May 14, 2006
Plugin now works for those who are storing avatars in the filesystem. Thanks to chatbum for identifying the issue.
Note: If the user chooses an invalid image, the image won't be uploaded but the user won't see any error notices. This is due to the way vB handles registration and the way the uploads are handled, I coudn't find a way to insert error checking. Image errors are only checked on upload, which also binds the image to the user account at the same time. So I couldn't call it and check for errors before the user existed... If you find a way, let me know ;)
TeaTree
05-13-2006, 08:35 PM
Looks brill-
*installs* :)
Thanks
The Chief
05-13-2006, 08:46 PM
Wow, VERY nice idea!!
will install tonight! :)
Mr Chad
05-13-2006, 09:04 PM
Its not showing up on the registration page. do i need to change the template?
kenji4861
05-14-2006, 12:07 AM
Read his install.txt
"################################################## ######
# Template: register
# >> FIND
################################################## ######
<if condition="$show['regimagecheck']">
<fieldset class="fieldset">
################################################## ######
# >> ABOVE, ADD
################################################## ######
<if condition="$show[avatar_form]">
<fieldset class="fieldset">
<legend>$vbphrase[regava_custom_avatar]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td>
$vbphrase[regava_upload_custom_avatar]
<if condition="$vboptions[regava_show_url]">$vbphrase[regava_enterurl]</if>
<if condition="$vboptions[regava_show_upload]">$vbphrase[regava_upload]</if>
</td>
</tr>
<if condition="$vboptions[regava_show_url]">
<tr>
<td>
$vbphrase[regava_enter_avatar_url]<br />
<input type="text" class="bginput" name="avatarurl" value="http://www." size="50" dir="ltr" />
</td>
</tr>
</if>
<if condition="$vboptions[regava_show_upload]">
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach" />
$vbphrase[regava_upload_avatar_from_computer]<br />
<input type="file" class="bginput" name="upload" size="50" />
</td>
</tr>
</if>
<if condition="$show['maxnote']">
<tr>
<td>$maxnote</td>
</tr>
</if>
</table>
</fieldset>
</if>
derekivey
05-14-2006, 02:37 AM
Nice job Chroder. Going to install it now.
Derek
Mr Chad
05-14-2006, 07:54 AM
for me it looks like it does everything except upload the actual avatar :/
anyone have this working?
Floris
05-14-2006, 09:22 AM
Good job Chroder! :D And thanks for sharing.
Snake
05-14-2006, 12:08 PM
Thank you, been waiting for something like this. :)
Sychev_S
05-14-2006, 03:34 PM
Is there any way to do the same thing for profile picture? That would be awesome!
moonclamp
05-14-2006, 04:22 PM
Is there any way to do the same thing for profile picture? That would be awesome!
I agree. That would be very welcome.
Especially if it could have a preview before submitting
(and also given the option to have it as a compulsory field with proper error checking etc.)
Mr Chad
05-14-2006, 05:19 PM
Is this working for any of you?
For me it acts like the avatar was added but the image doesnt exist. (So it never uploaded it)
Mr Chad
05-14-2006, 05:41 PM
Does this hack depend on the regimagecheck?
(I placed the template edit above that if so it could bypass that)
Chroder
05-14-2006, 09:57 PM
chatbum, the plugin doesn't have anything to do with the regimagecheck.
What happens if you upload the same avatar via the same method using the Edit Avatar page? And what do you mean it "acts like the avatar was added"?
Mr Chad
05-15-2006, 01:08 AM
By saying it acts like the avatar was added, it displays a broken image (image that doesnt exist). So it seems a avatar link was added in the database but the file was never added in the avatar directory.
Oh and it works when i manually do it through the usercp
Chroder
05-15-2006, 01:23 AM
Yes you're right. There seems to be an error with storing avatars in the filesystem. I'll look into it now and see about an update :)
Chroder
05-15-2006, 01:42 AM
Okay, it seems to work now. Give it a try :D
Mr Chad
05-15-2006, 01:07 PM
Thanks man, working and being used on BeastToast.com :)
Very nice hack. Thank you!
futuredood
06-28-2006, 12:58 PM
hmm i can't seem to get this to work, i did follow those exact instructions. is their any way you can implement in the part where they can select a pre-uploaded avatar? this way, we make sure they have one, plus they can always change it later.
Tralala
02-16-2007, 11:57 AM
Does this work in 3.6.4? I'd love it.
Tralala
04-22-2007, 10:44 PM
Does this work in 3.6.4? I'd love it.
Answering my own question; I just tried it and it does not work, at least not on 3.6.5.
Would love to see an update as I would very much appreciate this on my forum.
JoeIsuzu239
08-14-2007, 10:31 PM
This looks like exactly what I need. However, it doesn't seem to work with 3.6.7 PL1. Does anyone know how to tweak it to work with the newer versions of the software?
this work with 3.7 beta 4?
This does not work correctly on vb 3.7 pl1. You can only specify a remote hosted avatar, but you cannot upload from your computer.
I have installed the product and added the following code to register template:
<if condition="$show[avatar_form]">
<fieldset class="fieldset">
<legend>$vbphrase[custom_avatar]</legend>
<div style="padding:$stylevar[formspacer]px">
<div class="fieldset">
<if condition="$vboptions[regava_show_url]">
$vbphrase[enter_url_to_image]
<div style="padding:$stylevar[formspacer]px">
<input type="text" class="bginput" name="avatarurl" value="http://www." onchange="check_yes('avatar_yes')" size="45" dir="ltr" />
<input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach" />
</div>
</if>
<if condition="$vboptions[regava_show_upload]">$vbphrase[upload_image_from_computer]</if>
<div style="padding:$stylevar[formspacer]px">
<input type="file" class="bginput" name="upload" onchange="check_yes('avatar_yes')" size="45" />
</div>
<if condition="$show['maxnote']">
$maxnote
</if>
</fieldset>
</if>
Can anyone please help me get this fixed?
Adult SEO
10-21-2008, 09:51 AM
You may try adding this to the registration form in 3.7 for it to work:
ENCTYPE="multipart/form-data"
You may try adding this to the registration form in 3.7 for it to work:
ENCTYPE="multipart/form-data"
Unfortunately this did not help. The changed part looks like this now:
<form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm);" ENCTYPE="multipart/form-data">
Any other ideas?
Adult SEO
10-27-2008, 07:53 AM
Did you install the latest version? For me it works on 3.7.1.
Yes, I have installed 3.7.3 pl1.
Have you changed anything in the product? Do you mind posting your registration template?
Since I was testing on a customized style, I just checked the problem on the default style. Although I have already applied some mods, the register template has been untouched.
I added the code I posted two weeks ago to the template and also tried the original from the install instructions. The template does not have the regimage conditional any more. It is called $human_verify now. I have added the code above that variable and also put the code you suggested to the form.
My modified default template with original mod code looks like this:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions - <if condition="$show['coppa']">$vbphrase[coppa] </if>$vbphrase[registration]</title>
</head>
<body>
$header
<br />
<if condition="$show['coppa']">
<div>$vbphrase[until_receive_signed_form]</div>
</if>
<if condition="$show['errors']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">$vbphrase[errors_occurred_during_registration]</td>
</tr>
<tr>
<td class="alt1"><ul>$errorlist</ul></td>
</tr>
</table>
<br />
</if>
<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script>
<script type="text/javascript">
function verify_passwords(password1, password2)
{
// do various checks, this will save people noticing mistakes on next page
if (password1.value == '' || password2.value == '')
{
alert('$vbphrase[fill_out_both_password_fields]');
return false;
}
else if (password1.value != password2.value)
{
alert('$vbphrase[entered_passwords_do_not_match]');
return false;
}
else
{
<if condition="$show['coppa']">
pass_copy = password1.value;
passconfirm_copy = password2.value;
</if>
var junk_output;
md5hash(password1, document.forms.register.password_md5, junk_output, $show[nopasswordempty]);
md5hash(password2, document.forms.register.passwordconfirm_md5, junk_output, $show[nopasswordempty]);
<if condition="$show['coppa']">
document.forms.register.password.value = pass_copy;
document.forms.register.passwordconfirm.value = passconfirm_copy;
</if>
return true;
}
return false;
}
</script>
<form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm);" [B]ENCTYPE="multipart/form-data">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="addmember" />
<input type="hidden" name="url" value="$url" />
<input type="hidden" name="agree" value="$agree" />
<input type="hidden" name="password_md5" />
<input type="hidden" name="passwordconfirm_md5" />
<if condition="!$show['birthday']">
<input type="hidden" name="day" value="$day" />
<input type="hidden" name="month" value="$month" />
<input type="hidden" name="year" value="$year" />
</if>
<if condition="$show['coppa']">
<input type="hidden" name="coppauser" value="1" />
</if>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat"><phrase 1="$vboptions">$vbphrase[register_at_x]</phrase></td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:$stylevar[formwidth]" align="$stylevar[left]">
<div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
<phrase 1="$vboptions[bbtitle]">$vbphrase[to_post_must_first_register]</phrase>
</div>
<div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
<strong>$vbphrase[username]</strong>:<br />
<input type="text" class="bginput" name="username" size="50" maxlength="$vboptions[maxuserlength]" value="$username" />
</div>
<fieldset class="fieldset">
<legend>$vbphrase[password]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="400">
<tr>
<td colspan="2">$vbphrase[enter_password_for_account]</td>
</tr>
<tr>
<td>
$vbphrase[password]:<br />
<input type="password" class="bginput" name="password" size="25" maxlength="50" value="$password" />
</td>
<td>
$vbphrase[confirm_password]:<br />
<input type="password" class="bginput" name="passwordconfirm" size="25" maxlength="50" value="$passwordconfirm" />
</td>
</tr>
</table>
</fieldset>
<fieldset class="fieldset">
<legend>$vbphrase[email_address]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="400">
<tr>
<td colspan="2">$vbphrase[enter_valid_email_address]</td>
</tr>
<tr>
<td>
$vbphrase[email_address]:<br />
<input type="text" class="bginput" name="email" size="25" maxlength="50" value="$email" dir="ltr" />
</td>
<td>
$vbphrase[confirm_email_address]:<br />
<input type="text" class="bginput" name="emailconfirm" size="25" maxlength="50" value="$emailconfirm" dir="ltr" />
</td>
</tr>
<if condition="$show['coppa']">
<tr>
<td>$vbphrase[if_under_13_provide_parent]</td>
</tr>
<tr>
<td>
$vbphrase[parent_guardian_email]:<br />
<input type="text" class="bginput" name="parentemail" size="25" maxlength="50" value="$parentemail" dir="ltr" />
</td>
</tr>
</if>
</table>
</fieldset>
[B]<if condition="$show[avatar_form]">
<fieldset class="fieldset">
<legend>$vbphrase[regava_custom_avatar]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td>
$vbphrase[regava_upload_custom_avatar]
<if condition="$vboptions[regava_show_url]">$vbphrase[regava_enterurl]</if>
<if condition="$vboptions[regava_show_upload]">$vbphrase[regava_upload]</if>
</td>
</tr>
<if condition="$vboptions[regava_show_url]">
<tr>
<td>
$vbphrase[regava_enter_avatar_url]<br />
<input type="text" class="bginput" name="avatarurl" value="http://www." size="50" dir="ltr" />
</td>
</tr>
</if>
<if condition="$vboptions[regava_show_upload]">
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach" />
$vbphrase[regava_upload_avatar_from_computer]<br />
<input type="file" class="bginput" name="upload" size="50" />
</td>
</tr>
</if>
<if condition="$show['maxnote']">
<tr>
<td>$maxnote</td>
</tr>
</if>
</table>
</fieldset>
</if>
$human_verify
</div>
</div>
</td>
</tr>
</table>
<br />
<if condition="$show['customfields_profile']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="thead">$vbphrase[additional_required_information_profile]</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:$stylevar[formwidth]" align="$stylevar[left]">
$customfields_profile
<if condition="$show['birthday']">$birthdayfields</if>
</div>
</div>
</td>
</tr>
</table>
<br />
</if>
<if condition="$show['customfields_option']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="thead">$vbphrase[additional_required_information_option]</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:$stylevar[formwidth]" align="$stylevar[left]">
$customfields_option
</div>
</div>
</td>
</tr>
</table>
<br />
</if>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="thead">$vbphrase[additional_information]</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:$stylevar[formwidth]" align="$stylevar[left]">
<if condition="$show['referrer']">
<fieldset class="fieldset">
<legend>$vbphrase[referrer]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td><phrase 1="$vboptions[bbtitle]">$vbphrase[if_referred_enter_name]</phrase></td>
</tr>
<tr>
<td>
$vbphrase[referrer]:<br />
<div id="referrerfield"><input id="referrerfield_txt" type="text" class="bginput" name="referrername" value="$referrername" size="50" maxlength="$vboptions[maxuserlength]" /></div>
<if condition="$show['popups']">
<div id="referrerfield_menu" class="vbmenu_popup" style="display:none; z-index:50"></div>
<script type="text/javascript" src="clientscript/vbulletin_ajax_namesugg.js?v=$vboptions[simpleversion]"></script>
<script type="text/javascript">
<!--
vbmenu_register('referrerfield', true);
rnc = new vB_AJAX_NameSuggest('rnc', 'referrerfield_txt', 'referrerfield');
rnc.allow_multiple = false;
//-->
</script>
</if>
</td>
</tr>
</table>
</fieldset>
</if>
$timezoneoptions
<fieldset class="fieldset">
<legend>$vbphrase[receive_email]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td>
$vbphrase[administrators_may_send_email]
</td>
</tr>
<tr>
<td><label for="cb_adminemail"><input type="checkbox" name="options[adminemail]" value="1" id="cb_adminemail" $checkedoff[adminemail] />$vbphrase[receive_email_from_bulletin_board_staff]</label></td>
</tr>
<if condition="$show['email']">
<tr>
<td>$vbphrase[allow_members_send_you_email]</td>
</tr>
<tr>
<td><label for="cb_showemail"><input type="checkbox" name="options[showemail]" value="1" id="cb_showemail" $checkedoff[showemail] />$vbphrase[receive_email_from_other_members]</label></td>
</tr>
</if>
</table>
</fieldset>
$customfields_other
</div>
</div>
<div style="margin-top:$stylevar[cellpadding]px">
<input type="submit" class="button" value="$vbphrase[complete_registration]" accesskey="s" />
<input type="reset" class="button" name="Reset" value="$vbphrase[reset_fields]" />
</div>
</td>
</tr>
</table>
</form>
$footer
</body>
</html>
I also get this error on the registration form:
Could not find phrase 'note_maximum_size_x_y_or_z'.
Here is the code from the instructions:
<if condition="$show[avatar_form]">
<fieldset class="fieldset">
<legend>$vbphrase[regava_custom_avatar]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td>
$vbphrase[regava_upload_custom_avatar]
<if condition="$vboptions[regava_show_url]">$vbphrase[regava_enterurl]</if>
<if condition="$vboptions[regava_show_upload]">$vbphrase[regava_upload]</if>
</td>
</tr>
<if condition="$vboptions[regava_show_url]">
<tr>
<td>
$vbphrase[regava_enter_avatar_url]<br />
<input type="text" class="bginput" name="avatarurl" value="http://www." size="50" dir="ltr" />
</td>
</tr>
</if>
<if condition="$vboptions[regava_show_upload]">
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach" />
$vbphrase[regava_upload_avatar_from_computer]<br />
<input type="file" class="bginput" name="upload" size="50" />
</td>
</tr>
</if>
<if condition="$show['maxnote']">
<tr>
<td>$maxnote</td>
</tr>
</if>
</table>
</fieldset>
</if>
I checked this with different jpg pictures. All with bigger dimensions than the maximum avatar setting, but smaller than the maximum file size.
Adult SEO
10-27-2008, 10:51 AM
I meant the latest product ;) It may have been updated recently.
I checked the plugins, and they make use of the same avatar upload system as used in vB 3.7.1.
You mean the product from this thread, don't you? I just downloaded it again and it is the same file as I have installed. Therefore I think I have the latest product.
When you look at this thread people seem to have problems since version 3.65. I think that it is only a minor problem which keeps the product from working correctly, but non-coders are not able to see it.
You don' t seem to have changed the plugin. Since the install instructions are not correct any more, I assume that the problem lies here. Could you please post the code you added to register template and where you have placed it?
Adult SEO
10-27-2008, 02:43 PM
1.
The registration form:
<form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm);" ENCTYPE="multipart/form-data">
The upload box:
<if condition="$show[avatar_form]">
<fieldset class="fieldset">
<legend>$vbphrase[regava_custom_avatar]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td>
$vbphrase[regava_upload_custom_avatar]
<if condition="$vboptions[regava_show_url]">$vbphrase[regava_enterurl]</if>
<if condition="$vboptions[regava_show_upload]">$vbphrase[regava_upload]</if>
</td>
</tr>
<if condition="$vboptions[regava_show_url]">
<tr>
<td>
$vbphrase[regava_enter_avatar_url]<br />
<input type="text" class="bginput" name="avatarurl" value="http://www." size="50" dir="ltr" />
</td>
</tr>
</if>
<if condition="$vboptions[regava_show_upload]">
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach" />
$vbphrase[regava_upload_avatar_from_computer]<br />
<input type="file" class="bginput" name="upload" size="50" />
</td>
</tr>
</if>
</table>
</fieldset>
</if>
2.
Plugins:
register_addmember_process
// register_addmember_process
if($avatar_form)
{
$vbulletin->input->clean_array_gpc('p', array(
'avatarurl' => TYPE_STR,
));
$vbulletin->input->clean_gpc('f', 'upload', TYPE_FILE);
// begin custom avatar code
require_once(DIR . '/includes/class_upload.php');
require_once(DIR . '/includes/class_image.php');
$upload = new vB_Upload_Userpic($vbulletin);
$upload->data =& datamanager_init('Userpic_Avatar', $vbulletin, ERRTYPE_STANDARD, 'userpic');
$upload->image =& vB_Image::fetch_library($vbulletin);
$upload->maxwidth = $reg_perms['avatarmaxwidth'];
$upload->maxheight = $reg_perms['avatarmaxheight'];
$upload->maxuploadsize = $reg_perms['avatarmaxsize'];
$upload->allowanimation = ($reg_perms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar']) ? true : false;
}
register_form_complete
//register_form_complete
if($avatar_form)
{
$reg_perms['avatarmaxsize'] = vb_number_format($reg_perms['avatarmaxsize'], 1, true);
$maxnote = '';
if($reg_perms['avatarmaxsize'] AND ($reg_perms['avatarmaxwidth'] OR $reg_perms['avatarmaxheight']))
$maxnote = construct_phrase(fetch_phrase('note_maximum_size_x _y_or_z', 11), $reg_perms['avatarmaxwidth'], $reg_perms['avatarmaxheight'], $reg_perms['avatarmaxsize']);
else if ($reg_perms['avatarmaxsize'])
$maxnote = construct_phrase(fetch_phrase('note_maximum_size_x ', 11), $reg_perms['avatarmaxsize']);
else if ($reg_perms['avatarmaxwidth'] OR $reg_perms['avatarmaxheight'])
$maxnote = construct_phrase(fetch_phrase('note_maximum_size_x _y_pixels', 11), $reg_perms['avatarmaxwidth'], $reg_perms['avatarmaxheight']);
$show['maxnote'] = (!empty($maxnote)) ? true : false;
}
register_start
//register_start
// Get registered usergroup perms
$reg_perms =& $vbulletin->usergroupcache[2];
$ava_max_height = $reg_perms['avatarmaxheight'];
$ava_max_width = $reg_perms['avatarmaxwidth'];
$ava_max_size = $reg_perms['avatarmaxsize'];
$ava_can_use = $reg_perms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'];
$ava_can_anim = $reg_perms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar'];
if(
($vbulletin->options['regava_show_url'] || $vbulletin->options['regava_show_upload']) &&
$vbulletin->options['avatarenabled'] && $ava_can_use
)
{
$avatar_form = true;
$show['avatar_form'] = true;
}
register_addmember_complete
// register_addmember_complete
if($avatar_form && isset($upload))
{
// Need up to date info
$newuserinfo = fetch_userinfo($vbulletin->userinfo['userid'], 16);
$vbulletin->userinfo = $newuserinfo;
if(!$upload->process_upload($vbulletin->GPC['avatarurl']))
$ava_failed = true;
eval(standard_error($upload->fetch_error()));
}
Adult SEO
10-27-2008, 02:47 PM
btw, i did work on the code and wanted to rewrite it, but then I noticed that the registration form did not have the right encoding so I believe I just reinstalled the original product and then it worked.
I also changed the register_addmember_process plugin a bit, but I believe those changes were in the end the same as it was.
Ok, it is working now! Thank you very much! It was really nice of you to spend so much time on this issue!
I think in the end you only have to add ENCTYPE="multipart/form-data". I am not sure about the effect of reinstalling the product. I think this is part of the solution, too, but I don' t know what kind of difference that makes and I also had an imagemagick problem.
This mod did not work for you on first install as well, did it?
After reading your last post I have reinstalled the plugin, but the avatar still has not been uploaded. I then replaced everything with your code. This was the first time I could see an impact. Instead of just promping a success without uploading the avatar, it said "invalid file". Soon I noticed that the standard avatar feature did not work, too. The reason was a misconfigured imagemagick path. After correction everything worked perfectly, besides that instead of the success message I received a blank box.
Therefore I reinstalled the original mod again. Now everything works perfect. Not quite, there are two more issues left.
1. I still don' t know why I get Could not find phrase 'note_maximum_size_x_y_or_z'. error. The phrase manager displays it as User Tools (global) and the phrase works perfect in the user control panel. It is also referenced in register.php ($phrasegroups = array('timezone', 'user', 'register', 'cprofilefield');).
You have not used the $maxnote variable in your html form code. Did you have the same problem or did you just think that it was not necessary? If I don' t get it to work, I will delete it from the form, too. Avatars are resized anyway, so that this information is a little bit misleading.
2. Then there is one more goal I like to achieve - making the avatar mandatory. I tried adding code to the check for missing fields section of register.php, but I was not able to submit the form. I added 'upload' => TYPE_FILE, to clean_array_gpc and OR empty($vbulletin->GPC['upload']) to the if clause.
I also thought about adding code to the javascript verify_passwords function. This would be not as good as php validation, but still better than no validation at all. Unfortunately I have never dealt with javascript and the variables used in vbulletin look so much different than the ones used in code examples on other sites.
If anyone knows how to change the files in order to make avatars mandatory, please reply.
Edit:
The reason for the first problem is that the language variable calls have been changed. The register_form_complete plugin should look like this:
//register_form_complete
if($avatar_form)
{
$reg_perms['avatarmaxsize'] = vb_number_format($reg_perms['avatarmaxsize'], 1, true);
$maxnote = '';
if($reg_perms['avatarmaxsize'] AND ($reg_perms['avatarmaxwidth'] OR $reg_perms['avatarmaxheight']))
{
$maxnote = construct_phrase($vbphrase['note_maximum_size_x_y_or_z'], $reg_perms['avatarmaxwidth'], $reg_perms['avatarmaxheight'], $reg_perms['avatarmaxsize']);
}
else if ($reg_perms['avatarmaxsize'])
{
$maxnote = construct_phrase($vbphrase['note_maximum_size_x'], $reg_perms['avatarmaxsize']);
}
else if ($reg_perms['avatarmaxwidth'] OR $reg_perms['avatarmaxheight'])
{
$maxnote = construct_phrase($vbphrase['note_maximum_size_x_y_pixels'], $reg_perms['avatarmaxwidth'], $reg_perms['avatarmaxheight']);
}
$show['maxnote'] = (!empty($maxnote)) ? true : false;
}
superthang
02-18-2009, 07:48 PM
does this work on the latest 3.8.x ?
Dr.Customs
12-03-2009, 12:59 AM
can anyone help i cant get this to work on 384
RaceMediaGroup
01-30-2011, 08:38 PM
will there be an update for vB4?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.