XF 2.2 Call to a member function getBannerUrl() on null

TheCarlwood

Member
I'm getting this error on my forum:

#0 [internal function]: XF\Template\Templater->fnProfileBanner(Object(ThemeHouse\UIX\XF\Template\Templater), false, Object(XFMG\XF\Entity\User), 'l', false, Array, '
<div clas...')
#1 src/XF/Template/Templater.php(1103): call_user_func_array(Array, Array)
#2 internal_data/code_cache/templates/l1/s4/public/member_view.php(220): XF\Template\Templater->func('profile_banner', Array)
#3 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, NULL)
#4 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('member_view', Array)
#5 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#6 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Member\\View', 'public:member_v...', Array)
#7 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}


I believe I've found the cause of it as well. I just upgraded from XF1 to XF2, and I checked the user and the user_profile tables... for some reason, the IDs in the user_profile tables got messed up along the way. The row count is the same so no data is missing. It goes from 1 -> 6286 and counts incrementally, when before it was 1 -> 5... not sure why the next user id is 5 but it is a lot more reasonable and there isn't a 6000 id gap in sight. Not every profile is broken but this is filling up my error logs. I can't even edit these users within the admin panel and I'm not really sure how to fix it. I've found the relevant template section and looked within the cache file that it ultimately leads to, but this seems like something went a little wrong during the upgrade possibly. I don't see a tool to validate the database within the admin panel to check this.

Any ideas?
 
The normal upgrade process does not touch any of the database IDs in this way.

So either it wasn’t a normal upgrade or some other database manipulation or corruption occurred perhaps if the database was duplicated or restored from a backup or similar.

Our only advice at this point would be to restore a backup prior to the upgrade and try again.
 
Try on a unmodified default style with all addons disabled.
That would not explain why nothing appears when I try to edit the user in the ACP, so it is beyond a style issue. I can edit other users just fine.

The normal upgrade process does not touch any of the database IDs in this way.

So either it wasn’t a normal upgrade or some other database manipulation or corruption occurred perhaps if the database was duplicated or restored from a backup or similar.

Our only advice at this point would be to restore a backup prior to the upgrade and try again.
I just checked with the old database and it appears I was wrong as the IDs are the same there, so that was a wrong guess on my part.
 
I just checked with the old database and it appears I was wrong as the IDs are the same there, so that was a wrong guess on my part.
That's good news.

I believe you might be running into an issue that may have been caused, perhaps, by an old import. Particularly if you imported from a forum we don't natively support. Is that possible?

This may be fixable if you run the following queries against your XF database:

SQL:
INSERT IGNORE INTO xf_user_option (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_privacy (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_profile (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_authenticate (user_id) SELECT user_id FROM xf_user;

Let us know if that solves the problem for the existing users that are affected.
 
Unsure if this forum was imported from another as I've recently began working on the XF1 -> XF2 update, not sure of its full history unfortunately.

The affected profiles are now loading and I can edit them in the admin panel. Haven't gotten any errors logged in the past couple minutes. Thank you Chris! If I see any more errors from this issue I'll be sure to post in this thread again but it looks to be solved.
 
Top Bottom