no profile after returning from visitor mode with a selected profile

put bottom margin on non-profile pages as well
This commit is contained in:
Mike Macgirvin 2010-09-17 18:26:20 -07:00
parent 22429cd432
commit 2bae548b35
2 changed files with 18 additions and 10 deletions

View file

@ -10,18 +10,24 @@ function profile_load(&$a, $username, $profile = 0) {
$profile = $r[0]['profile-id']; $profile = $r[0]['profile-id'];
} }
$r = null;
if($profile) { if($profile) {
$profile_int = intval($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))) { if(($r === false) || (! count($r))) {
notice( t('No profile') . EOL ); notice( t('No profile') . EOL );

View file

@ -8,7 +8,9 @@
<header><?php echo $page['header']; ?></header> <header><?php echo $page['header']; ?></header>
<nav><?php echo $page['nav']; ?></nav> <nav><?php echo $page['nav']; ?></nav>
<aside><?php echo $page['aside']; ?></aside> <aside><?php echo $page['aside']; ?></aside>
<section><?php echo $page['content']; ?></section> <section><?php echo $page['content']; ?>
<div id="page-footer"></div>
</section>
<footer><?php echo $page['footer']; ?></footer> <footer><?php echo $page['footer']; ?></footer>
</body> </body>
</html> </html>