diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-31 18:14:12 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-31 18:14:12 -0700 |
commit | 35debe46bc0a10f3bad21303e127cb29526c94a2 (patch) | |
tree | 2ee19f349bca4015cbb860f8a48338f23a97db25 | |
parent | 98c18f416a4c809059f4cdf27a833bb9b1134280 (diff) | |
download | volse-hubzilla-35debe46bc0a10f3bad21303e127cb29526c94a2.tar.gz volse-hubzilla-35debe46bc0a10f3bad21303e127cb29526c94a2.tar.bz2 volse-hubzilla-35debe46bc0a10f3bad21303e127cb29526c94a2.zip |
a slight tweak to author_is_pmable hook to make it useful
-rw-r--r-- | doc/hook/author_is_pmable.bb | 2 | ||||
-rw-r--r-- | include/conversation.php | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/doc/hook/author_is_pmable.bb b/doc/hook/author_is_pmable.bb index 708350673..11d1185f3 100644 --- a/doc/hook/author_is_pmable.bb +++ b/doc/hook/author_is_pmable.bb @@ -6,7 +6,7 @@ By default author_is_pmable() returns true for 'zot' xchans, and false for all o The plugin is passed an array - [ 'xchan' => $author_xchan, 'result' => 'unset' ] + [ 'xchan' => $author_xchan, 'abook' => abook record, 'result' => 'unset' ] A plugin which sets the 'result' to something besides 'unset' will over-ride the default behaviour. A value of true will enable the 'send mail' link and the private mail recipient will be set to the author's xchan_hash. A value of false will disable the 'send mail' link. diff --git a/include/conversation.php b/include/conversation.php index b6832e22c..3f9ee5cfa 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -909,9 +909,9 @@ function thread_action_menu($item,$mode = '') { } -function author_is_pmable($xchan) { +function author_is_pmable($xchan, $abook) { - $x = [ 'xchan' => $xchan, 'result' => 'unset' ]; + $x = [ 'xchan' => $xchan, 'abook' => $abook, 'result' => 'unset' ]; call_hooks('author_is_pmable',$x); if($x['result'] !== 'unset') return $x['result']; @@ -941,7 +941,7 @@ function thread_author_menu($item, $mode = '') { } $profile_link = chanlink_hash($item['author_xchan']); - + $contact = false; if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts)) $contact = App::$contacts[$item['author_xchan']]; @@ -950,9 +950,9 @@ function thread_author_menu($item, $mode = '') { $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']); - if($item['uid'] > 0 && author_is_pmable($item['author'])) + if($item['uid'] > 0 && author_is_pmable($item['author'],$contact)) { $pm_url = z_root() . '/mail/new/?f=&hash=' . urlencode($item['author_xchan']); - + } if($contact) { |