CoreFiles by mySites.guru
user.php39 lines, 727 bytes, from Joomla_5.0.2-Stable-Full_Package.zip
Raw History Compare with 5.0.1
md5
0dc18c23f9829bdbeeac8095c9f766e5
sha1
3d5038b9887851898d985c11a0fb3186b81a3ad8
sha256
a8928e528c0c0de12ac275a09f4d3428a68aa86c531dd13ada4068e96c55dff6
<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.User
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

$value = $field->value;

if ($value == '') {
    return;
}

$value = (array) $value;
$texts = [];

foreach ($value as $userId) {
    if (!$userId) {
        continue;
    }

    $user = $this->getUserFactory()->loadUserById($userId);

    if ($user) {
        // Use the Username
        $texts[] = $user->name;
        continue;
    }

    // Fallback and add the User ID if we get no JUser Object
    $texts[] = $userId;
}

echo htmlentities(implode(', ', $texts));

The same content is in 37 releases, Joomla 5.0.0-alpha2 to 5.1.4. See them all, or every version of this file.