Forum Replies Created
-
Hi folks sorry, coming back to this after a while.
I submitted my findings/questions to bp trac. They say that avatar upload during registration is going to be discontinued in bp 1.5 default theme. So, it may be a good idea to think about doing avatars after registration.
Personally, I can see their thinking.
1) Why let people who aren’t yet committed users get access to your file system?
2) registration is really complicated by the fact that you don’t yet know the user’s user id.Still, I may be looking at this some more …
Tried some more tests. The pattern I seem to be seeing for repeated uploads during the registration process is that when a user replaces their avatar, the change is displayed a few times. After 2 or 3 it stops displaying new ones added. Not sure if this is a feature or bug or has to do with the order in which the avatars are listed in the registrations temporary avatar directory.
Me again.
I would like to edit the above posts, but this forum is not allowing me to do so. Clicking “Edit” gets me to “page not found.”
Anyway. I take back that it’s necessary to add a hidden field.
I think the change that is needed is
the last line in the function
bp_get_signup_avatar_dir_value()
in bp-core-templatetags.phpchange
return apply_filters( ‘bp_get_signup_avatar_dir_value’, $bp->signup->avatar_dir );
to
return apply_filters( ‘bp_get_signup_avatar_dir_value’, $signup_avatar_dir );However, I note that if the registrant uploads more than one avatar (i.e. replaces their avatar) during the registration process the avatar displayed will be the first one uploaded.
Look at the function bp_core_fetch_avatar() in bp-core-avatars.php
This is called in the function bp_get_signup_avatar in bp-core-templatetags.php.
The problem is that if the user uploads more than one avatar the old ones are not deleted.
bp_core_fetch_avatar() seems to get the first on uploaded and this is the one that is displayed when the register.php template runs even if newer avatars have been uploaded during the registration process.
Another relevant files is
bp-core/bp-core-signup.php
Looking at it, I am not sure my solution would be the final correct one. So far it’s working, but some of the functions in bp-core-signup seem like they would have an impact.
Hi folks
I think I may have found a solution, at least to how I was experiencing it.
I am using wp 3.2.1. and BP 1.2.9 with a bp-default child theme
FIRST the default gravatar image was not showing at all in firefox. I don’t use gravatars on my site and filter them out all together. I applied a filter to
bp_get_signup_avatar
to replace the gravatar.com image with a link to mysteryman directly on my site.SECOND
I think the function
bp_get_signup_avatar_dir_value() in bp-core-templatetags.php
has a bug.
The last line applies the filter.
Code:return apply_filters( ‘bp_get_signup_avatar_dir_value’, $bp->signup->avatar_dir );However, when the user signups up or uploads an avatar $bp->signup->avatar_dir seems to be empty.
There are a few if then else statements that work with $signup_avatar_dir so this seems to be the relevant value to pass along. I changed the last line in the function code to
Code:return apply_filters( ‘bp_get_signup_avatar_dir_value’, $signup_avatar_dir );THIRD
I found that register.php in the theme is lacking a hidden field for the signup avatar directory
The relevant section is: (REF section A)
Code:<h4><?php _e( ‘Your Current Avatar’, ‘buddypress’ ) ?></h4>
<p><?php _e( "We’ve fetched an avatar for your new account. If you’d like to change this, why not upload a new one?", ‘buddypress’ ) ?></p><div id="signup-avatar">
<?php bp_signup_avatar() ?>
</div><p>
<input type="file" name="file" id="file" />
<input type="submit" name="upload" id="upload" value="<?php _e( ‘Upload Image’, ‘buddypress’ ) ?>" />
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
<input type="hidden" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" />
<input type="hidden" name="signup_username" id="signup_username" value="<?php bp_signup_username_value() ?>" />
</p><?php wp_nonce_field( ‘bp_avatar_upload’ ) ?>
You’ll notice that the section just below this that handles what the user sees when cropping has an additional hidden field.
Code:<input type="hidden" name="signup_avatar_dir" id="signup_avatar_dir" value="<?php bp_signup_avatar_dir_value() ?>" />I inserted this in the (Section A) that the user sees before and after cropping