In my site, I have a made a default user picture , so that every user has a default pic. But, this pic is not seen in activity stream.
But, if the user has uploaded his own pic, it is visible.
Please check it.
Thanks! :)

Comments

Stalski’s picture

Do you have time please to check how we can solve this? I don't have much spare time lately.
Thx in advance.

nikkubhai’s picture

I will surely try to help. :)

dave reid’s picture

If this is using the token [user:picture] then it can be fixed in Token.module with #1268238: The [user:picture] token does not fallback to the default picture.

Stalski’s picture

Indeed, Great.

dave reid’s picture

Status: Active » Closed (duplicate)
BeaPower’s picture

That fix doesnt seem to work..

cwithout’s picture

Status: Closed (duplicate) » Active

That issue actually seems unrelated. I might be missing it, but I don't see anywhere the Heartbeat streams use Tokens.

If it is, this still doesn't seem like the same thing. There are places like using views with any style other than "Default" where there is no default fallback image.

But with the heartbeat activity streams, it's actually outputting an incorrect URL. It's aware of the default image path but for some reason it appends it to the path for the activity_avatar styles. I have my default user image set to /sites/default/files/pictures/default.png and the user image in the activity stream is output as /sites/default/files/styles/activity_avatar/public//sites/default/files/pictures/default.png.

I can't debug it right now, because I have a deadline for tomorrow. But if you're not seeing the default image, check the source HTML. If there's an image path, you can work around it until there's a fix by uploading a copy of your default image to the path that is actually being output.

Stalski’s picture

Status: Active » Fixed
StatusFileSize
new333.87 KB

The avatars are shown nicely and it falls back to the user picture in the heartbeat activity messages. The comment user pictures are not though, but I just fixed that one too to fallback to default user picture.

The screenshot will demonstrate what I mean.

nikkubhai’s picture

Great. Thanks!

cwithout’s picture

StatusFileSize
new1.28 KB

After some debugging, here's the what's happening. For the default user picture to work with core User module (photo on the user page, etc) AND Heartbeat, you have to enter a URI such as public://pictures/default.png, because Heartbeat relies on theme_image_style()

However, core doesn't require that the picture be within the Drupal files directory.

A URL such as /any_directory/pictures/default.png does not work with Heartbeat though it works for core. The core user module also lets you use external images like http://www.someothersite.com/default.png, which Heartbeat doesn't. (Side note, pictures/default.png works for Heartbeat, but not for core -- which is probably by design.)

The attached patch brings the user picture rendering in line with how core renders the user pictures. The same could be done where the pictures are rendered on the comments.

(I also noticed the pictures have no alt tag. Technically, they should, since that's a required attribute for img tags, but that's I separate issue. If you want to match what core is doing, you can use alt and title attributes with something like $alt = t("@user's picture", array('@user' => format_username($variables['heartbeatactivity']->actor))); )

BeaPower’s picture

Status: Fixed » Needs review

just downloaded the recent dev and all is well now...

Stalski’s picture

Status: Needs review » Needs work

I like the proposition very much since I would like to go core on this one. But it the added function " file_valid_uri" ruins everything.
If I use that, it always checks false, leaving me with a default user picture which is much too big. The default core avatar works then and looks exactly the same.
I am investigating this further but for now.

Stalski’s picture

Status: Needs work » Fixed

Ok, indeed you need to use public://pictures/default.png , as core only used the image style when written like that.
If not, it will still find the file, but not rendered by image_style. So I can live with that.
It now works properly for comments and activity messages.
I added alt and title as well

Pushed to git. Thx for the patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

wormz30’s picture

Status: Closed (fixed) » Active

I dunno about you guys, but this still isn't working for me. I checked the patch and it predates the one module that is out now. Anyone with any ideas? I also tried patching it manually with the code that's been provided, but still no luck. :(

mohamadaliakbari’s picture

Also it can solved by this path: https://drupal.org/node/2047149#comment-7668303

Triumphent’s picture

Issue summary: View changes

Another way, is to use a view to display the stream. You can then add a user relationship and add the user picture field. :)

logicp’s picture

The issue with outputing fields in Views is that heartbeat_comments becomes unavailable