function getUserDisplayName($user_id) { $user = Contacts::findById($user_id); if ($user) { return $user->getDisplayName(); } else { $log = ApplicationLogs::findOne(array('conditions' => "`rel_object_id` = '{$user_id}' AND `action` = 'add'")); if ($log) { return $log->getObjectName(); } else { return lang('n/a'); } } }