diff options
author | friendica <info@friendica.com> | 2014-07-29 19:26:17 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-07-29 19:26:17 -0700 |
commit | 60e7837f00070508f9ea9672f4812e95d644f70b (patch) | |
tree | 2e0e2ce069984c95d7cb8a2f3b641b2e13221ac1 /mod/connedit.php | |
parent | a1ffb5ee724e6879f3b24708d70b808c4438e2fc (diff) | |
download | volse-hubzilla-60e7837f00070508f9ea9672f4812e95d644f70b.tar.gz volse-hubzilla-60e7837f00070508f9ea9672f4812e95d644f70b.tar.bz2 volse-hubzilla-60e7837f00070508f9ea9672f4812e95d644f70b.zip |
implement the new friend activity post which has been missing for some time now
Diffstat (limited to 'mod/connedit.php')
-rw-r--r-- | mod/connedit.php | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/mod/connedit.php b/mod/connedit.php index b9f0299e2..64b707433 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -118,13 +118,14 @@ function connedit_post(&$a) { intval(local_user()) ); - if($orig_record[0]['abook_profile'] != $profile_id) { //Update profile photo permissions + if($orig_record[0]['abook_profile'] != $profile_id) { + //Update profile photo permissions - logger('As a new profile was assigned updateing profile photos'); - require_once('mod/profile_photo.php'); - profile_photo_set_profile_perms($profile_id); + logger('As a new profile was assigned updateing profile photos'); + require_once('mod/profile_photo.php'); + profile_photo_set_profile_perms($profile_id); - } + } if($r) @@ -147,12 +148,55 @@ function connedit_post(&$a) { group_add_member(local_user(),'',$a->poi['abook_xchan'],$g['id']); } - - // Check if settings permit ("post new friend activity" is allowed, and // friends in general or this friend in particular aren't hidden) // and send out a new friend activity - // TODO + + $pr = q("select * from profile where uid = %d and is_default = 1 and hide_friends = 0", + intval($channel['channel_id']) + ); + if(($pr) && (! ($abook_flags & ABOOK_FLAG_HIDDEN)) + && (intval(get_pconfig($channel['channel_id'],'system','post_newfriend')))) { + $objtype = ACTIVITY_OBJ_PERSON; + $t = q("select * from abook left join xchan on xchan_hash = abook_xchan where abook_id = %d and abook_channel = %d limit 1", + intval($a->poi['abook_id']), + intval($channel['channel_id']) + ); + if($t) { + $xarr = array(); + $xarr['verb'] = ACTIVITY_FRIEND; + $xarr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; + $xarr['owner_xchan'] = $xarr['author_xchan'] = $channel['channel_hash']; + $xarr['allow_cid'] = $channel['channel_allow_cid']; + $xarr['allow_gid'] = $channel['channel_allow_gid']; + $xarr['deny_cid'] = $channel['channel_deny_cid']; + $xarr['deny_gid'] = $channel['channel_deny_gid']; + $xarr['item_private'] = (($xarr['allow_cid']||$xarr['allow_gid']||$xarr['deny_cid']||$xarr['deny_gid']) ? 1 : 0); + + + $obj = array( + 'type' => ACTIVITY_OBJ_PERSON, + 'title' => $t[0]['xchan_name'], + 'id' => $t[0]['xchan_hash'], + 'link' => array( + array('rel' => 'alternate', 'type' => 'text/html', 'href' => $t[0]['xchan_url']), + array('rel' => 'photo', 'type' => $t[0]['xchan_photo_mimetype'], 'href' => $t[0]['xchan_photo_l']) + ), + ); + $xarr['object'] = json_encode($obj); + $xarr['obj_type'] = ACTIVITY_OBJ_PERSON; + + + $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . $t[0]['xchan_url'] . ']' . $t[0]['xchan_name'] . '[/zrl]'; + + $xarr['body'] .= "\n\n\n" . '[zrl=' . $t[0]['xchan_url'] . '][zmg=80x80]' . $t[0]['xchan_photo_m'] . '[/zmg][/zrl]'; + + post_activity_item($xarr); + + } + + } + // pull in a bit of content if there is any to pull in proc_run('php','include/onepoll.php',$contact_id); |