make viewcontacts part of the profile tab
This commit is contained in:
parent
f45a8f1a03
commit
45c2a4868e
|
@ -700,6 +700,16 @@ if(! function_exists('profile_tabs')){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((! $is_owner) && ((count($a->profile)) || (! $a->profile['hide-friends']))) {
|
||||||
|
$tabs[] = array(
|
||||||
|
'label' => t('Contacts'),
|
||||||
|
'url' => $a->get_baseurl() . '/viewcontacts/' . $nickname,
|
||||||
|
'sel' => ((!isset($tab)&&$a->argv[0]=='viewcontacts')?'active':''),
|
||||||
|
'title' => t('Contacts'),
|
||||||
|
'id' => 'viewcontacts-tab',
|
||||||
|
'accesskey' => 's',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
|
$arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
|
||||||
call_hooks('profile_tabs', $arr);
|
call_hooks('profile_tabs', $arr);
|
||||||
|
|
|
@ -8,7 +8,23 @@ function viewcontacts_init(&$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile_load($a,$a->argv[1]);
|
nav_set_selected('home');
|
||||||
|
|
||||||
|
if($a->argc > 1) {
|
||||||
|
$nick = $a->argv[1];
|
||||||
|
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
|
||||||
|
dbesc($nick)
|
||||||
|
);
|
||||||
|
|
||||||
|
if(! count($r))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$a->data['user'] = $r[0];
|
||||||
|
$a->profile_uid = $r[0]['uid'];
|
||||||
|
$is_owner = (local_user() && (local_user() == $a->profile_uid));
|
||||||
|
|
||||||
|
profile_load($a,$a->argv[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +41,10 @@ function viewcontacts_content(&$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$o = "";
|
||||||
|
|
||||||
|
// tabs
|
||||||
|
$o .= profile_tabs($a,$is_owner, $a->data['user']['nickname']);
|
||||||
|
|
||||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||||
WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
||||||
|
@ -93,7 +113,7 @@ function viewcontacts_content(&$a) {
|
||||||
|
|
||||||
$tpl = get_markup_template("viewcontact_template.tpl");
|
$tpl = get_markup_template("viewcontact_template.tpl");
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$title' => t('View Contacts'),
|
'$title' => t('Contacts'),
|
||||||
'$contacts' => $contacts,
|
'$contacts' => $contacts,
|
||||||
'$paginate' => paginate($a),
|
'$paginate' => paginate($a),
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user