aboutsummaryrefslogtreecommitdiffstats
path: root/include/contact_widgets.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/contact_widgets.php')
-rw-r--r--include/contact_widgets.php57
1 files changed, 56 insertions, 1 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index af05f8c9f..2fa5dee0b 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -1,5 +1,6 @@
<?php /** @file */
+
function follow_widget() {
$a = get_app();
$uid =$a->channel['channel_id'];
@@ -149,4 +150,58 @@ function common_friends_visitor_widget($profile_uid) {
'$items' => $r
));
-}; \ No newline at end of file
+};
+
+
+function suggest_widget() {
+
+ require_once('include/socgraph.php');
+
+ $r = suggestion_query(local_user(),get_observer_hash(),0,20);
+
+ if(! $r) {
+ return;
+ }
+
+ $arr = array();
+
+ // Get two random entries from the top 20 returned.
+ // We'll grab the first one and the one immediately following.
+ // This will throw some entropy intot he situation so you won't
+ // be looking at the same two mug shots every time the widget runs
+
+
+ $index = ((count($r) > 2) ? mt_rand(0,count($r) - 2) : 0);
+
+
+ for($x = $index; $x <= ($index+1); $x ++) {
+
+ $rr = $r[$x];
+ if(! $rr['xchan_url'])
+ break;
+
+ $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr'];
+
+ $arr[] = array(
+ 'url' => chanlink_url($rr['xchan_url']),
+ 'profile' => $rr['xchan_url'],
+ 'name' => $rr['xchan_name'],
+ 'photo' => $rr['xchan_photo_m'],
+ 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'],
+ 'conntxt' => t('Connect'),
+ 'connlnk' => $connlnk,
+ 'ignore' => t('Ignore/Hide')
+ );
+ }
+
+
+ $o = replace_macros(get_markup_template('suggest_widget.tpl'),array(
+ '$title' => t('Suggestions'),
+ '$more' => t('See more...'),
+ '$entries' => $arr
+ ));
+
+ return $o;
+
+}
+