?
avatar C-Lodder
C-Lodder
25 Aug 2016

Steps to reproduce the issue

  • Create a new user
  • Create an article and set the Author as the newly created user
  • Delete the user
  • Open the Article in the Article Manager

Expected result

I would suggest displaying a more meaningful message, such as:

The author of this article no longer exist.

Or something along those lines. @brianteeman perhaps you could come up with a better warning message

Actual result

JUser: :_load: Unable to load user with ID: 371

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar C-Lodder C-Lodder - open - 25 Aug 2016
avatar C-Lodder C-Lodder - edited - 25 Aug 2016
avatar brianteeman
brianteeman - comment - 25 Aug 2016

How about

"The author of this article is no longer a user on this site"

But also please check if it is just the created user that generates this
error - perhaps the modified user does as well - I dont remember

avatar brianteeman brianteeman - change - 25 Aug 2016
Category Administration UI/UX
avatar brianteeman brianteeman - change - 25 Aug 2016
Status New Confirmed
avatar brianteeman brianteeman - edited - 25 Aug 2016
avatar C-Lodder
C-Lodder - comment - 25 Aug 2016

Not really sure how to approach this. The message is coming from here:

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/user/user.php#L869

Only thing I can think of is using JInput and a conditional statement:

$input = JFactory::getApplication()->input;

if ($input->get('layout') == 'edit')
{
    JLog::add(JText::_('The author of this article is no longer a user on this site'), JLog::WARNING, 'jerror');
}
else
{
    JLog::add(JText::sprintf('JLIB_USER_ERROR_UNABLE_TO_LOAD_USER', $id), JLog::WARNING, 'jerror');
}

which I'm not sure is the best method.

@mbabker - any thoughts on how to approach this?

avatar mbabker
mbabker - comment - 25 Aug 2016

I would not be putting component specific stuff in JUser for starters. This is why arbitrarily logging things with the "jerror" category isn't a good mechanism of error handling. It'd be better if it threw an Exception but that apparently has B/C implications. So the only way around that would be to stop logging to the "jerror" category and force downstream uses of JUser::load() to check for boolean false conditions and implement their own error handling mechanisms at a lower level (to include rendering a "friendly" message).

As vague as it is, the error message generated at the spot it is now is correct and even if it were throwing an Exception I wouldn't change it. Annoying because it's vague and generally not friendly, but this is a case of an error being rendered where it shouldn't be and it does actually state what the error condition is (can't load a user with the given ID) but it's not really pertinent to every site visitor.

avatar C-Lodder
C-Lodder - comment - 25 Aug 2016

Ok thanks @mbabker . Closing

avatar C-Lodder C-Lodder - change - 25 Aug 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-08-25 12:51:11
Closed_By C-Lodder
avatar C-Lodder C-Lodder - close - 25 Aug 2016
avatar brianteeman brianteeman - close - 25 Aug 2016
avatar brianteeman brianteeman - change - 5 Sep 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment