It would be really handy to be able to have a message that replaces the registration button with something like "You have already registered for this event" once a user is already registered.

Comments

rudiedirkx’s picture

There is a message for that. You can theme it by overriding node-registration-message-registered.tpl.php or preprocessing node_registration_message_registered().

Actually.., what "registration button" are you talking about?

iaminawe’s picture

Sorry I mean for the registration link or form - once clicked and a user is registered when they visit the node again or are redirected back to it - the registration form or link is hidden as it it should be.

My question was instead of just hiding it - would it be possible to add a "You have already registered for this event" message where the link/form originally was.

rudiedirkx’s picture

There's a Views field for that. Do you mean in a View? There's also a block that can contain that message. The node field (link) can't I think... That's the one you want? =)

Should be easy enough to make. You make it, I include it? =)

DanielWashbrook’s picture

I'm game to write it. Was looking for an easy way to tell if a user is registered for an event. Any thoughts?

Thanks for the module btw, tons of great features!

rudiedirkx’s picture

It depends on how you want to show it. You can do a lot with Views only. Create a block with the current user (uid) and current node (nid) as arguments to get the current user's registration(s) for the current page/node. You can have that View show anything, even a 'No results behavior'.

It's still not a node field though... If you want that you'll need hook_field_extra_fields() (or something) and use Node Registration functions like _node_registration_user_registered($node, $user). You can steal from node_registration_entity_view().

o.feldmanis’s picture

I am lost right now. How to get the "Already registered" and other error messages for the user. What block is used for this?

rudiedirkx’s picture

The normal messages are shown in the register form block if you don't have access (or another reason) AND have the checkboxes checked (default on). You can do (some) custom messages with a Views block. You can do all kinds of messages with a custom block (obviously), but that requires a custom module and coding.

Does that help any?

o.feldmanis’s picture

I have access (administrator) and have the check-boxes checked. Also I have included all the blocks from the node registration (Node registration: link to this page's form, Node registration: the cancel registration form for this page, Node registration: this page's form) none of them show any messages, error or confirmation.

I have searched through code for 'show_message_registered' or 'registration_success_message'. It is only saved, never called.

... maybe I am missing something?

rudiedirkx’s picture

If you're debugging, this is where the checkboxes are used: http://drupalcode.org/project/node_registration.git/blob/refs/heads/7.x-... Let me know what you find.

rudiedirkx’s picture

Also, try:

N.B. If you can't register or don't see the link/form, you can add ?debug=1 to the URL and the reason will be saved into the watchdog table. It might be a date, a permission, a status etc. The watchdog message will tell.

Relevant code starts at http://drupalcode.org/project/node_registration.git/blob/refs/heads/7.x-...

o.feldmanis’s picture

First I wanted to thank you for your quick responses!

I have found a solution, and (as always) it was my fault all along.

I made a custom theme from scratch and have forgotten to include the status messages in the theme!

As soon as I included the $messages in the page.tpl everything worked as it should.
It was nothing wrong with node registration all along.

Thank you, and sorry for the trouble :)

rudiedirkx’s picture

Status: Active » Closed (works as designed)

Haha no problem. Ciao

lucavox’s picture

Issue summary: View changes

I hide from my content type all the details.
 And I created this view (block type).

If it could be useful

$view = new view();
$view->name = 'adesioni';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'adesioni';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'adesioni';
$handler->display->display_options['css_class'] = 'alert-box alert';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Node registration: Registrations */
$handler->display->display_options['relationships']['node_registration_rel']['id'] = 'node_registration_rel';
$handler->display->display_options['relationships']['node_registration_rel']['table'] = 'node';
$handler->display->display_options['relationships']['node_registration_rel']['field'] = 'node_registration_rel';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['exclude'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_node'] = FALSE;
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = '';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE;
/* Field: Node registration: User uid */
$handler->display->display_options['fields']['uid']['id'] = 'uid';
$handler->display->display_options['fields']['uid']['table'] = 'node_registration';
$handler->display->display_options['fields']['uid']['field'] = 'uid';
$handler->display->display_options['fields']['uid']['relationship'] = 'node_registration_rel';
$handler->display->display_options['fields']['uid']['label'] = '';
$handler->display->display_options['fields']['uid']['exclude'] = TRUE;
$handler->display->display_options['fields']['uid']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['uid']['link_to_user'] = FALSE;
/* Field: Content: Available slots */
$handler->display->display_options['fields']['registration_available_slots']['id'] = 'registration_available_slots';
$handler->display->display_options['fields']['registration_available_slots']['table'] = 'node';
$handler->display->display_options['fields']['registration_available_slots']['field'] = 'registration_available_slots';
$handler->display->display_options['fields']['registration_available_slots']['label'] = 'Posti Disponibili';
/* Field: Content: Used slots */
$handler->display->display_options['fields']['registration_used_slots']['id'] = 'registration_used_slots';
$handler->display->display_options['fields']['registration_used_slots']['table'] = 'node';
$handler->display->display_options['fields']['registration_used_slots']['field'] = 'registration_used_slots';
$handler->display->display_options['fields']['registration_used_slots']['label'] = 'AUTOMATIC';
$handler->display->display_options['fields']['registration_used_slots']['exclude'] = TRUE;
/* Field: Global: PHP */
$handler->display->display_options['fields']['php']['id'] = 'php';
$handler->display->display_options['fields']['php']['table'] = 'views';
$handler->display->display_options['fields']['php']['field'] = 'php';
$handler->display->display_options['fields']['php']['label'] = '';
$handler->display->display_options['fields']['php']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['php']['use_php_setup'] = 0;
$handler->display->display_options['fields']['php']['php_output'] = '<?php
global $user; 
global $language ;
$lang_name = $language->language ;
If ($user->uid==$row->uid) {
 
    echo ("you are already registered at $row->title"); 
     
} else {
 
   ?> 
<a href="<?php echo $base_url . base_path() . $lang_name . \'/node/\' . $row->nid . \'/register\' ; ?>">Join US at <?php print $row->title; ?></a>
<?php
}  
 ?>';
$handler->display->display_options['fields']['php']['use_php_click_sortable'] = '0';
$handler->display->display_options['fields']['php']['php_click_sortable'] = '';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Global: Null */
$handler->display->display_options['arguments']['null']['id'] = 'null';
$handler->display->display_options['arguments']['null']['table'] = 'views';
$handler->display->display_options['arguments']['null']['field'] = 'null';
$handler->display->display_options['arguments']['null']['default_action'] = 'default';
$handler->display->display_options['arguments']['null']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['null']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['null']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['null']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Node registration: Verified */
$handler->display->display_options['filters']['verified']['id'] = 'verified';
$handler->display->display_options['filters']['verified']['table'] = 'node_registration';
$handler->display->display_options['filters']['verified']['field'] = 'verified';
$handler->display->display_options['filters']['verified']['relationship'] = 'node_registration_rel';
$handler->display->display_options['filters']['verified']['value'] = '1';

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$translatables['adesioni'] = array(
  t('Master'),
  t('adesioni'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Registrations'),
  t('Posti Disponibili'),
  t('AUTOMATIC'),
  t('.'),
  t(','),
  t('All'),
  t('Block'),
);