Fatal error: Call to a member function getAttribute() on a non-object
Permalink
When I go to Pages & Themes/Page Types/Defaults and select this template, I am getting the following error
And here is the offending code
The "Full Name" displays perfectly on the page and I only get this error when trying to set up page defaults?
Fatal error: Call to a member function getAttribute() on a non-object in F:\wamp\www\packages\my_theme\themes\my_theme\member.php on line 40
And here is the offending code
<?php $c = Page::getCurrentPage(); $uID = $c->getCollectionUserID(); $ui = UserInfo::getByID($uID); echo $ui->getAttribute('full_name'); ?>
The "Full Name" displays perfectly on the page and I only get this error when trying to set up page defaults?
Yes John, You are correct that is exactly what was happening,
Once again, Many Thanks for your help..
Dave
Once again, Many Thanks for your help..
Dave
Setting up such pages can often be made a lot easier by using Magic Data ;-)
Yes! I've noticed some issues with the core blog_post page type not showing the post owners name when not logged in as well. No matter though. I've completely set up my own "blog" page type using pure magic data!!
As usual John you solved my issue. Thanks.
The easiest fix is probably
That will prevent the dashboard / defaults problem, but allow it to function OK on a real page.