Allow comments

2 views
Skip to first unread message

Melissa

unread,
Nov 12, 2009, 11:48:55 AM11/12/09
to Reason Discussion
Hello all,

We'd like to disable comments for all blog/publication types either
globally or (ideally) on a site by site basis at the admin level.
Anyone have any thoughts on how to go about doing this?

Melissa

Nathan White

unread,
Nov 12, 2009, 1:11:45 PM11/12/09
to reason-d...@googlegroups.com
Hi Melissa -

I think what you'd probably want to do is to make a custom version of the publication content manager. In that custom version, you can set comments to be off by default, and make the field visible only to administrators. Then only you and Matt would be able to change that setting on a blog.

I don't think we have any online resources about creating a custom content manager so ... Matt Ryan is going to work on one and we'll post it within a week or so. Here is the broad outline:

First you would create a file in your local area that extends the existing blog.php content manager - call the class BeloitBlogManager or something, and the file beloit_blog.php.

In your BeloitBlogManager class you want to overload the method alter_data() - it should first call parent::alter_data() to do the normal customizations of the original content manager, and then do its customizations to the comment element(s). You probably want to check if the element allow_comments has a value, and if not, set its value to "false".

You can check if the logged in user has privileges for advanced options like this:

if(reason_user_has_privs( $this->admin_page->user_id, 'edit_form_advanced_options'))

If the user does not have that privilege (and thus is not an admin), you probably want to change the comment fields to be hidden using the change_element_type disco method.

After you've setup your custom content manager, you go to the Master Admin site and edit the "Blog" Type. You should then see your custom content manager in the list of content manager options and you can select it. The result should be something where comments default to being turned off and non-admin users do not have the ability to change that option.

Nate
Reply all
Reply to author
Forward
0 new messages