Hello,
I am trying to configure Entity registration for a website where each user can register only himself and once per event. I want to keep the registration displayed as a form on the node.
By default, once a user is registered, the form is still visible (although clicking register will always yield an 'already registered' error).
In this case, it would be great to have an option to hide the form for registered users, or even better to display an already registered message instead.
Maybe this is implemented and I did not found it. Otherwise, is there any conceivable workaround?
I thank you in advance for your help. Best regards,
Thomas
Comment | File | Size | Author |
---|---|---|---|
#42 | already_registered_link_options-2085425-42.patch | 8.25 KB | nmillin |
#32 | already_registered_link_options-2085425-32.patch | 8.21 KB | imclean |
#26 | already_registered_link_options-2085425-26.patch | 7.33 KB | imclean |
#25 | add_cancel_link-2085425-25.patch | 5.15 KB | imclean |
Comments
Comment #1
julou CreditAttribution: julou commentedAlso I did not solved the problem completely yet, I progressed noticeably: I am now stuck trying to theme the registration field from a custom module.
Please read more on this at http://drupal.stackexchange.com/questions/85792/how-to-theme-a-field-for...
Thank you in advance for your help.
PS: Do you think integrating this conditionnal display to the default 'form' field formatter would be relevant?
Comment #2
julou CreditAttribution: julou commentedSolved.
It took me some time to realize that I needed both
- a custom field formatter (to display the registration form to registered users as well)
- a custom theming of the registration field (so as to display either the form or relevant info: registration state, fully booked, etc)
Comment #3
flocondetoileHi julou,
I am searching for similar features. Could you explain me more precisely how you solved this ?
Thanks
Comment #4
jzornig CreditAttribution: jzornig commentedIt would be good to have this as a feature. I find it really confusing to see the registration form after I've already registered and just get an error if I click "Save Registration" again. It does not even redirect me to my registration in this case.
The form should say Already Registered and show an "Edit Registration" button.
Comment #5
julou CreditAttribution: julou commentedGood to read I'm not the only one to think it would be a relevant default behavior for this module :)
In the meantime, here is how I implemented the custom field formatter, and the theming. This is adapted from the registration_field_formatter_view() and related functions. As you can read, my module is called 'zss'. The theming is done for a field named field_registration. You could probably (?) make it more generic by theming by field type.
Hope this helps. Best, Thomas
Comment #6
jzornig CreditAttribution: jzornig commentedjulou, Thanks for this. You will have saved me or one of my developers a heap of work. Cheers, JZ
Comment #7
flocondetoileThank you very much. I will try in the coming weeks.
Comment #7.0
flocondetoiletypo
Comment #8
aucovic CreditAttribution: aucovic commentedjulou, thanks for the formatter. I've tried it, but unforuntatelly it's not working for me. My module implementation is fine, I'm not getting any error but the module simply doesn't hide the form if user has already registered for the event? Any suggestions?
How about you guys jzornig and flocondetoile? Does it work for you?
Comment #9
aucovic CreditAttribution: aucovic commentedIn addtition to my previous comment #8:
It seems that hook zss_field__field_registration does not have any effect to the rendered field. My registration field is named "field_registration", so I'm consfused why this hook is not applied to that field?
Comment #10
julou CreditAttribution: julou commented@ aucovic:
The formatter does not hide anything: to the contrary, it displays the form also for registered users.
You are right, the problem comes from the fact that your field_registration theming is not working; could you try to do it from a file? or check that the naming convention is ok (e.g. my_module_field__field_name)?
Comment #11
aucovic CreditAttribution: aucovic commentedjulou, no questions about the naming convention. The function name is correct (in my case entity_registration_custom_field__field_registration). I'm using views module and I made sure the custom formatter is selected as well. This is really very odd. But good idea, I will try it from a file.
I basically understand all what you wrote in the field theming hook, and was so excited when I found it.
Will let you know whether is working via file.
Big thanks julou for this code anyway!
Comment #12
aucovic CreditAttribution: aucovic commentedjulou, just tested it out with a file template. The template is executed without errors but when $output is printed out, all I get is:
What am I missing here?
Comment #13
aucovic CreditAttribution: aucovic commentedI ended up implemeting and customizing this formatter: https://drupal.org/comment/7888559#comment-7888559
julou I'm not sure how field hook can acctualy work in your sample since there is a hook_field_formatter_view() implementation which is calling
drupal_get_form('registration_form', $registration)
and embedding form. I suppose that means the field hook will never be executed.Comment #14
flocondetoileHi
I used snippet posted by @julou and it works very fine (Thank you very much @julou). The registration form is well hidden if a user is already registered (except for user 1).
I implement the Theme field_registration in my theme template file
THENENAME_field__CUSTOM_FIELD__CONTENTTYPE ($variables)
Best
Comment #15
ptmkenny CreditAttribution: ptmkenny commentedClosed #1685058: You Are Already Registered - Need Default Message to User as a duplicate.
Comment #16
ptmkenny CreditAttribution: ptmkenny commentedComment #17
ptmkenny CreditAttribution: ptmkenny commentedIt would be great to have this as a patch to the module. If a user only has permission to register himself/herself and the user has already registered, it doesn't make any sense to show the registration form to that user.
Comment #18
deggertsen CreditAttribution: deggertsen commentedYou can do this using panels. See #2098779: Display registration page differently for those who already registered
I recognize this is only a workaround so it would be nice for those who don't want to use panels and custom php to have a built in solution.
Comment #19
ptmkenny CreditAttribution: ptmkenny commentedJulou's code in #5 works when the registration form is displayed on the node page, but it doesn't work when displaying multiple registration forms using the field display mode of views.
EDIT: To provide more details, when loading the custom form with Views, it appears that only the first entity is loaded for all instances. So, if I have 10 events, each showing a registration form in Views, there will be 10 registration forms, but all of them are only for the first entity loaded, not #1 form for #1 entity, #2 form for #2 entity, etc.
Comment #20
julou CreditAttribution: julou commentedA quick update for people using / inspired by the snippet in #5. This syntax has several drawbacks, among which the fact that it is not compatible with the waiting_list submodule.
The following code, relying only on a custom formatter, achieves the same in a cleaner way (and keeps compatibility with waiting_list):
Hope it helps!
Comment #21
benmmc CreditAttribution: benmmc commented#20 works, thanks! I have made two changes below:
Just for clarification, when you use this in a custom module, you aren't touching the individual field theming like in #5, so no need to change a field name to match yours. Also, once it's enabled, go to
/admin/structure/types/manage/[your_content_type]/display
and change the format of the registration field to "Custom" and it should work.Comment #22
igorik CreditAttribution: igorik commentedwould be great to have this directly added into the module
Comment #23
peter.morlion CreditAttribution: peter.morlion commentedWouldn't it be better to not hide the form entirely, but instead how a message stating the user has already registered and have a button to unregister? I believe this would be a better UX, as everything is available on one page.
I find it weird that to register, you can do it on the main page, but to unregister, there's a separate page.
Comment #24
igorik CreditAttribution: igorik commentedYes, this can be better solution, to show registered user this form
but only with Unregister button, nothing more.
Comment #25
imclean CreditAttribution: imclean commentedA work in progress, this only applies to the "Registration Link" display option, not the form at this stage.
No permission checks are done before displaying the cancel label, the link simply won't work if the user doesn't have permission.
It really should include the option to display some text instead of the Cancel button, perhaps using a dropdown in the field formatter settings: "Show cancel link", "Show already registered text".
Or the patch could simply be modified to suit the use cases above.
Comment #26
imclean CreditAttribution: imclean commentedImproved version of #25, this provides 3 options for what to display to users who are already registered.
The options within the display formatter for the registration link are to display:
Comment #27
imclean CreditAttribution: imclean commentedReview progress thus far.
Comment #28
igorik CreditAttribution: igorik as a volunteer commentedsouds amazing, looking forward to test it!
Comment #29
cboyden CreditAttribution: cboyden commentedIt would be better to change your wording to "delete" everywhere you have "cancel." Otherwise it won't be sufficiently clear that the registration will be completely gone, as opposed to in a canceled state where someone could un-cancel it if they needed.
Also, it would be nice to have a link to the registration edit form on the registered text option.
Comment #30
imclean CreditAttribution: imclean commented#29, "Delete" would make more sense.
This should probably be a separate option, "Edit Link".
Comment #31
igorik CreditAttribution: igorik as a volunteer commentedHello,
I tried to test it with latest registration.module (1.5 and later 1.x) but I found that big part of the patch #16 is already included,
so is this functionality now in the module?
I really don't remember how it was before, I am just preparing myself for using Entity registration module.
Now I can see the fieldset My registration
with information about my registration and with Delete link.
When I canceled my registration, I can see on the page link Registration: Registration[link]
If it is not the full feature from the patch, can please somebody update the patch for latest module version?
Thanks
Igor
Comment #32
imclean CreditAttribution: imclean commentedBased on #26, the Registration Link display formatter now includes:
@igorik, this needs review before it can be included. It is a change to the display formatter for "Registration Type" field, "Registration Lin" option. The registration itself already includes options to edit and delete a registration.
@cboyden, can you please review.
Comment #33
igorik CreditAttribution: igorik as a volunteer commentedHello Imclean,
I used your patch with Entity Registration 1.5 and I can confirm that
there are now 4 working options under Manage display -> Registration field.
Register link OR Registered text OR Edit link OR Delete link
Igor
Comment #34
igorik CreditAttribution: igorik as a volunteer commentedHello,
I am using registration form disoay format (not Registration link) for Registration field on the node page.
Is there any chance, how I can show "you are already registered" to registered member?
Now there is the form for unregistered member to the event, and after registration to the event, there is no form (what is ok) but no other text like "you are already registered" and ideally + links to edit, delete and view his registration.
Comment #35
imclean CreditAttribution: imclean commentedPlease feel free to develop this patch further. It would also be handy to have more people review and provide feedback.
It is working well for our needs and I have little time to develop it further at this stage. I will make changes to the existing function based on constructive feedback.
Comment #36
Anonymous (not verified) CreditAttribution: Anonymous commentedI applied this patch and it seems to work except when I test it with a user with normal permissions the 'Already Registered' state doesn't show up whatsoever. I can set it up so when I register I see a 'Edit Registration' link logged in as admin but a user without at least the 'Registertype: Administer settings' permission has the register field disappear.
I can't think of anything obvious that's causing his behavior
Comment #37
mahammedzkhan CreditAttribution: mahammedzkhan at Pàu commentedJust make sure the 'pending' state is active under 'registration states':
admin/structure/registration/registration_states
Comment #38
SocialNicheGuru CreditAttribution: SocialNicheGuru commenteddoes not apply to dev version cleanly
Comment #39
joelpittet@SocialNicheGuru re #38 it seems to work against 7.x-1.x-dev cleanly, are you on the same branch?
Comment #40
asrobRTBC'ed based on joelpittet's comment.
Comment #41
AnybodyAny plans for a new dev release containing this patch?
Comment #42
nmillin CreditAttribution: nmillin at WI Department of Public Instruction commentedPatch from 32 is missing
from patch 25.
Attaching updated version of 32 with this in it. Setting back to needs review for the new patch to be reviewed.
Comment #43
joelpittet@asrob I would have RTBC'd it if I thought so, that RTBC is on you;)
Comment #44
asrob@joelpittet, I agree, looks good to me. :)
Comment #45
Bruno Nery CreditAttribution: Bruno Nery as a volunteer commentedWaiting list, someone was able to let the waiting list receive only one record. The way the module is currently I can register on the waiting list more than once with the same user.
Would it be nice to only receive one record per user, did any of the friends come across this problem?
Comment #46
Bruno Nery CreditAttribution: Bruno Nery as a volunteer commentedComment #47
imclean CreditAttribution: imclean commentedComment #48
Bruno Nery CreditAttribution: Bruno Nery as a volunteer commentedComment #49
joelpittetWhat should be done with this @todo?
There are a few coding standard faux pas in there to clean up around spaces of the ==, didn't look too close on the nitpiks but worth a clean up
Comment #50
Bensbury CreditAttribution: Bensbury as a volunteer commentedI'm trying to review the patch from #42 but I get this error:
patch: **** malformed patch at line 133: diff --git a/registration.module b/registration.module
I've used the patch -p1 and git command way. Does anyone else get this error?
If not is there a certain way to make the patch work? Otherwise I guess it fails.
Thanks