diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-27 15:49:48 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-03-27 15:49:48 -0700 |
commit | 3e6088c6142d1dabbfdbb8b5df276ae942bd3554 (patch) | |
tree | 05085058a954dca5ecbc8c982c04f5e1f052a305 /include | |
parent | 8292553a2087a412e0b10f5593d461d371169adb (diff) | |
download | volse-hubzilla-3e6088c6142d1dabbfdbb8b5df276ae942bd3554.tar.gz volse-hubzilla-3e6088c6142d1dabbfdbb8b5df276ae942bd3554.tar.bz2 volse-hubzilla-3e6088c6142d1dabbfdbb8b5df276ae942bd3554.zip |
add 'author_is_pmable()' function with plugin hooks to control whether or not to display a 'send mail' link in the thread author menu.
Diffstat (limited to 'include')
-rw-r--r-- | include/conversation.php | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/include/conversation.php b/include/conversation.php index b4f959afa..5b2d60583 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -917,6 +917,24 @@ function thread_action_menu($item,$mode = '') { } +function author_is_pmable($xchan) { + + $x = [ 'xchan' => $xchan, 'result' => 'unset' ]; + call_hooks('author_is_pmable',$x); + if($x['result'] !== 'unset') + return $x['result']; + + if($xchan['xchan_network'] === 'zot') + return true; + return false; + +} + + + + + + function thread_author_menu($item, $mode = '') { $menu = []; @@ -932,8 +950,6 @@ function thread_author_menu($item, $mode = '') { $profile_link = chanlink_hash($item['author_xchan']); - if($item['uid'] > 0) - $pm_url = z_root() . '/mail/new/?f=&hash=' . urlencode($item['author_xchan']); if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts)) $contact = App::$contacts[$item['author_xchan']]; @@ -941,6 +957,12 @@ function thread_author_menu($item, $mode = '') { if($local_channel && $item['author']['xchan_addr']) $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']); + + if($item['uid'] > 0 && author_is_pmable($item['author'])) + $pm_url = z_root() . '/mail/new/?f=&hash=' . urlencode($item['author_xchan']); + + + if($contact) { $poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id']; if (! intval($contact['abook_self'])) |