diff options
author | Stefan Parviainen <saparvia@caterva.eu> | 2015-01-04 14:23:23 +0100 |
---|---|---|
committer | Stefan Parviainen <saparvia@caterva.eu> | 2015-01-04 14:23:23 +0100 |
commit | 57809f20a4a3624bfb50bd5bc881fe81db26c02c (patch) | |
tree | ac7af255b8a85b244dd1d10bf5b2e8c26836babd /mod/profiles.php | |
parent | 386f361855663b445d1497bbbabcf87891ce94d9 (diff) | |
parent | 9433a0ddc8926cc483521e97ae911d2eb82c91f6 (diff) | |
download | volse-hubzilla-57809f20a4a3624bfb50bd5bc881fe81db26c02c.tar.gz volse-hubzilla-57809f20a4a3624bfb50bd5bc881fe81db26c02c.tar.bz2 volse-hubzilla-57809f20a4a3624bfb50bd5bc881fe81db26c02c.zip |
Sorting of autocomplete
Diffstat (limited to 'mod/profiles.php')
-rw-r--r-- | mod/profiles.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/mod/profiles.php b/mod/profiles.php index 6bdc7f11a..fa6a6e35c 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -11,7 +11,7 @@ function profiles_init(&$a) { if((argc() > 2) && (argv(1) === "drop") && intval(argv(2))) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1", - intval($a->argv[2]), + intval(argv(2)), intval(local_user()) ); if(! count($r)) { @@ -159,9 +159,13 @@ function profiles_init(&$a) { if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) { if(feature_enabled(local_user(),'multi_profiles')) $id = $a->argv[1]; - else - $id = q("select id from profile where uid = %d and is_default = 1",local_user())[0]['id']; - + else { + $x = q("select id from profile where uid = %d and is_default = 1", + intval(local_user()) + ); + if($x) + $id = $x[0]['id']; + } $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($id), intval(local_user()) @@ -564,9 +568,13 @@ function profiles_content(&$a) { if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) { if(feature_enabled(local_user(),'multi_profiles')) $id = $a->argv[1]; - else - $id = q("select id from profile where uid = %d and is_default = 1",local_user())[0]['id']; - + else { + $x = q("select id from profile where uid = %d and is_default = 1", + intval(local_user()) + ); + if($x) + $id = $x[0]['id']; + } $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($id), intval(local_user()) |