klox7 VIP
Total posts: 914
17 Dec 2014 14:08

Hi,

how can I achieve so that record info such as author, hits, created,... will be visible only to moderators or users with specific access level.

Regards

Last Modified: 25 Dec 2014


Sergey
Total posts: 13,748
19 Dec 2014 05:09

In a custom template what ever property you show or block of properties user

<?php if(MECAccess::allowRestricted(NULL, $this->section)):?>
    Name or buttons.
<?php endif; ?>

This will allow all moderators acces level, supermoderator and all created moderators with right to see restricted content to see this block.


klox7 VIP
Total posts: 914
19 Dec 2014 14:20

Sergey <?php if(MECAccess::allowRestricted(NULL, $this->section)):?> Name or buttons. <?php endif; ?>

This works only for moderators and not for "Access Level" in type parameters as sow below moderators


Sergey
Total posts: 13,748
22 Dec 2014 05:21

Ah! This parameter. Then likee this in full article view. In the list it is littel different. Where do you show this?

<?php if(MECAccess::allowRestricted(NULL, $this->section) || 
    in_array($this->type->params->get('properties.item_can_moderate'), $user->getAuthorisedViewLevels())):?>
    Name or buttons.
<?php endif; ?>

klox7 VIP
Total posts: 914
22 Dec 2014 09:54

Sergey Where do you show this?

In full and list.

And in full view I get this

Notice: Undefined variable: user in com_cobalt/views/record/tmpl/default_record_termespa_resort.php on line 130

Fatal error: Call to a member function getAuthorisedViewLevels() on a non-object in com_cobalt/views/record/tmpl/default_record_termespa_resort.php on line 130


Sergey
Total posts: 13,748
25 Dec 2014 14:08

In full view

<?php if(MECAccess::allowRestricted(NULL, $this->section) || 
    in_array($this->type->params->get('properties.item_can_moderate'), $this->user->getAuthorisedViewLevels())):?>
    Name or buttons.
<?php endif; ?>

in the list

<?php if(MECAccess::allowRestricted(NULL, $this->section) || 
    in_array($this->submission_types[$item->type_id]->params->get('properties.item_can_moderate'), $this->user->getAuthorisedViewLevels())):?>
    Name or buttons.
<?php endif; ?>
Powered by Cobalt