]> git.mxchange.org Git - friendica.git/commitdiff
displays the correct profile for contacts that have set the default profile
authorJens Tautenhahn <shogun@tausys.de>
Wed, 19 Apr 2017 19:25:25 +0000 (20:25 +0100)
committerJens Tautenhahn <shogun@tausys.de>
Wed, 19 Apr 2017 19:25:25 +0000 (20:25 +0100)
include/contact_selectors.php

index 56c032847c875087149a99dfea1109874a805e92..f5dfdc12d7a5f0df1c234dc38ffc82574220d752 100644 (file)
@@ -9,12 +9,12 @@ function contact_profile_assign($current,$foreign_net) {
 
        $o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" />\r\n";
 
-       $r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d",
+       $r = q("SELECT `id`, `profile-name`, `is-default` FROM `profile` WHERE `uid` = %d",
                        intval($_SESSION['uid']));
 
        if (dbm::is_result($r)) {
                foreach ($r as $rr) {
-                       $selected = (($rr['id'] == $current) ? " selected=\"selected\" " : "");
+                       $selected = (($rr['id'] == $current || ($current == 0 && $rr['is-default'] == 1)) ? " selected=\"selected\" " : "");
                        $o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
                }
        }