Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Specify Avatar on Registration Details »»
Specify Avatar on Registration
Version: 1.00, by Chroder Chroder is offline
Developer Last Online: May 2011 Show Printable Version Email this Page

Version: 3.5.4 Rating:
Released: 05-12-2006 Last Update: 05-14-2006 Installs: 24
Uses Plugins Template Edits
Is in Beta Stage  
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 10-27-2008, 12:56 PM
jerx jerx is offline
 
Join Date: Feb 2006
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #33  
Old 10-27-2008, 02:43 PM
Adult SEO's Avatar
Adult SEO Adult SEO is offline
 
Join Date: May 2006
Location: The Netherlands
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1.

The registration form:

HTML Code:
<form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm);" ENCTYPE="multipart/form-data">
The upload box:

HTML Code:
<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

PHP Code:
// 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'$vbulletinERRTYPE_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

PHP Code:
//register_form_complete
if($avatar_form)
{
    
$reg_perms['avatarmaxsize'] = vb_number_format($reg_perms['avatarmaxsize'], 1true);
    
    
$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

PHP Code:
//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

PHP Code:
// 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()));

Reply With Quote
  #34  
Old 10-27-2008, 02:47 PM
Adult SEO's Avatar
Adult SEO Adult SEO is offline
 
Join Date: May 2006
Location: The Netherlands
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #35  
Old 10-29-2008, 02:15 PM
jerx jerx is offline
 
Join Date: Feb 2006
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Code:
//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;
}
Reply With Quote
  #36  
Old 02-18-2009, 07:48 PM
superthang superthang is offline
 
Join Date: Aug 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does this work on the latest 3.8.x ?
Reply With Quote
  #37  
Old 12-03-2009, 12:59 AM
Dr.Customs Dr.Customs is offline
 
Join Date: Nov 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can anyone help i cant get this to work on 384
Reply With Quote
  #38  
Old 01-30-2011, 08:38 PM
RaceMediaGroup RaceMediaGroup is offline
 
Join Date: Jan 2011
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

will there be an update for vB4?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:56 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04952 seconds
  • Memory Usage 2,329KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (2)bbcode_html
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete