aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-07-03 02:47:36 -0700
committerfriendica <info@friendica.com>2013-07-03 02:47:36 -0700
commitc16b65b5bd7f5a43647523ef9dd351a9edb17fde (patch)
tree8f6e31fa7939c2dde80781fc3683813d2dfc0168
parent8369a8a7559391ea6cb2757b5093bcf47aed0ed1 (diff)
downloadvolse-hubzilla-c16b65b5bd7f5a43647523ef9dd351a9edb17fde.tar.gz
volse-hubzilla-c16b65b5bd7f5a43647523ef9dd351a9edb17fde.tar.bz2
volse-hubzilla-c16b65b5bd7f5a43647523ef9dd351a9edb17fde.zip
multi-profiles work
-rwxr-xr-xboot.php15
-rw-r--r--mod/profile.php28
-rw-r--r--mod/profiles.php3
-rwxr-xr-xview/tpl/profile_edit.tpl2
4 files changed, 31 insertions, 17 deletions
diff --git a/boot.php b/boot.php
index dc0ec48a5..e11327d69 100755
--- a/boot.php
+++ b/boot.php
@@ -1438,6 +1438,8 @@ function get_max_import_size() {
function profile_load(&$a, $nickname, $profile = '') {
+ logger('profile_load: ' . $profile);
+
$user = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($nickname)
);
@@ -1460,12 +1462,13 @@ function profile_load(&$a, $nickname, $profile = '') {
return;
}
- $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' limit 1",
- dbesc($observer['xchan_hash'])
- );
- if($r)
- $profile = $r[0]['abook_profile'];
-
+ if(! $profile) {
+ $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' limit 1",
+ dbesc($observer['xchan_hash'])
+ );
+ if($r)
+ $profile = $r[0]['abook_profile'];
+ }
$r = null;
if($profile) {
diff --git a/mod/profile.php b/mod/profile.php
index 2f869a533..c4c0fc35b 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -10,25 +10,35 @@ function profile_init(&$a) {
return;
}
- $profile = 0;
+ $profile = '';
$channel = $a->get_channel();
-
+dbg(1);
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
+ $r = q("select profile_guid from profile where id = %d and uid = %d limit 1",
+ intval($profile),
+ intval(local_user())
+ );
+ if(! $r)
+ $profile = '';
+ $profile = $r[0]['profile_guid'];
}
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
- $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
- dbesc(argv(1))
- );
- if($x) {
- $a->profile = $x[0];
+ if(! $profile) {
+ $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
+ dbesc(argv(1))
+ );
+ if($x) {
+ $a->profile = $x[0];
+ }
+ }
// $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format');
// if(! $channel_display)
- profile_load($a,$which,$profile);
- }
+ profile_load($a,$which,$profile);
+dbg(0);
}
diff --git a/mod/profiles.php b/mod/profiles.php
index ff6bc8ff6..28d8dd973 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -47,7 +47,7 @@ function profiles_init(&$a) {
if((argc() > 1) && (argv(1) === 'new')) {
- check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
+// check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user()));
@@ -519,6 +519,7 @@ function profiles_content(&$a) {
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t='
. get_form_security_token("profile_drop"),
+ '$guid' => $r[0]['profile_guid'],
'$banner' => t('Edit Profile Details'),
'$submit' => t('Submit'),
'$viewprof' => t('View this profile'),
diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl
index 864599244..33cc9b75b 100755
--- a/view/tpl/profile_edit.tpl
+++ b/view/tpl/profile_edit.tpl
@@ -10,7 +10,7 @@
<div id="profile-edit-links">
<ul>
<li><a href="profile_photo" id="profile-photo_upload-link" title="{{$profpic}}">{{$profpic}}</a></li>
-<li><a href="profile/{{$profile_id}}/view?tab=profile" id="profile-edit-view-link" title="{{$viewprof}}">{{$viewprof}}</a></li>
+<li><a href="profile/{{$profile_id}}/view" id="profile-edit-view-link" title="{{$viewprof}}">{{$viewprof}}</a></li>
<li><a href="{{$profile_clone_link}}" id="profile-edit-clone-link" title="{{$cr_prof}}">{{$cl_prof}}</a></li>
<li></li>
<li><a href="{{$profile_drop_link}}" id="profile-edit-drop-link" title="{{$del_prof}}" {{$disabled}} >{{$del_prof}}</a></li>