aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/identity.php28
-rw-r--r--view/js/icon_translate.js1
-rw-r--r--view/theme/redbasic/css/style.css4
-rwxr-xr-xview/tpl/profile_vcard.tpl2
4 files changed, 33 insertions, 2 deletions
diff --git a/include/identity.php b/include/identity.php
index a99474d42..ee289495d 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -544,6 +544,9 @@ function profile_load(&$a, $nickname, $profile = '') {
}
$a->profile = $r[0];
+ $online = get_online_status($nickname);
+ $a->profile['online_status'] = $online['result'];
+
$a->profile_uid = $r[0]['profile_uid'];
$a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname();
@@ -678,13 +681,15 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
+ $profile['online'] = (($profile['online_status'] === 'online') ? t('Online Now') : False);
+logger('online: ' . $profile['online']);
if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) {
$block = true;
}
if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
- $location = $pdesc = $gender = $marital = $homepage = False;
+ $location = $pdesc = $gender = $marital = $homepage = $online = False;
}
$firstname = ((strpos($profile['name'],' '))
@@ -1144,3 +1149,24 @@ function is_foreigner($s) {
function is_member($s) {
return((is_foreigner($s)) ? false : true);
}
+
+function get_online_status($nick) {
+
+ $ret = array('result' => false);
+
+ $r = q("select channel_id, channel_hash from channel where channel_address = '%s' limit 1",
+ dbesc(argv(1))
+ );
+ if($r) {
+ $hide = get_pconfig($r[0]['channel_id'],'system','hide_online_status');
+ if($hide)
+ return $ret;
+ $x = q("select cp_status from chatpresence where cp_xchan = '%s' and cp_room = 0 limit 1",
+ dbesc($r[0]['channel_hash'])
+ );
+ if($x)
+ $ret['result'] = $x[0]['cp_status'];
+ }
+
+ return $ret;
+}
diff --git a/view/js/icon_translate.js b/view/js/icon_translate.js
index 9e69e0b7d..838ff899f 100644
--- a/view/js/icon_translate.js
+++ b/view/js/icon_translate.js
@@ -50,4 +50,5 @@ $(document).ready(function() {
$('.icon-check').addClass('');
$('.icon-globe').addClass('');
$('.icon-circle-blank').addClass('');
+ $('.icon-circle').addClass('');
}); \ No newline at end of file
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index b2f90cbc1..02832b5f0 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -2445,4 +2445,8 @@ img.mail-list-sender-photo {
.abook-self {
background-color: #ffdddd;
+}
+.online-now {
+ color: red;
+ cursor: pointer;
} \ No newline at end of file
diff --git a/view/tpl/profile_vcard.tpl b/view/tpl/profile_vcard.tpl
index aaee02ab5..7a857fd67 100755
--- a/view/tpl/profile_vcard.tpl
+++ b/view/tpl/profile_vcard.tpl
@@ -16,7 +16,7 @@
</div>
{{/if}}
- <div class="fn label">{{$profile.name}}</div>
+ <div class="fn label">{{$profile.name}}{{if $profile.online}} <i class="icon-asterisk online-now" title="{{$profile.online}}"></i>{{/if}}</div>
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div>