]> git.mxchange.org Git - friendica.git/commitdiff
Better handling of hidden profiles
authorMichael Vogel <icarus@dabo.de>
Wed, 4 May 2016 07:30:55 +0000 (09:30 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 4 May 2016 07:30:55 +0000 (09:30 +0200)
include/socgraph.php
mod/settings.php

index 0acd2793aa21e3351d8ceb365142d03da917d760..b2b84808b1fcdc7b4e7c9ab767324fa4c3a50ff5 100644 (file)
@@ -1535,6 +1535,7 @@ function update_gcontact($contact) {
 
        unset($fields["url"]);
        unset($fields["updated"]);
+       unset($fields["hide"]);
 
        // Bugfix: We had an error in the storing of keywords which lead to the "0"
        // This value is still transmitted via poco.
@@ -1549,6 +1550,11 @@ function update_gcontact($contact) {
                if (!isset($contact[$field]) OR ($contact[$field] == ""))
                        $contact[$field] = $r[0][$field];
 
+       if (!isset($contact["hide"]))
+               $contact["hide"] = $r[0]["hide"];
+
+       $fields["hide"] = $r[0]["hide"];
+
        if ($contact["network"] == NETWORK_STATUSNET)
                $contact["network"] = NETWORK_OSTATUS;
 
index c7659212bff242359a337e3e88b4cc4ef699d4a1..1a7905ef6455a9fe45809c01c72cc675b02e95cb 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 require_once('include/group.php');
+require_once('include/socgraph.php');
 
 function get_theme_config_file($theme){
        $a = get_app();
@@ -602,7 +603,7 @@ function settings_post(&$a) {
 
 
        if($name_change) {
-               q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1",
+               q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
                        dbesc($username),
                        dbesc(datetime_convert()),
                        intval(local_user())
@@ -617,6 +618,13 @@ function settings_post(&$a) {
 
        }
 
+       $r = q("SELECT `url` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
+       if ($r) {
+               $gcontact = array("name" => $username, "generation" => 1, "hide" => ($hidewall OR !$net_publish),
+                               "network" => NETWORK_DFRN, "url" => $r[0]["url"], "updated" => datetime_convert());
+
+               update_gcontact($gcontact);
+       }
 
        require_once('include/profile_update.php');
        profile_change();