1

I seek help on how to display the signup's module info in a custom node template.

I have created a node template for a specific content type, but by looking the variables inside $content I cannot seem to find something useful. There are several signup variables but not one "central" that can print the whole signup info. Plus the signup variables change whether the signups for the specific event are closed or open. I was hoping to be able to use something like print render($content['signup']) but that doesn't seem possible.

I have already asked help on the module's queue but without any luck. I have found several similar problems but some of the are really old versions and others refer on views integration.

Reference:

I have searched a lot but I am still unaware how I can include the signup info into my node template. With so many people usually templating their nodes I am weird how the solution to this problem is not available.

I would appreciate any help to the right direction. Is there anything I can test out?

  • are you on drupal 6 or 7? – Mohammed Shameem Jan 18 '13 at 13:04
  • Sorry forgot to mention it. Its drupal 7. – Perisdr Jan 19 '13 at 14:20
  • Are you trying to print the signup form in a node template (such as node--type.tpl.php) or in a View (as in the Views module)? If the .tpl is where you're trying to print, install the devel module (drupal.org/project/devel) and put the following code at the top of your node .tpl: <?php dpm($node); ?>. Then refresh the node twice and you should see a breakdown of the different variables available to you, displayed in the messages region of your theme. – Charlie Schliesser Feb 5 '13 at 17:06
  • As you said I am trying to print in a node template. I have already done what you suggested but as I explained in my question, signup has a lot of variables exposed in the node. Its not as simple as doing print render($content['signup']). Moreover the signup variables change depending whether the event is open for registration or not. I was hoping for a variable that would wrap all this info and allow me to print signup form but either I am missing something or this can't be done and I need to implement the logic of the signup form by myself. – Perisdr Feb 6 '13 at 11:21
1
+50

You can always built your own module and implement a hook_node_view() and put this form into the node content like:

function YOURMODULE_node_view($node, $view_mode, $langcode) {
 $node->content['signup_form'] = array(
  '#item'     => 'item',
  '#markup' => render(drupal_get_form('this forms ID')),
  '#theme' => 'my_signup_form_theme' //optional
 );
}

And to get even more configurable and cool-looking you could insert this new piece of content to the "Display fields" drag and drop form of the respective content type with

 hook_extra_fields()

like:

function YOURMODULE_field_extra_fields() {
    $extra['node']['node-TYPE']['display'] = array(
         'signup_form' => array(
            'label' => t('SignUp form'),
            'description' => t('SignUp form imported to Node Content'),
            'weight' => 10,
         ),
}

And now you have

$node->content['signup_form'] 

in your tpl

  • It's important to mention that with this aproach he will have to manage/validate the form submitions and also do all the job for storing/restoring the data with custom code and a custom table too. I'm not saying this is wrong. It's easier in some cases. I'm just saying that it's important to have this in mind. – revagomes Feb 6 '13 at 19:24
  • No, we dont have to manage anything. We get the whole form, we dont alter its submission handlers or validators.It will be submitted normally,... if its a normal form anyways... – Pan Chrono Feb 7 '13 at 8:08
  • I got it. I tought that you was suggesting to build a custom form using the Form API (api.drupal.org/api/drupal/…) but you was talking about the one implemented by the signup form module. right? – revagomes Feb 7 '13 at 13:01
  • yes correct, we get the complete/ready form – Pan Chrono Feb 7 '13 at 14:49
  • This seems really helpful. I still have some worries since signup doesn't always create a form (e.g if you are not logged in) but maybe even this markup is still controlled by the signup form. I will need to test it. I am awarding you with the bounty and I 'll comment later on my results. – Perisdr Feb 11 '13 at 8:44
0

I'm not used to the signup module but AFAIK you can also achieve this goal with the flag module + Rules for authenticated users. As you can see here the Subscribe button on d.o issue queue was made using this approach.

Here is an issue that may help you.

There is also a sandbox (Flag Signup) that already implements signup using Flags

For anonymous users I think you can do this using Webform Block so you will be able to insert the form on node templates and maybe using tokens or with a little work using hook_form_alter you can auto fill some fields with the node information. Later you can use the Webform Rules module to catch webform submissions.

Sorry if I misunderstood your question, but I think it should work.

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.