Download & Extend

Notice: Trying to get property of non-object ...

Project:Author Pane
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I sporadically(?) receive the notice (often displayed twice) on a new (forum only) site.

Notice: Trying to get property of non-object in include() (line 25 of ...drupal-7.4/sites/all/modules/author_pane/author-pane-user-picture.tpl.php).

Whereas, there is mention of this notice in http://drupal.org/node/1086254, I thought I would create a new issue as this does not lead to WSOD and I have not noted any issues beyond the warning.

Comments

#1

In my instance, I am using a "User picture preset" option within advanced_forum settings. If a user profile is configured to use a default picture and the user hasn't uploaded one, AP appears to look for a non-existent image style and displays a broken image.

#2

Status:active» needs review

This patch solves the problem.

AttachmentSize
notice_trying_to_get_property_of_non_object-1217780-2.patch 814 bytes

#3

Status:needs review» closed (duplicate)

See this #1086254: WSOD when user picture preset assigned

#4

Status:closed (duplicate)» reviewed & tested by the community

Not sure why you closed this issue-- the non-object error is still present in the dev and it's not clear to me what it has to do with the other issue.

Here's a reroll for the current dev.

AttachmentSize
author_pane_property-of-nonobject-fix_1217780_4.patch 902 bytes

#5

oops... attached wrong file (previous patch doesn't add the base file system path).

AttachmentSize
author_pane_property-of-nonobject-fix_1217780_5.patch 947 bytes

#6

Status:reviewed & tested by the community» active

This issue here causes the other issue that is linked. So I decided to set this to duplicate.

Please do not set status to RTBC you own patches. It is not up to you to set that status.

I have not tested your patch, but what I can see already is that you have: <? variable_get('file_public_path', '') ?> So what if the site is using private filesystem? I think it would not work then.

I appreciate that you submit a patch for this issue, but I have a solution done already but I have not applied it yet. It will come in a few days.

Would have set this status to needs work, but I set it to active because I have the problem already solved, as I wrote.

#7

Just as an FYI, WorldFallz isn't some noob... Maybe I'm being an oversensitive busy body but she's done so much for the community and that just seemed a bit harsh... :)

Michelle

#8

@Scyther

It may be necessary for the other issue, but it's not sufficient-- so it's not a one to one. Either way it's a necessary patch to the current dev so it shouldn't be closed. I wasted over an hour tracking this down, after searching for an open issue, and only found it by accident after fixing it, creating a patch, and going to create a new issue. Had this been open I could have avoided wasting that time.

EDIT: oh and thanks for the lesson on RTBC -- i'm quite familiar with it. It was simply a click error ('needs review' is right next to RTBC).

@Michelle
Thanks for the kind words-- much appreciated. Frankly, if it hadn't been your module I'm not sure I would have even bothered. I'm getting quite sick and tired of the way this 'community' has been behaving lately. sheesh.

#9

Well, I'm not exactly a saint when it comes to responses in the issue queue... :) And I suppose that's probably hypocritical to step up when I see it aimed at someone I know. But that's just how it is sometimes, I guess...

Michelle

#10

Status:active» needs work

And the problem is not public or private-- user pictures are forced into a subdirectory of the files directory by the user settings so you can only have a private user picture if private files are set to a subdirectory of the files directory in which case 'file_public_path' will work fine in either case (i just tested to be sure).

The problem I only just noticed is the default picture can be a url-- then the patch doesn't work.

#11

Status:needs work» needs review

Ok, i've managed to fix it for my site. I'm not happy about using stripos to do it-- it's ugly, but it works.

Also note, that images outside of the drupal site can't be handled by theme_image_style, so if someone uses a large default image it doesn't get resized and can break the layout-- especially in a side bar. Not sure what you want to do about that. This patch just prints it anyway.

AttachmentSize
notice_trying_to_get_property_of_non_object-1217780-11.patch 1.17 KB

#12

Does this work for anyone else?

#13

Thanks , works with me.

#14

#11 patch is not showing the correct default user avatar, as the the default user avatar doesn't have style images.

aa

AttachmentSize
Screenshot at 2012-01-03 15:41:51.png 7.82 KB

#15

It should style the default avatar. How did you write the path to your default avatar? Do you have public:// or private:// included?

#16

it's public, I put the author pane to panels, it has option to choose image styles for avatar.

when no image style chooosed, all display fine, when choose one style, avatars using default would not able to show.

#17

#15 is important. If you include those, imagecache (or whatever it's called in D7) gets confuseled and default avis don't work.

Michelle

#18

Version:7.x-2.x-dev» 7.x-2.0-alpha2

exactly same problem here
Notice: Trying to get property of non-object in function include() (line 25 in file ../sites/all/modules/author_pane/author-pane-user-picture.tpl.php).

I only get this message in forum postings of users that did not upload a user picture.

#19

Hi

Same probleme #18, and #11 resolve probleme with me

#20

Version:7.x-2.0-alpha2» 7.x-2.x-dev
Status:needs review» needs work

Instead of sticking this logic in the template system, we should have it in the preprocess function.

#21

Status:needs work» fixed

@Rob Loach - yes the logic should not be in the tpl.php file, now it is in the preprocces function.

If anyone is missing some variables in the tpl file please open a new issue with feature request for those variables.

Rewriten author-pane-user-picture.tpl.php file and rewriten preprocess function for it. This should solve this problem!

#22

Status:fixed» closed (fixed)

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