aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profile.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-09-17 18:26:20 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-09-17 18:26:20 -0700
commit2bae548b356b4f9f6cbda88bc8a86df1db404660 (patch)
treed61714ba349e1a187dbc5aeebdbda82c4d65d781 /mod/profile.php
parent22429cd432ae99c529040d013b9e25f0549bdf31 (diff)
downloadvolse-hubzilla-2bae548b356b4f9f6cbda88bc8a86df1db404660.tar.gz
volse-hubzilla-2bae548b356b4f9f6cbda88bc8a86df1db404660.tar.bz2
volse-hubzilla-2bae548b356b4f9f6cbda88bc8a86df1db404660.zip
no profile after returning from visitor mode with a selected profile
put bottom margin on non-profile pages as well
Diffstat (limited to 'mod/profile.php')
-rw-r--r--mod/profile.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/mod/profile.php b/mod/profile.php
index 5efb28ea7..c42291d96 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 );