/**
* Name: Community home
* Description: Show last community activity in homepage
- * Version: 1.0
+ * Version: 2.0
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
*/
function communityhome_home(&$a, &$o){
// custom css
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
-
- $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);
-
+
+ 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');
// this query don't work on some mysql versions
if (get_config('communityhome','showactiveusers')===true){
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
- (SELECT COUNT(`id`) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
- (SELECT COUNT(`id`) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
+ (SELECT COUNT(*) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
+ (SELECT COUNT(*) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
(
SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
UNION ALL