From 2bae548b356b4f9f6cbda88bc8a86df1db404660 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Fri, 17 Sep 2010 18:26:20 -0700 Subject: [PATCH] no profile after returning from visitor mode with a selected profile put bottom margin on non-profile pages as well --- mod/profile.php | 24 +++++++++++++++--------- view/default.php | 4 +++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/mod/profile.php b/mod/profile.php index 5efb28ea75..c42291d963 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -10,18 +10,24 @@ function profile_load(&$a, $username, $profile = 0) { $profile = $r[0]['profile-id']; } + $r = null; + if($profile) { $profile_int = intval($profile); - $sql_which = " AND `profile`.`id` = $profile_int "; + $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` + LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` + WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d LIMIT 1", + dbesc($username), + intval($profile_int) + ); + } + if(! count($r)) { + $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` + LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` + WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 LIMIT 1", + dbesc($username) + ); } - else - $sql_which = " AND `profile`.`is-default` = 1 "; - - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` - LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` - WHERE `user`.`nickname` = '%s' $sql_which LIMIT 1", - dbesc($username) - ); if(($r === false) || (! count($r))) { notice( t('No profile') . EOL ); diff --git a/view/default.php b/view/default.php index 25d8ea1dcf..47adf4a769 100644 --- a/view/default.php +++ b/view/default.php @@ -8,7 +8,9 @@
-
+
+ +