aboutsummaryrefslogtreecommitdiffstats
path: root/mod/suggest.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/suggest.php')
-rw-r--r--mod/suggest.php56
1 files changed, 29 insertions, 27 deletions
diff --git a/mod/suggest.php b/mod/suggest.php
index 4aed2e61a..f891ebefc 100644
--- a/mod/suggest.php
+++ b/mod/suggest.php
@@ -8,17 +8,21 @@ function suggest_init(&$a) {
if(! local_user())
return;
- if(x($_GET,'ignore') && intval($_GET['ignore'])) {
- q("insert into gcign ( uid, gcid ) values ( %d, %d ) ",
+ if(x($_GET,'ignore')) {
+ q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ",
intval(local_user()),
- intval($_GET['ignore'])
+ dbesc($_GET['ignore'])
);
}
}
+function suggest_aside(&$a) {
+ $a->set_widget('follow', follow_widget());
+ $a->set_widget('findpeople', findpeople_widget());
+}
function suggest_content(&$a) {
@@ -31,38 +35,36 @@ function suggest_content(&$a) {
$_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
- $a->page['aside'] .= follow_widget();
- $a->page['aside'] .= findpeople_widget();
+ $r = suggestion_query(local_user(),get_observer_hash());
+ if(! $r) {
+ info( t('No suggestions available. If this is a new site, please try again in 24 hours.'));
+ return;
+ }
- $o .= '<h2>' . t('Friend Suggestions') . '</h2>';
+ $arr = array();
+ foreach($r as $rr) {
- $r = suggestion_query(local_user());
+ $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['xchan_addr'];
- if(! count($r)) {
- $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
- return $o;
+ $arr[] = array(
+ 'url' => chanlink_url($rr['xchan_url']),
+ 'name' => $rr['xchan_name'],
+ 'photo' => $rr['xchan_photo_m'],
+ 'ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['xchan_hash'],
+ 'conntxt' => t('Connect'),
+ 'connlnk' => $connlnk,
+ 'ignore' => t('Ignore/Hide')
+ );
}
- $tpl = get_markup_template('suggest_friends.tpl');
- foreach($r as $rr) {
-
- $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
-
- $o .= replace_macros($tpl,array(
- '$url' => zid($rr['url']),
- '$name' => $rr['name'],
- '$photo' => $rr['photo'],
- '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
- '$conntxt' => t('Connect'),
- '$connlnk' => $connlnk,
- '$ignore' => t('Ignore/Hide')
- ));
- }
+ $o = replace_macros(get_markup_template('suggest_page.tpl'),array(
+ '$title' => t('Channel Suggestions'),
+ '$entries' => $arr
+ ));
- $o .= cleardiv();
-// $o .= paginate($a);
return $o;
+
}