WordPress.org

Ready to get started?Download WordPress

Forums

Simple Local Avatars
Adding Upload option to BBPress 2.0 (5 posts)

  1. fadedpictures
    Member
    Posted 2 years ago #

    First of all, great plugin, thank you for developing it.

    I'm using the BBPress 2.0 plugin with a site I'm developing and wanted to add the Avatar upload field to the bottom of the BBPress profile edit page. It's much like the Theme My Login profile edit page.

    I've been able to pull the form field in using <?php do_action( 'bbp_user_edit_avatar', $profileuser ); ?>

    The action is one I added in my BBPress user edit template. In my functions file I've then hooked into the plugin using

    add_action( 'bbp_user_edit_avatar', array( 'simple_local_avatars', 'edit_user_profile' ) );

    This works great.

    After browsing for a local image then submitting the form the avatar isn't being saved. Wouldn't the

    add_action( 'personal_options_update', array( $this, 'edit_user_profile_update' ) );
    add_action( 'edit_user_profile_update', array( $this, 'edit_user_profile_update' ) );

    on lines 42 & 43 of simple-local-avatars.php take care of this on the updating of the profile page?

    Thanks for any help you can provide.

    http://wordpress.org/extend/plugins/simple-local-avatars/

  2. amax2222
    Member
    Posted 2 years ago #

    just wondering if you got anywhere this? I can also get the upload gravatar form but it does not update?

  3. eBarSolutions
    Member
    Posted 2 years ago #

    A portion of the update needs to be made to the following section of code where the simple_local_avatar upload file overrides the get_avatar image:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  4. circlecube
    Member
    Posted 2 years ago #

    @eBarSolutions-

    Hey, can you provide the code again? Looks like the friendly moderator killed it.

  5. Gaston
    Member
    Posted 1 year ago #

    I did this fix on simple-local-avatars.php 1.3.1 in the line 154 and works ok:

    <?php if (bbp_is_user_home_edit()) : ?>
    		<script type="text/javascript">var form = document.getElementById('bbp-user-edit-form');form.encoding = 'multipart/form-data';form.setAttribute('enctype', 'multipart/form-data');</script>
    	<?php else : ?>
    		<script type="text/javascript">var form = document.getElementById('your-profile');form.encoding = 'multipart/form-data';form.setAttribute('enctype', 'multipart/form-data');</script>
    	<?php endif; ?>

    Explanation:
    We need enctype="multipart/form-data" inb the bbpress user edit form 'bbp-user-edit-form'. Then, I ask if the form is bbpress user edit 'bbp_is_user_home_edit()', if yes, add the JS to include the enctype.

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic