Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
Slovak CreditAttribution: Slovak commentedIn 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.
Comment #2
Scyther CreditAttribution: Scyther commentedThis patch solves the problem.
Comment #3
Scyther CreditAttribution: Scyther commentedSee this #1086254: WSOD when user picture preset assigned
Comment #4
WorldFallz CreditAttribution: WorldFallz commentedNot 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.
Comment #5
WorldFallz CreditAttribution: WorldFallz commentedoops... attached wrong file (previous patch doesn't add the base file system path).
Comment #6
Scyther CreditAttribution: Scyther commentedThis 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.
Comment #7
MichelleJust 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
Comment #8
WorldFallz CreditAttribution: WorldFallz commented@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.
Comment #9
MichelleWell, 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
Comment #10
WorldFallz CreditAttribution: WorldFallz commentedAnd 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.
Comment #11
WorldFallz CreditAttribution: WorldFallz commentedOk, 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.
Comment #12
BeaPower CreditAttribution: BeaPower commentedDoes this work for anyone else?
Comment #13
wooody CreditAttribution: wooody commentedThanks , works with me.
Comment #14
rogical CreditAttribution: rogical commented#11 patch is not showing the correct default user avatar, as the the default user avatar doesn't have style images.
Comment #15
Scyther CreditAttribution: Scyther commentedIt should style the default avatar. How did you write the path to your default avatar? Do you have public:// or private:// included?
Comment #16
rogical CreditAttribution: rogical commentedit'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.
Comment #17
Michelle#15 is important. If you include those, imagecache (or whatever it's called in D7) gets confuseled and default avis don't work.
Michelle
Comment #18
blogook CreditAttribution: blogook commentedexactly 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.
Comment #19
zuzu83 CreditAttribution: zuzu83 commentedHi
Same probleme #18, and #11 resolve probleme with me
Comment #20
RobLoachInstead of sticking this logic in the template system, we should have it in the preprocess function.
Comment #21
Scyther CreditAttribution: Scyther commented@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!