Powered by MediaWiki
Personal tools

Tag item can comment

From b2evolution manual

Jump to: navigation, search

This template tag checks if user can leave comment on this post or display error.

[edit] Example

$Item->can_comment( $before_error = '<p><em>', $after_error = '</em></p>', $non_published_msg = '#', $closed_msg = '#' ); 
// Result: Comments are closed for this post.
 
$Item->can_comment( '<p><em>', '</em></p>', 'Comments are closed for this post, because it is not published yet.', '#' );
// Result: Comments are closed for this post, because it is not published yet.

[edit] Parameters

Name Default Usage
before_error '<p><em>' String to display before any error message; NULL to not display anything, but just return boolean.
after_error '</em></p>' String string to display after any error message.
non_published_msg '#' String error message for non published posts, '#' for default.
closed_msg '#' String error message for closed comments posts, '#' for default.

[edit] Return value

This function return true, if user can leave comment on this post.
If user can't leave comment then this function return false and displays error.