chatroom suggestions
This commit is contained in:
parent
402d44e2f4
commit
642da17b86
@ -589,3 +589,39 @@ function widget_chatroom_list($arr) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function widget_bookmarkedchats($arr) {
|
||||||
|
$h = get_observer_hash();
|
||||||
|
if(! $h)
|
||||||
|
return;
|
||||||
|
$r = q("select * from xchat where xchat_xchan = '%s' group by xchat_url order by xchat_desc",
|
||||||
|
dbesc($h)
|
||||||
|
);
|
||||||
|
|
||||||
|
for($x = 0; $x < count($r); $x ++)
|
||||||
|
$r[$x]['xchat_url'] = zid($r[$x]['xchat_url']);
|
||||||
|
return replace_macros(get_markup_template('bookmarkedchats.tpl'),array(
|
||||||
|
'$header' => t('Bookmarked Chatrooms'),
|
||||||
|
'$rooms' => $r
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function widget_suggestedchats($arr) {
|
||||||
|
|
||||||
|
// probably should restrict this to your friends, but then the widget will only work
|
||||||
|
// if you are logged in locally.
|
||||||
|
|
||||||
|
$h = get_observer_hash();
|
||||||
|
if(! $h)
|
||||||
|
return;
|
||||||
|
$r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc",
|
||||||
|
dbesc($h)
|
||||||
|
);
|
||||||
|
|
||||||
|
for($x = 0; $x < count($r); $x ++)
|
||||||
|
$r[$x]['xchat_url'] = zid($r[$x]['xchat_url']);
|
||||||
|
return replace_macros(get_markup_template('bookmarkedchats.tpl'),array(
|
||||||
|
'$header' => t('Suggested Chatrooms'),
|
||||||
|
'$rooms' => $r
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
[region=aside]
|
[region=aside]
|
||||||
[widget=profile][/widget]
|
[widget=profile][/widget]
|
||||||
|
[widget=bookmarkedchats][/widget]
|
||||||
|
[widget=suggestededchats][/widget]
|
||||||
[/region]
|
[/region]
|
||||||
|
10
view/tpl/bookmarkedchats.tpl
Normal file
10
view/tpl/bookmarkedchats.tpl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{{if $rooms}}
|
||||||
|
<div class="widget">
|
||||||
|
<h3>{{$header}}</h3>
|
||||||
|
<ul class="bookmarkchat">
|
||||||
|
{{foreach $rooms as $room}}
|
||||||
|
<li><a href="{{$room.xchat_url}}">{{$room.xchat_desc}}</a></li>
|
||||||
|
{{/foreach}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
Reference in New Issue
Block a user