+ if (!get_config('communityhome','hidelogin')){
+ $aside = array(
+ '$tab_1' => t('Login'),
+ '$tab_2' => t('OpenID'),
+ '$noOid' => get_config('system','no_openid'),
+ );
+
+ // login form
+ $aside['$login_title'] = t('Login');
+ $aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
+ } else
+ $aside = array(
+ //'$tab_1' => t('Login'),
+ //'$tab_2' => t('OpenID'),
+ //'$noOid' => get_config('system','no_openid'),
+ );
+
+ // last 12 users
+ if (get_config('communityhome','showlastusers')===true){
+ $aside['$lastusers_title'] = t('Latest users');
+ $aside['$lastusers_items'] = array();
+ $sql_extra = "";
+ $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
+ $order = " ORDER BY `register_date` DESC ";
+
+ $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
+ FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
+ WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
+ 0,
+ 12
+ );
+ # $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+ $tpl = get_markup_template( 'directory_item.tpl', 'addon/communityhome/' );
+ if(count($r)) {
+ $photo = 'thumb';
+ foreach($r as $rr) {
+ $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
+ $entry = replace_macros($tpl,array(
+ '$id' => $rr['id'],
+ '$profile_link' => $profile_link,
+ '$photo' => $a->get_cached_avatar_image($rr[$photo]),
+ '$alt_text' => $rr['name'],
+ ));
+ $aside['$lastusers_items'][] = $entry;
+ }