Actions

API15

JHTMLList/users

From Joomla! Documentation

< API15: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

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

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 gid > 18';
        }
 
        $query = 'SELECT id AS value, name AS text'
        . ' FROM #__users'
        . ' WHERE 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, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active );
 
        return $users;
}

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

Examples

<CodeExamplesForm />