Hello!
This is basically my first Drupal website, and I must admit so far I am really impressed.
I don't think I'm quite aware of all it's power yet, as I try to complicate things most of the time...
My Problem:
I have 2 types of content: News & Events (for example)
I want people to register their basic details (name, company, country etc.) before being able to view the news and events.
But only once on their visit, not having to re-submit the form to see events, when they already completed it to see news.
I thought of
- using a webform that redirects to events/news but that would mean they would have to resubmit every time they visited the page.
- having them register, and allowing that user role to view those content types. But if the content is restricted then the visitor would be faced with a 'login' page rather than a registration page, so adding a step and driving the visitor away.
- Taxonomy terms. I saw this mentionned somewhere but not entirely sure how this would work.
Would the user/registration solution allow for multiple submissions of the same details or would that throw up an error. The idea is not for them to become users and login in future, but just to submit a few details.
I have enabled the Profile module and was going to play around with that for the meanwhile, but I can't think of a perfect solution, and all my searching has not uncovered any similiar questions so far.
Any ideas, help, advice are extremely welcome.
Thanks,
Comments
You would probably need to
You would probably need to create some basic content (e.g. a Welcome 'Page') which is available to anonymous users and restrict News and Events to Authenticated Users. Then set the front page to be the Welcome Page describing registration information and providing a link to the relevant login/register pages.
David
There is other content
That would be nice, unfortunately these two sections are only a small part of an otherwise decent sized site (whatever that means lol).
However, you have made me think, that if possible, I could have these as a subsite, but unfortunately not what client wants...
Thanks for idea though!
Wouldn't this still work -
Wouldn't this still work - you would just restrict access to the News and Events content types and add a link to Register or Login somewhere on the main site?
David
yes, but no
Unfortunately it's not the perfect solution, it's adding an extra step to the process.
What I've been trying to do is:
- The registration form
» additional processing has:
» Form Component (hidden):
Name: submitted[name] - Value: %session[name]
» Redirect Message or URL:
%server[HTTP_REFERER]
- Content Type Template/Node Template:
add
But I'm not doing to well with the latter!
I created the node.tlp.php in theme folder and one for content type node-case-study.tlp.php but that didn't seem to have any effect. Using Dev themer it seem to depend on page.tpl.php and page-node-123.tpl.php so created both in the theme folder, but still not working for me...
I'm struggling to understand how to implement normal php and the session_start() function into a drupal page. originally I was putting it in a content type template, but obviously session_start() needs to go before everything.
If I could work out how to use the cookie function in the webform module, I might do a better job at making the page check for the cookie, and if it's present load the page, otherwise redirect to the registration form.
Not sure why this is necessary
My understanding is that you have two content types. You want to capture user details before someone sees this content but only once.
I think the only way to know if someone has previously "registered" on subsequent visits is if you go with user accounts and ask them to log in. If you don't want them to have to log in every time you should just be able to extend the session timeout. There will be a way of doing this in code but I suspect the Auto Logout module will allow you to extend the timeout to (for example) a week. http://drupal.org/project/autologout
I would be wary of changing any session handling code in Drupal and you shouldn't modify the core system. Once you get things working I'd suggest setting it up again unless you're positive you've removed any changes you've made - it's not clear from your post where you've made those session changes.
The theme will look for node-.tpl.php but you will need to rebuild your theme registry before it picks up your files. See http://drupal.org/node/190815 for info but you may not need this now.
Thanks
Thanks dredshaw for the link, I had seen it but led me to look deeper into it, bringing up some interesting little things I will do in future.
I understand what you are saying, and grateful for the comments.
However, I didn't want to be creating users everytime, and them having to remember login details just to look at a page. I would either have to allow doubles, as they tried to register again. Otherwise if that failed, it is unlikely they would go through the 'forgotten your password' routine, just for a few documents.
There were too many risks of putting people off in my opinion, and possibly work to sort it out.
Also, the client wants to be able to view/download the list of people registering.
Now that would mean giving them access to user data and more permissions to take into account.
Instead, here they can just view the webform results and download them if they want.
And I agree with you that core system shouldn't be changed, it's just going to cause nightmares on upgrades. But using the theme folder makes it possible with little risk.
Thanks for taking the time to look at my problem however.
Managed it!
Finally got my head around it, was just me working out how to edit Drupal page templates etc.
Here is what I did
» The Form
I created my fields to be completed.
In the additional processing field I put
» The Template
I am working with a Zen subtheme, so edited the template.php file and uncomment the preprocess_page part, replaced it with:
I then copied the page.tpl.php file from the Zen folder to my subtheme folder.
Opened it and saved it as page-case_study.tpl.php (page-content_type.tpl.php)
At the top of the page I added
just below the
<?phpand that's about it.
I haven't managed to pass the [HTTP_REFERER] as the redirect url for the webform, but that seems to be more due to it not getting the referer url, as that method doesn't always work I gather. So the confirmation page just has a link to the relevant pages instead of linking straight back to the user were attempting to access.