Buy Now
Sign in

dropdown with name(usersjoomla) of one group

ideagrup , April 09 2015
I
ideagrup
Dropdown with name(usersjoomla) of one group (53 sample)

Put Custom Code in Setup BEFORE html render_FORM

This code creates an array in $form->data under a model name 'users'

This array is posible read from dropdown

<?php
$options = array();
$db =& JFactory::getDBO();
$query = "
SELECT `u`.`id`,`u`.`name`,`g`.`user_id`,`g`.`group_id` FROM `w47fa_users` AS `u`, `w47fa_user_usergroup_map` AS `g` WHERE `u`.`id` = `g`.`user_id` AND `g`.`group_id` = 53
";
$db->setQuery($query);
$data = $db->loadObjectList();
foreach ( $data as $d ) {

$form->data['user'
  • = array('id'=>$d->id,'name'=>$d->name);

    }
    ?>


    thomaswebb
    J
    jhaviro
    WORK!

    Thank you very much.
    Only Model name is "user" (in code), and "users" in explanation. Fix-it.