]> git.mxchange.org Git - friendica.git/blob - mod/suggest.php
add connect link to friend suggest
[friendica.git] / mod / suggest.php
1 <?php
2
3 require_once('include/socgraph.php');
4 require_once('include/contact_widgets.php');
5
6
7 function suggest_init(&$a) {
8         if(! local_user())
9                 return;
10
11         if(x($_GET,'ignore') && intval($_GET['ignore'])) {
12                 q("insert into gcign ( uid, gcid ) values ( %d, %d ) ",
13                         intval(local_user()),
14                         intval($_GET['ignore'])
15                 );
16         }
17
18 }
19                 
20
21
22
23
24 function suggest_content(&$a) {
25
26         $o = '';
27         if(! local_user()) {
28                 notice( t('Permission denied.') . EOL);
29                 return;
30         }
31
32         $a->page['aside'] .= follow_widget();
33         $a->page['aside'] .= findpeople_widget();
34
35
36         $o .= '<h2>' . t('Friend Suggestions') . '</h2>';
37
38
39         $r = suggestion_query(local_user());
40
41         if(! count($r)) {
42                 $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
43                 return $o;
44         }
45
46         $tpl = get_markup_template('suggest_friends.tpl');
47
48         foreach($r as $rr) {
49
50                 $connlink = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);                     
51
52                 $o .= replace_macros($tpl,array(
53                         '$url' => $rr['url'],
54                         '$name' => $rr['name'],
55                         '$photo' => $rr['photo'],
56                         '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
57                         '$conntxt' => t('Connect'),
58                         '$connlnk' => $connlnk,
59                         '$ignore' => t('Ignore/Hide')
60                 ));
61         }
62
63         $o .= cleardiv();
64 //      $o .= paginate($a);
65         return $o;
66 }