Merge branch 'feature/edit-profile-improvements' into develop

This commit is contained in:
Beanow 2014-09-04 23:58:22 +02:00
commit 992684c362
2 changed files with 36 additions and 8 deletions

View File

@ -80,9 +80,12 @@ function advanced_profile(&$a) {
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
if ($a->profile['uid'] == local_user())
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile'));
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$title' => t('Profile'), '$title' => t('Profile'),
'$profile' => $profile, '$profile' => $profile
)); ));
} }

View File

@ -138,6 +138,8 @@ function profiles_init(&$a) {
profile_load($a,$a->user['nickname'],$r[0]['id']); profile_load($a,$a->user['nickname'],$r[0]['id']);
} }
} }
function profiles_post(&$a) { function profiles_post(&$a) {
@ -636,6 +638,7 @@ function profiles_content(&$a) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$multi_profiles' => feature_enabled(local_user(),'multi_profiles'), '$multi_profiles' => feature_enabled(local_user(),'multi_profiles'),
'$form_security_token' => get_form_security_token("profile_edit"), '$form_security_token' => get_form_security_token("profile_edit"),
'$form_security_token_photo' => get_form_security_token("profile_photo"),
'$profile_clone_link' => 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone"), '$profile_clone_link' => 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone"),
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
'$banner' => t('Edit Profile Details'), '$banner' => t('Edit Profile Details'),
@ -645,6 +648,14 @@ function profiles_content(&$a) {
'$cr_prof' => t('Create a new profile using these settings'), '$cr_prof' => t('Create a new profile using these settings'),
'$cl_prof' => t('Clone this profile'), '$cl_prof' => t('Clone this profile'),
'$del_prof' => t('Delete this profile'), '$del_prof' => t('Delete this profile'),
'$lbl_basic_section' => t('Basic information'),
'$lbl_picture_section' => t('Profile picture'),
'$lbl_location_section' => t('Location'),
'$lbl_preferences_section' => t('Preferences'),
'$lbl_status_section' => t('Status information'),
'$lbl_about_section' => t('Additional information'),
'$lbl_interests_section' => t('Interests'),
'$lbl_profile_photo' => t('Upload Profile Photo'),
'$lbl_profname' => t('Profile Name:'), '$lbl_profname' => t('Profile Name:'),
'$lbl_fullname' => t('Your Full Name:'), '$lbl_fullname' => t('Your Full Name:'),
'$lbl_title' => t('Title/Description:'), '$lbl_title' => t('Title/Description:'),
@ -726,8 +737,22 @@ 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)) {