Commit 324d427a authored by Zot's avatar Zot Committed by Mario
Browse files

a slight tweak to author_is_pmable hook to make it useful

parent 84c04cfe
......@@ -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.
......
......@@ -917,9 +917,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'];
......@@ -949,7 +949,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']];
......@@ -958,9 +958,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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment