hide some contacts from others

This commit is contained in:
friendica 2011-12-05 18:36:26 -08:00
parent d2e110abf5
commit 47f369e052
4 changed files with 13 additions and 6 deletions

View file

@ -78,6 +78,7 @@ function contacts_post(&$a) {
} }
} }
$hidden = intval($_POST['hidden']);
$priority = intval($_POST['poll']); $priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0) if($priority > 5 || $priority < 0)
@ -85,11 +86,12 @@ function contacts_post(&$a) {
$info = escape_tags(trim($_POST['info'])); $info = escape_tags(trim($_POST['info']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s' $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
WHERE `id` = %d AND `uid` = %d LIMIT 1", `hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id), intval($profile_id),
intval($priority), intval($priority),
dbesc($info), dbesc($info),
intval($hidden),
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
@ -334,6 +336,7 @@ function contacts_content(&$a) {
'$info' => $contact['info'], '$info' => $contact['info'],
'$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
'$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
'$photo' => $contact['photo'], '$photo' => $contact['photo'],
'$name' => $contact['name'], '$name' => $contact['name'],
'$dir_icon' => $dir_icon, '$dir_icon' => $dir_icon,

View file

@ -67,6 +67,8 @@ function follow_post(&$a) {
} }
$writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0); $writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
if($ret['network'] === NETWORK_MAIL) { if($ret['network'] === NETWORK_MAIL) {
$writeable = 1; $writeable = 1;
@ -101,8 +103,8 @@ function follow_post(&$a) {
// create contact record // create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `writable`, `hidden`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0 ) ",
intval(local_user()), intval(local_user()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($ret['url']), dbesc($ret['url']),
@ -120,7 +122,8 @@ function follow_post(&$a) {
dbesc($ret['pubkey']), dbesc($ret['pubkey']),
intval($new_relation), intval($new_relation),
intval($ret['priority']), intval($ret['priority']),
intval($writeable) intval($writeable),
intval($hidden)
); );
} }

View file

@ -59,7 +59,7 @@
{{ endif }} {{ endif }}
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>
{{inc field_checkbox.tpl with $field=$hidden }}{{endinc}}
<div id="contact-edit-info-wrapper"> <div id="contact-edit-info-wrapper">
<h4>$lbl_info1</h4> <h4>$lbl_info1</h4>

View file

@ -1461,6 +1461,7 @@ input#dfrn-url {
#contact-edit-end { #contact-edit-end {
clear: both; clear: both;
margin-top: 15px;
} }
#contact-profile-selector { #contact-profile-selector {