Redirect profiles list to default profile, when multi_profiles is disabled.
This commit is contained in:
parent
0185f867bb
commit
e6364f6680
1 changed files with 19 additions and 5 deletions
|
@ -726,12 +726,26 @@ function profiles_content(&$a) {
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Profiles list.
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
//If we don't support multi profiles, don't display this list.
|
||||||
|
if(!feature_enabled(local_user(),'multi_profiles')){
|
||||||
|
$r = q(
|
||||||
|
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
|
||||||
|
local_user()
|
||||||
|
);
|
||||||
|
if(count($r)){
|
||||||
|
//Go to the default profile.
|
||||||
|
goaway($a->get_baseurl(true) . '/profiles/'.$r[0]['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
||||||
local_user());
|
local_user());
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
|
|
||||||
$tpl_header = get_markup_template('profile_listing_header.tpl');
|
$tpl_header = get_markup_template('profile_listing_header.tpl');
|
||||||
$o .= replace_macros($tpl_header,array(
|
$o .= replace_macros($tpl_header,array(
|
||||||
'$header' => t('Edit/Manage Profiles'),
|
'$header' => t('Edit/Manage Profiles'),
|
||||||
|
@ -739,10 +753,10 @@ function profiles_content(&$a) {
|
||||||
'$cr_new' => t('Create New Profile'),
|
'$cr_new' => t('Create New Profile'),
|
||||||
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new")
|
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new")
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
$tpl = get_markup_template('profile_entry.tpl');
|
$tpl = get_markup_template('profile_entry.tpl');
|
||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$photo' => $a->get_cached_avatar_image($rr['thumb']),
|
'$photo' => $a->get_cached_avatar_image($rr['thumb']),
|
||||||
|
|
Loading…
Reference in a new issue