This project is read-only.

How to collect user information before accessing a specific page

Topics: Customizing Orchard, General, Installing Orchard
Nov 20, 2012 at 10:54 AM


New to Orchard.

I want to collect user information before accessing a document download page, how to do this in Orchard ?

I could have a link to a custom form where I can collect user data and redirect the page to the final download page, but how to restrict access on this page to users having filled the user data page (cookie based ? role based ? )


Thanks for help.


Nov 20, 2012 at 12:44 PM

Hmmm, sounds like you'll need to authenticate the user. Code will then help restrict access to the download page. Could be as simple as a login/registration page.

Don't knock your head against the wall - check out Skywalker's blog series. I linked Part 8 which deals with registration/login/authentication, but you'll want to read most of the other parts that are relevant. The Introduction has a table of contents.

Nov 20, 2012 at 12:58 PM
Edited Nov 20, 2012 at 4:05 PM

Idally I would avoid registering the user, for sure with a registration I could manage same kind of UI effect.
The concern with registration are:

  • I don't want to bother users with one more password
  • I don't want to fill the site internal DB with innactive accounts
  • I need different information concerning users than the simple info managed by user profile
  • I have plans to implement FB / Twitter /G+ logins but this will require either using one of the modules dedicated to this or implementing my own module.
    In either solution it means long testing and implementation,  I have not time to start this today.

A cookie based solution would have been perfect.
Injecting a cookie in page from a rule triggered after the first successfull input page.
This would require that I could create layers based on cookie detection, fonction I have not found.

Nov 20, 2012 at 3:59 PM

Ahh, just brainstorming here:

If you want to block a page from any user seeing it I don't know how you can accomplish that, hence the necessity of authentication. However, if you are willing to try something different why not just collect their name and e-mail address (and what ever other data you want to "collect") and then send a response e-mail with the attached document. If there is a choice of documents, just slap on a drop down list or radio button list with the choices. Then do some logic to send the appropriate attachment.

The thing about gathering "different information concerning users than the simple info managed by user profile" is you are either going to save that information in the database (which is not necessarily a bad thing), or you are going to somehow get at that information and do something with it (there is a circular argument here: because getting the information and storing it somewhere necessitates saving in a database, and if you are going to do that then why not just save it in Orchard).

Another thing you might do (it stores info in the database) is use Orchard.CustomForms. You can create a form to save information about the user and then create a rule (if you want) to shoot them or yourself (or both) an e-mail with the information. The information is accessible in the Admin Dashboard>Forms. The problem is how do you then serve an attachment to the e-mail (is this possible with Rules/CustomForms?).

Again, just brainstorming. Please someone chime in if there is another way to handle what @csadnt wants.