Commit 7c363310 authored by Zot's avatar Zot Committed by Mario
Browse files

add 'can_comment_on_post' hook so we can better deal with the complications of Diaspora policy

parent 36cfdd52
Called when deciding whether or not to display a comment box for a post.
Hook data (array):
observer_hash => xchan_hash of current observer
item => posted item
allowed => 'unset'
To over-ride the default behaviour, change allowed to true or false
......@@ -82,6 +82,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
Called when creating the HTML page header
Called when deciding whether or not to present a comment box for a post
Called when logging in to a channel (either during login or afterward through the channel manager)
......@@ -219,6 +219,11 @@ function can_comment_on_post($observer_xchan, $item) {
// logger('can_comment_on_post: comment_policy: ' . $item['comment_policy'], LOGGER_DEBUG);
$x = [ 'observer_hash' => $observer_xchan, 'item' => $item, 'allowed' => 'unset' ];
if($x['allowed'] !== 'unset')
return $x['allowed'];
if(! $observer_xchan)
return false;
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