Page 1 of 1

Single Page Restrictions

PostPosted: November 17th, 2011, 11:25 am
by fcp2011
I am considered using the singular page/post feature but need a little help with it. I am using gravity forms to complete a very detailed form. After submission of that form, I want to be able to refer the member to a page that is protected via this singular protection feature. No payment is needed.

So, is there a way to dynamically create the link after the form submission and then refer the webbrowser to that page. I have access to perform php code upon submission of the form, I am just not sure what php code I need to run.

I see that the source code for s2member has a function that would allow the creation of a link, I am just not exactly sure how to use it.

Any help? Thanks in advance.

Daniel

Re: Single Page Restrictions

PostPosted: November 17th, 2011, 9:04 pm
by fcp2011
I was thinking something like:

form submission is complete
run sp_access_link_gen() function
then redirect to page with the php code header( 'Location: http://www.yoursite.com/new_page.html' ) ;

Anyone have any extra help to throw my way on this?

Re: Single Page Restrictions

PostPosted: November 21st, 2011, 2:13 am
by Cristián Lávaque
viewtopic.php?f=40&t=13074&src_doc_v=111105

Yeah, your idea seems good. With sp_access_link_gen create the URL that you'll redirect the person to. viewtopic.php?f=40&t=13074&src_doc_v=111105

Code: Select all
header('Location: ' sp_access_link_gen ($page_ids$hoursfalse)); 

* Haven't tested it.

I hope it helps. :)

Re: Single Page Restrictions

PostPosted: November 21st, 2011, 8:19 am
by fcp2011
How should I use the code you have provided? Can you explain a little more about it? I am adding a hook to gravity forms for a particular form. So, when the form is submitted it will run this code. Do I need to add anything to this code, like the url, or leave 'Location: ' the way it is?

Re: Single Page Restrictions

PostPosted: November 22nd, 2011, 3:19 pm
by fcp2011
Is this all the code I will need to run upon submission of the form?

Re: Single Page Restrictions

PostPosted: November 22nd, 2011, 3:32 pm
by fcp2011
I added exactly what you put in there but it doesn't work. Any other idea?

Re: Single Page Restrictions

PostPosted: November 27th, 2011, 6:45 pm
by Cristián Lávaque
You need to define $page_ids and $hours.

* @param str|int $sp_ids Comma-delimited list of Specific Post/Page IDs *( numerical )*.
* @param int|str $hours Optional. A numeric expiration time for this link, in hours. Defaults to `72`.