From 8369a8a7559391ea6cb2757b5093bcf47aed0ed1 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 3 Jul 2013 01:50:39 -0700 Subject: progress on multiple profiles, doing it the old way. I don't think we're going to be able to do it the new way - way too complicated. --- boot.php | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index db61a79ae..dc0ec48a5 100755 --- a/boot.php +++ b/boot.php @@ -1419,7 +1419,7 @@ function get_max_import_size() { * Function : profile_load * @parameter App $a * @parameter string $nickname - * @parameter int $profile + * @parameter string $profile * * Summary: Loads a profile into the page sidebar. * The function requires a writeable copy of the main App structure, and the nickname @@ -1436,7 +1436,7 @@ function get_max_import_size() { */ -function profile_load(&$a, $nickname, $profile = 0) { +function profile_load(&$a, $nickname, $profile = '') { $user = q("select channel_id from channel where channel_address = '%s' limit 1", dbesc($nickname) @@ -1468,22 +1468,19 @@ function profile_load(&$a, $nickname, $profile = 0) { $r = null; - - if($profile) { - $profile_int = intval($profile); - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , channel.* FROM `profile` - LEFT JOIN channel ON `profile`.`uid` = channel.channel_id - WHERE channel.channel_address = '%s' AND `profile`.`id` = %d LIMIT 1", + $r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile + LEFT JOIN channel ON profile.uid = channel.channel_id + WHERE channel.channel_address = '%s' AND profile.profile_guid = '%s' LIMIT 1", dbesc($nickname), - intval($profile_int) + dbesc($profile) ); } - if(! ($r && count($r))) { - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `channel`.* FROM `profile` - LEFT JOIN `channel` ON `profile`.`uid` = channel.channel_id - WHERE channel.channel_address = '%s' AND `profile`.`is_default` = 1 LIMIT 1", + if(! $r) { + $r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile + LEFT JOIN channel ON profile.uid = channel.channel_id + WHERE channel.channel_address = '%s' AND profile.is_default = 1 LIMIT 1", dbesc($nickname) ); } -- cgit v1.2.3