Firstly, apologies if I'm being a moron and putting this in the wrong place. I'm a newbie and to me learning Drupal feels like digging a big hole and right now I've stuck an impenetrable steel floor with my project!
I'm trying to build a website for a new kind of language school where adult students can select classes they want to attend.
Right now I've made some rules so that:
1.) The head-teacher schedules a class by creating a node (a content type called 'Create Class').
2.) Another node is automatically created (a content type called 'Class Results')
3.) This node is put into a view called 'View Classes'. Important: The students are not given access to see the content in this view!
Easy so far.
4.) The 'Create Class' content type is a webform. There is only information about the class and the submit button (renamed 'Choose Class').
5.) When a student clicks on that button three things happen:
(a) He/She is deducted 8000 Todgers (this is the working title of the virtual currency of the school (my 2nd name's Hodge))
(b) He/She is sent an email with the class info on.
(c) He/She are granted access to see that particular 'Class Results' page in the 'View Classes' view <......completely clueless here>
I hope I'm making some sense here. I'm in way over my head with this. Any advice would be much appreciated. Even just a "You're barking up the wrong tree!"
Thanks in advance.
EDIT: PS. I'm running Drupal 7.
Comments
Content Access
You probably want to use the Content Access module to manage these permissions. It is still a bit buggy when it comes to Rules integration and Drupal 7, but that's nothing that a good bug report can't fix. :-)
I just published a quick screencast on how to combine Flag, Rules and Content Access to have dynamic node access -- maybe it can be of some use to you: http://nodeone.se/blogg/learn-flag-with-nodeone-part-6-triggering-rules-...
If I were you I would also consider not using Webform, but have a node type instead. It will probably make it much easier to get the results of the submissions, and to integrate them with the rest of the site. Also have a look at the Node Access User Reference and Node Access Node Reference modules -- it sounds like they could be of use to you.
Got to run, so I can't be much more elaborate than this. Hope it will help you get started!
//Johan Falk, NodeOne, Sweden
Very kind of you to help me
Very kind of you to help me out.
You've given me lots of stuff to check out whereas before I was staring hopelessly at code which I know nothing of!
Thanks for the the Webform tip. I was aware that I wasn't using it for it's intended purpose (ie. a form)
Webform
My pleasure!
It is really tricky to know when to (not) use Webform. I know several discussions at my workplace, between very experienced Drupalistas, on this very topic. Usually the consensus is that you should use Webform when you need to create many one-off forms, and it is not feasible to use new node types for it.
Good luck!
//Johan Falk
Wicked advice! I watched your
Wicked advice!
I watched your screencast and decided to use Flag instead of Webform which is perfect because it also allows me to unpublish the class when it gets full up!
I installed Node Access User Reference and after fighting with code for ages I've finally managed to get it working. When the node is flagged, a rule is triggered that grants the user access to the page with the node id + 1: the results page that was automatically created when the class was created.
The rule executes a PHP script:
<?php$nid = [flagged_node:nid] + 1;
$node = node_load($nid);
$node->field_register = array(
'de' => array(
'0' => array(
'uid' => [flagging_user:uid],
),
),
);
node_save($node);
?>
Such a good feeling to get it working!