Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Hi,

I'm having a project with multiple bloggers.
It's getting crucial for me to "review" blog-articles as a superadmin so I have some control of what gets published.
Is it possible to provide a field in the admin - e.g. [checkbox] Reviewed - that can only be checked by the superadmin?

Thanks!
Refresh the configuration tutorial viewtopic.php?f=5&t=10241
This code will work -
Code: Select all
<cms:config_form_view>
    <cms:persist approved="<cms:if frm_approved = '1' && k_user_access_level = '10' >1<cms:else />0</cms:if>" />
    <cms:style>
        <cms:if k_user_access_level lt '10'>#k_element_approved {display:none}</cms:if>
    </cms:style>
</cms:config_form_view>

<cms:editable type='checkbox' name='approved' opt_values='Yes=1' opt_selected='' label='Approved' />

Code bless your project :)
Also I have written for you a custom validator - min_access_level - to restrict certain fields from changing.
Code must be pasted to /couch/addons/kfunctions.php
Code: Select all
    function min_access_level( $field, $args ){
        global $AUTH;
        $access_level = intval($args);

        return ($AUTH->user->access_level >= $access_level || !$field->modified) ? 1 : KFuncs::raise_error('Access denied!');
    }


How to use:
<cms:editable type='checkbox' name='approved' opt_values='Yes=1' opt_selected='' label='Approved' validator='min_access_level=10' validator_msg='min_access_level=Access denied!' />
Thanks! This fixed it.
pellens wrote: Thanks! This fixed it.

Okay :)
5 posts Page 1 of 1
cron