add 'author_is_pmable()' function with plugin hooks to control whether or not to display a 'send mail' link in the thread author menu.
This commit is contained in:
@@ -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']))
|
||||
|
||||
Reference in New Issue
Block a user