Actions

API16

JHtmlList/users

From Joomla! Documentation

< API16:JHtmlList
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Select list of active users

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

static users($name, $active, $nouser=0, $javascript=NULL, $order= 'name', $reg=1)
Parameter Name Default Value Description
$name
$active
$nouser 0
$javascript NULL
$order 'name'
$reg 1

Defined in

libraries/joomla/html/html/list.php

Importing

jimport( 'joomla.html.html.list' );

Source Body

public static function users($name, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1)
{
        $db = &JFactory::getDbo();
 
        $and = '';
        if ($reg) {
        // does not include registered users in the list
                $and = ' AND m.group_id != 2';
        }
 
        $query = 'SELECT u.id AS value, u.name AS text'
        . ' FROM #__users AS u'
        . ' JOIN #__user_usergroup_map AS m ON m.user_id = u.id'
        . ' WHERE u.block = 0'
        . $and
        . ' ORDER BY '. $order
        ;
        $db->setQuery($query);
        if ($nouser) {
                $users[] = JHtml::_('select.option',  '0', '- '. JText::_('No_User') .' -');
                $users = array_merge($users, $db->loadObjectList());
        } else {
                $users = $db->loadObjectList();
        }
 
        $users = JHtml::_(
                'select.genericlist',
                $users,
                $name,
                array('list.attr' => 'class="inputbox" size="1" '. $javascript, 'list.select' => $active)
        );
        return $users;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />