Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5487 closed defect (bug) (no action required)

Ajax doesn't care of bp_core_fetch_avatar

Reported by: SGr33n Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

Hi :)

So, if you have a plugin that manipulates avatar via bp_core_fetch_avatar, everything is ok, of course, but if you post a new status, then ajax will show the new update without pass the avatar from bp_core_fetch_avatar, and it will display the default one.

Of course if you reload manually the page, the avatar will be the correct one (passed through bp_core_fetch_avatar).

Change History (9)

#1 @DJPaul
8 years ago

  • Keywords reporter-feedback added

Which plugin are you using that introduces this bug?

#2 @SGr33n
8 years ago

Sorry DjPaul, I didn't recive the email notification for the new reply.

The plugin is coded by me, is something like this:

	public function fb_avatar( $avatar, $id_or_email, $size, $default, 

		return '<img alt="' . esc_attr( $alt ) . '" src="https://graph.facebook.com/' . $fb_uid . '/picture" class="avatar avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
	}
add_filter( 'bp_core_fetch_avatar', array( $this, 'fb_avatar' ), 9, 4 );

It works pretty good, except for the ajax updates.

#3 @boonebgorges
8 years ago

Can you give more details about the page where the AJAX request is originating? This could possibly have something to do with the "displayed user" or something like that. The AJAX issues are happening on /activity/? Elsewhere as well? How about /members/yourname/activity/?

#4 @SGr33n
8 years ago

It's happening on every activity page.

I'm uploading a video :)

#6 @boonebgorges
8 years ago

Thanks for the additional info. The basic filter is working properly over AJAX in my tests.

My guess is that something is preventing your class, or your add_filter() call, from being called in time in the case of AJAX requests. For example, you might only be loading the class when ! is_admin(), but is_admin() will return true during an AJAX request. Likewise, some hooks (like 'wp_head') will not fire during AJAX requests, so if you're hooked to them, that's the source of the issue.

Maybe this'll point you in the right direction. If not, perhaps you can post more of your code - in particular, the code you're using to instantiate your class, along with the method that contains your add_filter() call - and we can help.

#7 @SGr33n
8 years ago

I called it if ( ! is_admin() ) so that's why it's not working. Thanks :)

Then I would ask you another question about a function I'm writing that I cannot make it work with BuddyPress enabled, can I? where to write you about it?

Last edited 8 years ago by SGr33n (previous) (diff)

#8 @boonebgorges
8 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

I called it if ( ! is_admin() ) so that's why it's not working. Thanks :)

Good guess on my part :)

Then I would ask you another question about a function I'm writing that I cannot make it work with BuddyPress enabled, can I? where to write you about it?

Your best bet is to post it to https://buddypress.org/support, and optionally you can ping me with @boonebgorges.

#9 @SGr33n
8 years ago

Ok, thanks :)

Note: See TracTickets for help on using tickets.