3 function viewcontacts_init(&$a) {
5 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
9 profile_load($a,$a->argv[1]);
13 function viewcontacts_content(&$a) {
15 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
16 notice( t('Public access denied.') . EOL);
20 if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
21 notice( t('Permission denied.') . EOL);
25 $o .= '<h3>' . t('View Contacts') . '</h3>';
28 $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0",
29 intval($a->profile['uid'])
32 $a->set_pager_total($r[0]['total']);
34 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
35 intval($a->profile['uid']),
36 intval($a->pager['start']),
37 intval($a->pager['itemspage'])
40 notice( t('No contacts.') . EOL );
44 $tpl = load_view_file("view/viewcontact_template.tpl");
50 $o .= replace_macros($tpl, array(
52 '$alt_text' => t('Visit $username\'s profile'),
53 '$thumb' => $rr['thumb'],
54 '$name' => substr($rr['name'],0,20),
55 '$username' => $rr['name'],
60 $o .= '<div id="view-contact-end"></div>';