@@ -1067,7 +1067,9 @@ function datepicker($name, $datestamp = false, $options = null)
10671067 * @param array $options
10681068 * @param string $options['group'] if == 'class' then users will be sorted into userclass groups.
10691069 * @param string $options['fields']
1070- * @param string $options['classes']
1070+ * @param string $options['classes'] - single or comma-separated list of user-classes members to include.
1071+ * @param string $options['excludeSelf'] = exlude logged in user from list.
1072+ * @param string $options['return'] if == 'array' an array is returned.
10711073 * @return string select form element.
10721074 */
10731075 public function userlist ($ name , $ val =null , $ options =array ())
@@ -1133,9 +1135,16 @@ public function userlist($name, $val=null, $options=array())
11331135 foreach ($ users as $ u )
11341136 {
11351137 $ uclass = explode (', ' ,$ u ['user_class ' ]);
1136- if (($ classList == e_UC_ADMIN) || ($ classList = e_UC_MEMBER) || in_array ($ cls ,$ uclass ))
1138+
1139+ if (($ classList == e_UC_ADMIN) || ($ classList == e_UC_MEMBER) || in_array ($ cls ,$ uclass ))
11371140 {
11381141 $ id = $ u ['user_id ' ];
1142+
1143+ if (!empty ($ options ['excludeSelf ' ]) && ($ id == USERID ))
1144+ {
1145+ continue ;
1146+ }
1147+
11391148 $ opt [$ cname ][$ id ] = $ u ['user_name ' ];
11401149 }
11411150 }
@@ -1154,6 +1163,15 @@ public function userlist($name, $val=null, $options=array())
11541163
11551164 }
11561165
1166+
1167+ ksort ($ opt );
1168+
1169+
1170+ if (!empty ($ options ['return ' ]) && $ options ['return ' ] == 'array ' ) // can be used by user.php ajax method..
1171+ {
1172+ return $ opt ;
1173+ }
1174+
11571175 return $ this ->select ($ name ,$ opt ,$ val ,$ options , varset ($ options ['default ' ],null ));
11581176
11591177 }
0 commit comments