require form to view a page?

Permalink
I'm hoping to create a default blog_entry page that requires a form submission in order to view the contents of the page. Does anyone have any idea how something like this could be accomplished?

I was thinking there might be a way to add a form within a popup block of some sort on the default blog_entry page but this still wouldn't create a scenario where the content was only viewable on the condition of completing the form.

More specifically, I'm working with the ProNews add-on and trying to make it so that if someone clicks on a news post they are taken to a form to be filled out in order to view the full post. (I am simultaneously contacting the maker of this add-on to see if they will help me)

I have a fairly simple understanding of php so I'm at a loss of what I can modify in the code to achieve what the client is asking for. If anyone has any ideas it'd be much appreciated.

lackadaize
 
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
I hope you can achieve this by playing with some ajax and jquery. Lets say for example, you have a news list page having different news listed. When one click on any news, it goes to details page. Now your turn to play around it. Add a simple Ajax Form. Here is the link: http://www.concrete5.org/marketplace/addons/ajax-form/...

Now first of all set an inline css (display: none) on the div wrapping the news section. So it won't show at the first load. Now add a Ajax form & customize it so if user submit the form, it doesn't show any success message rather show the form.

If the news wrapper div is something like this
<div id="news_holder">
News details goes here...
</div>


the write the jquery to show the div while submit the form.
$('#news_holder').show();


I hope this makes you sense & help you to solve this.

Rony
lackadaize replied on at Permalink Reply
lackadaize
@Steevb, Thank you for the thought but I don't want the viewer to have to login to the site to view anything.

@ronyD, I think you're solution may be down the right track. I understand what you mean about controlling display and visibility with inline-css, but am unsure how to implement the jquery code you provided, as I am not very familiar with jquery at this point.

Can you tell me where I would include the jquery you included in your post? Would I have to create a seperate .js file within the ProNews plugin itself or would I somehow call it up through the Ajax Form custom template?

Thanks again for your help in this.
mhawke replied on at Permalink Reply 1 Attachment
mhawke
I built an odd little block a while ago that I call 'Coming From'. When you put it on a page, it bounces the visitor to a specific page (configurable) if the visitor didn't arrive via a specific page (also configurable)

In your case you would need to put this block on every News landing page and redirect back to the form page if the visitor didn't come from that same form page. You can add the block to the Page Type defaults for the News landing page. It's pretty simplistic and not perfect for your situation because every time the visitor wants to see the news story, they will have to fill out the form.

It kind of twists my brain when I'm using it and testing it.

You're welcome to use it. I have attached the block. Just unzip it and upload the 'coming_from' folder to your [root]/blocks folder.
mhawke replied on at Permalink Reply
mhawke
The more I play with this damn block that more I hate it. Now I'm in an infinite loop and can't get out without turning back a page version. I think the block needs some fine-tuning.
lackadaize replied on at Permalink Reply
lackadaize
Thanks alot mhawke but I was unable to get this block to work for my purpose. It's an interesting block for sure though.

I contacted the maker of the ProNews add-on and they said to do the following:

"you would need to create a custom block view for the news list block that has the articles cID passed as a request to a single page with a controller file that 1) check a user attribute to see wether or not the user has filled out the form and if they have not, display the form that points to that same single page with an action method to then save the user attribute. Or 2) if they have, redirect the page to the actual url of the cID."

Unfortunately I don't know how to set up a controller.php file, pass cID to single pages, or create contingencies as I'm very new to php. They may get back to me to further explain this but they may decide that it's beyond their scope of support so I'm posting this here as well.

Do any of you have any idea how this would work?
mhawke replied on at Permalink Reply
mhawke
Yes that block I made was infuriating. Sorry about that. After thinking about it, it's not ideal for your situation anyways since it doesn't keep track of whether they have already filled out the form on the next visit which would be very annoying.

That ProNews work will certainly not be within the scope of 'support' since it's not actually a bug. It's a feature request.

One problem with the ProNews solution is that the visitor must already be a member and must have already logged on in order for the system to attach the 'I have filled out the form' flag to the member's information. I'm guessing that you would like non-members to fill out the form because you already have contact information for registered members.

I'm thinking you need to set a cookie on submission of the form and have the ProNews page kick the visitor to the form is the cookie's not set.

Let me mull this over.
lackadaize replied on at Permalink Reply
lackadaize
no worries about the block at all, I'll give anything a shot. What you're describing is exactly what I'm looking for but I don't know how to set cookies as I don't know javascript at all and I only have limited php knowledge. Thanks again for any help you can offer. Much appreciated.
lackadaize replied on at Permalink Reply
lackadaize
Any chance you had any luck with this? At this point I might even just hire this out to someone because it's really beyond the scope of my knowledge into php. Are you at all interested and if so what do you think it would cost?
Steevb replied on at Permalink Reply
Steevb
Try using advanced permissions, then hide block, content or page to anyone who is not logged in.

Place a form/stroke login block on the page or any page, once logged in the page content will show.