0

I am building a site with a course content type. Users can only view some of the course details (such as date, location and description) unless they are registered on the course. Once registered their is certain webforms and file downloads related to the course which they can access too.

A company admin user (sponsor) should be able to access specific courses, and if they have access to a course they can invite people (delegates) to register on the course. Basically each individual course is by invite only.

I'm a little confused as to how to build this. I assume Organic Groups, and/or Entity Registration may be the right direction, but I've never actually used either Module. Does anybody have any suggestions on how I can build this? Which Modules should I use and does anybody have any tutorials or references which may help in this specific area?

  • when you say users are they registered users? – Mohammed Shameem Sep 7 '13 at 15:18
  • I'd think that would be the only (and correct way) yes. – Rick Donohoe Sep 7 '13 at 16:49
  • Are you using any node registration module for this purpose? – Mohammed Shameem Sep 9 '13 at 8:29
  • I've installed Entity Registration but not really sure how to configure it. Is that the best module? What is and where is the best tutorials to read up on? Have you read my comments to the current answers on this page? – Rick Donohoe Sep 9 '13 at 10:16
2

You need to use Field Permissions module, with the help of this module you can do your stuff. Which allows site administrators to set field-level permissions to edit, view and create fields on any entity. With this module you can hide the certain node field to anonymous user.

enter image description here

  • Enable field permissions on any entity, not just nodes.
  • Role-based field permissions allowing different viewing patterned based on what access the user has.
  • Author-level permissions allow viewing and editing of fields based on who the entity owner is.
  • Permissions for each field are not enabled by default. Instead, administrators can enable these permissions explicitly for the fields where this feature is needed.
| improve this answer | |
  • 1
    How can i relate this on a per-node basis? One delegate may only be able to register to one or 2 courses, not all on the site. – Rick Donohoe Sep 7 '13 at 18:01
  • You need to create separate content type and set permission for the fields. Actually it easy to do that, I know you are the beginner, try to learn the basic things before you start the project. You can do your stuff easily, once you learned everything. – Bala Sep 7 '13 at 18:16
  • 1
    I know my stuff, but i don't think you understand the use-case here. There may be say a 100 courses a year, surely that is 100 nodes of a single content type? The site admin may add a few a week, I can't expect them to set user permissions every time!! – Rick Donohoe Sep 7 '13 at 19:10
1

Bala's answer is right. Field Permission module is the right module to use. But if you do not want to use contrib module or did not understand how to use it, you can do such kind of functionality by overriding default node template.. Copy node.tpl.php file to your theme folder and rename it like node--NAMEOFYOURCONTENTTYPE.tpl.php. And write such kind of thing, for ex. :

<div>
    // Authenticated user can see
    <?php if(user_is_logged_in():): ?>
    <div class="bodyField">
    <?php print render($content['body']); ?>
    </div>
    <?php endif; ?>

    // Everyone can see
    <div class="anotherField">
    <?php print render($content['field_FIELDNAME']); ?>
    </div>

    // Authenticated user can see
    <?php if(user_is_logged_in()): ?>
    <div class="anotherField">
    <?php print render($content['field_FIELDNAME']); ?>
    </div>
    <?php endif; ?>
</div>
| improve this answer | |
  • What I was trying to say is if I wanted to hide a field to non-logged in users, then yes that is how I would do it, but I need to do this on a PER NODE BASIS!! Course is a content type, fields on each course can only be seen by users who have been invited to register for that course. They can't see these fields on any other courses. – Rick Donohoe Sep 8 '13 at 11:49
  • 1
    All the nodes which are belong to content type Course have same fields. That's why you can add all of your fields to that content type then override template file or use Field Permission module. Because node can not be created before you created content type. Sorry for my english) – xurshid29 Sep 8 '13 at 12:10
  • So what If I have a "Summary PDF" field as part of the content type. User A registers for Course A and B, but isn't allowed to register for Course C. I want User A to then access Summary PDF on Course A and B, but they shouldn't be able to access it on Course C. What then? Every single node will have different field permission settings!! – Rick Donohoe Sep 8 '13 at 12:32
  • OK, I understand what are you going to do.. But I do not have any idea how your users will be registered for your courses. But, for ex., I, as User A, have been invited to register the Course A and B, registered for those courses. And you add those nodes ids to custom table or some kind of storage then whenever I am opening your course You will have to get my user id from users object and get my nodes ids from that table, and if my nodes ids match with this node id you will show. – xurshid29 Sep 8 '13 at 12:55

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.