]> git.mxchange.org Git - friendica-addons.git/blobdiff - communityhome/communityhome.php
Merge pull request #185 from annando/master
[friendica-addons.git] / communityhome / communityhome.php
index e2c3deeb817d50681541ada7cdd0766677854e9e..8a2f3d291f10c5204555cc85ed0f5052b5be2e77 100755 (executable)
@@ -2,7 +2,7 @@
 /**
  * Name: Community home
  * Description: Show last community activity in homepage
- * Version: 1.0
+ * Version: 2.0
  * Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
  */
 
@@ -23,17 +23,24 @@ function communityhome_uninstall() {
 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');
@@ -68,8 +75,8 @@ function communityhome_home(&$a, &$o){
        // 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