From e6364f6680e2abcffd3311ba189f17ceef08b9f5 Mon Sep 17 00:00:00 2001 From: Beanow Date: Sat, 28 Jun 2014 01:30:10 +0200 Subject: [PATCH 1/3] Redirect profiles list to default profile, when multi_profiles is disabled. --- mod/profiles.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/mod/profiles.php b/mod/profiles.php index e57a0fa841..c47d9ad515 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -726,12 +726,26 @@ function profiles_content(&$a) { return $o; } + + //Profiles list. 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", local_user()); if(count($r)) { - + $tpl_header = get_markup_template('profile_listing_header.tpl'); $o .= replace_macros($tpl_header,array( '$header' => t('Edit/Manage Profiles'), @@ -739,10 +753,10 @@ function profiles_content(&$a) { '$cr_new' => t('Create New Profile'), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new") )); - - + + $tpl = get_markup_template('profile_entry.tpl'); - + foreach($r as $rr) { $o .= replace_macros($tpl, array( '$photo' => $a->get_cached_avatar_image($rr['thumb']), From 6089bc94b3a89b8459f5031d49b8975729064524 Mon Sep 17 00:00:00 2001 From: Beanow Date: Sat, 28 Jun 2014 01:31:11 +0200 Subject: [PATCH 2/3] Extend profile editor information. * Labels for splitting fields into sections. * Security token for profile_photo action. --- mod/profiles.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mod/profiles.php b/mod/profiles.php index c47d9ad515..7903b8b604 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -137,6 +137,8 @@ function profiles_init(&$a) { profile_load($a,$a->user['nickname'],$r[0]['id']); } + + } @@ -636,6 +638,7 @@ function profiles_content(&$a) { $o .= replace_macros($tpl,array( '$multi_profiles' => feature_enabled(local_user(),'multi_profiles'), '$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_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), '$banner' => t('Edit Profile Details'), @@ -645,6 +648,15 @@ function profiles_content(&$a) { '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), '$del_prof' => t('Delete this profile'), + '$lbl_basic_section' => t('Edit basic information'), + '$lbl_picture_section' => t('Edit profile picture'), + '$lbl_location_section' => t('Edit location'), + '$lbl_contacting_section' => t('Edit contacting information'), + '$lbl_status_section' => t('Edit status information'), + '$lbl_about_section' => t('Edit additional information'), + '$lbl_interests_section' => t('Edit interests'), + '$lbl_keywords_section' => t('Edit keywords'), + '$lbl_profile_photo' => t('Upload Profile Photo'), '$lbl_profname' => t('Profile Name:'), '$lbl_fullname' => t('Your Full Name:'), '$lbl_title' => t('Title/Description:'), From e9dc6e4faa8d69b0760317cdf601fe1c0220b3bb Mon Sep 17 00:00:00 2001 From: Beanow Date: Thu, 3 Jul 2014 18:39:22 +0200 Subject: [PATCH 3/3] Some changes to the labels and an edit profile button. --- include/profile_advanced.php | 9 ++++++--- mod/profiles.php | 15 +++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/profile_advanced.php b/include/profile_advanced.php index 8dfb1beecc..05fd56d023 100644 --- a/include/profile_advanced.php +++ b/include/profile_advanced.php @@ -79,10 +79,13 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $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( - '$title' => t('Profile'), - '$profile' => $profile, + '$title' => t('Profile'), + '$profile' => $profile )); } diff --git a/mod/profiles.php b/mod/profiles.php index 7903b8b604..423804437a 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -648,14 +648,13 @@ function profiles_content(&$a) { '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), '$del_prof' => t('Delete this profile'), - '$lbl_basic_section' => t('Edit basic information'), - '$lbl_picture_section' => t('Edit profile picture'), - '$lbl_location_section' => t('Edit location'), - '$lbl_contacting_section' => t('Edit contacting information'), - '$lbl_status_section' => t('Edit status information'), - '$lbl_about_section' => t('Edit additional information'), - '$lbl_interests_section' => t('Edit interests'), - '$lbl_keywords_section' => t('Edit keywords'), + '$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_fullname' => t('Your Full Name:'),