aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-27 15:49:48 -0700
committerMario Vavti <mario@mariovavti.com>2017-03-31 10:28:54 +0200
commitb2a51db14e61e3f742b4a0e11bcb22e5c6e12800 (patch)
treeea824a7610c7a414aef33597f613b812d5558cc6 /include
parent33ff7bf968b76593ee076ee54838e2bb27552803 (diff)
downloadvolse-hubzilla-b2a51db14e61e3f742b4a0e11bcb22e5c6e12800.tar.gz
volse-hubzilla-b2a51db14e61e3f742b4a0e11bcb22e5c6e12800.tar.bz2
volse-hubzilla-b2a51db14e61e3f742b4a0e11bcb22e5c6e12800.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.php26
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']))