diff options
-rw-r--r-- | include/dir_fns.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php index be1bcd503..2444e29ce 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -39,6 +39,26 @@ function syncdirs($uid) { $profile['keywords'] = $tags; } + $hidden = (1 - intval($p[0]['publish'])); + + $r = q("select xchan_flags from xchan where xchan_hash = '%s' limit 1", + dbesc($p[0]['channel_hash']) + ); + + // Be careful - XCHAN_FLAGS_HIDDEN should evaluate to 1 + if(($r[0]['xchan_flags'] & XCHAN_FLAGS_HIDDEN) != $hidden) + $new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_HIDDEN; + else + $new_flags = $r[0]['xchan_flags']; + + if($new_flags != $r[0]['xchan_flags']) { + $r = q("update xchan set xchan_flags = %d where xchan_hash = '%s' limit 1", + intval($new_flags), + dbesc($xchan_hash) + ); + } + + if(perm_is_allowed($uid,'','view_profile')) { import_directory_profile($hash,$profile); |