This mod shows a online indicator in users profile, next to the name of the user.
open:
/application/modules/User/widgets/profile-status/Controller.php
find and after:
add this code:
save changes!
open:
/application/modules/User/widgets/profile-status/index.tpl
find and after:
PHP:
add this code:
Done!
open:
/application/modules/User/widgets/profile-status/Controller.php
find and after:
PHP Code:
// Get subject and check auth
$subject = Engine_Api::_()->core()->getSubject('user');
//if( !$subject->authorization()->isAllowed($viewer, 'view') ) {
// return $this->setNoRender();
//}
PHP Code:
$onlineTable = Engine_Api::_()->getDbtable('online', 'user');
$onlineTableName = $onlineTable->info('name');
$select = $onlineTable->select()
->from($onlineTableName, array('COUNT(*) AS count'))
->where($onlineTableName.'.user_id = ?', $subject->user_id)
->where($onlineTableName.'.active > ?', new Zend_Db_Expr('DATE_SUB(NOW(),INTERVAL 20 MINUTE)'))
;
$_is_online = $select->query()->fetchColumn(0);
$this->view->is_online = $_is_online;
open:
/application/modules/User/widgets/profile-status/index.tpl
find and after:
PHP:
PHP Code:
<?php echo $this->subject()->getTitle() ?>
PHP Code:
<?php
if($this->is_online==1) echo '<span style="width:10px;height:10px;background-color:#5cb85c;border: 1px solid #4cae4c;border-radius:5px;color:white;font-size:12px;vertical-align:middle;">'.$this->translate('online').'</span>'
?>