Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hubzilla
core
Commits
7c363310
Commit
7c363310
authored
Jun 12, 2017
by
Zot
Committed by
Mario
Jun 14, 2017
Browse files
add 'can_comment_on_post' hook so we can better deal with the complications of Diaspora policy
parent
36cfdd52
Changes
3
Hide whitespace changes
Inline
Side-by-side
doc/hook/can_comment_on_post.bb
0 → 100644
View file @
7c363310
[h3]can_comment_on_post[/h3]
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
doc/hooklist.bb
View file @
7c363310
...
...
@@ -82,6 +82,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/build_pagehead]build_pagehead[/zrl]
Called when creating the HTML page header
[zrl=[baseurl]/help/hook/can_comment_on_post]can_comment_on_post[/zrl]
Called when deciding whether or not to present a comment box for a post
[zrl=[baseurl]/help/hook/change_channel]change_channel[/zrl]
Called when logging in to a channel (either during login or afterward through the channel manager)
...
...
include/items.php
View file @
7c363310
...
...
@@ -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'
];
call_hooks
(
'can_comment_on_post'
,
$x
);
if
(
$x
[
'allowed'
]
!==
'unset'
)
return
$x
[
'allowed'
];
if
(
!
$observer_xchan
)
return
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment