I have a Joomla 1.6 installation that operates on two databases: joomla’s database and domain-specific database, both on the same MySQL server. Some entities in the domain-specific database keeps their ownership links, i.e. stores user_id of Joomla user that created it. Some of the links are inconsistent and points to non-existent Joomla user, it is normal from domain model point of view. The problem is when I try to get user name it shows
JUser::_load:Unable to load user with id 1
Since it is OK to have such links, I need to suppress this messages. The exact code that retrieves user name is just the following:
$user_id = $ticket->getUserId();
$user =& JFactory::getUser($user_id);
Wrappig this code into ob_start() ... ob_end_clean() does not help.
Of course I could do it by hacking Joomla’s internals, but is there any cleaner solution? I’m new to Joomla, so maybe there is some option in admin panel to suppress those messages?
UPDATE: Setting display_errors=>off, html_errors=>off, display_startup_errors=>off noes not help. Using PHP error suppression with @ as $user =@ JFactory::getUser($user_id) does not help too.
Why don’t you simply do pre-check if the user exists and then run your code: