0

In the control panel, you can set channels access for users.

In the frontend, I want to get the channels data a user has access to and the fields data it can view.

I am not talking about the channel entries data. I am talking about the channel data themselves.

Is there a way to get this information? Are there addons for these feature?

1

You will have to run a query to get the data. You should be able to run the following against the member_group field of the member.

SELECT exp_channels.channel_title, exp_channel_fields.field_label, exp_channel_fields.field_name, exp_channel_fields.field_type, exp_channel_member_groups.channel_id FROM exp_channels, exp_channel_fields, exp_channel_member_groups WHERE exp_channel_member_groups.group_id = '6' AND exp_channel_member_groups.channel_id = exp_channels.channel_id AND exp_channels.field_group = exp_channel_fields.group_id

So in EE, run a exp:query like this maybe: (Should at least get you going)

Member Group : {member_group}<br>

<table>
<thead>
    <tr>
        <th>Channel</th>
        <th>Field</th>
        <th>Type</th>
    <tr>
</thead>
<tbody>
        {exp:query sql="
            SELECT channel_title, field_label, field_name, field_type
                FROM exp_channels a
                JOIN exp_channel_member_groups b on b.channel_id = a.channel_id
                JOIN exp_channel_fields c on c.group_id = a.field_group
                WHERE b.group_id = '7'
        "}
            <tr>
                <td>{channel_title}</td>
                <td>{field_label} - {field_name}</td>
                <td>{field_type}</td>
            </tr>
        {/exp:query}
    </tbody>
</table>

Of course, you'll have to figure a way to get your member's {group_id} into where '7' is now.

2
  • What about the fields? Viewing of the fields can be limited by member group, right? Oct 8 '13 at 21:49
  • Yes. You would just need to join the tables you need and render out the results.
    – W3bGuy
    Oct 14 '13 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.