PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Register by buying a product

s2Member Plugin. A Membership plugin for WordPress®.

Register by buying a product

Postby yifatcohen » December 20th, 2011, 5:25 pm

Members can register to my site by purchasing a product (through a Pro form that sells them a book/service and gives them access to level 1).

I'd like my posts to send them to the product page (http://gplusdecoded.com/products-2), rather than http://gplusdecoded.com/wp-login.php?action=register

Where do I control that?

Also - how do I use a coupon that basically gives the product away for free (right now it charges $0.01) even if the coupon value is greater than the product value.
User avatar
yifatcohen
Registered User
Registered User
 
Posts: 8
Joined: May 19, 2011

Re: Register by buying a product

Postby Raam Dev » December 20th, 2011, 9:13 pm

Hi yifatcohen,

I don't understand what you're trying to control. Can you give me an example post that sends people to the register page? What page did you select for the Membership Options Page (WP Admin -> s2Member -> General Options -> Membership Options Page)?

Normally when a non-logged in user tries to access a protected page, s2Member will redirect them to the Membership Options Page. That's the page where they can purchase access. So, it sounds like your 'products-2' page should be the one selected as the Membership Options Page.

Regarding the free coupon: You'll need to use a free registration form and hide it from anyone who doesn't have the free coupon code. Please see this example: viewtopic.php?f=4&t=16176&p=54466#p54503
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Register by buying a product

Postby yifatcohen » December 21st, 2011, 7:56 pm

That voucher thing isn't working for me. I get a syntax error.

Here's what I've done:
I've installed the Allow PHP in Posts and Pages plugin, and then put this in my page:

Code: Select all
[php] if (isset($_GET['?s2p-coupon='] && $_GET['?s2p-coupon='] == 'free')) { header( 'http://gplusdecoded.com/wp-login.php?action=register' ) ;[/php]

[
php] } else { [/php]
content of my paid form
[php] } [/php] 


When I go to: http://gplusdecoded.com/products-2/the- ... oupon=FREE I get:
Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ‘,’ or ‘)’ in /homepages/23/d393606834/htdocs/gplusdecoded2/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(83) : eval()’d code on line 1

Parse error: syntax error, unexpected ‘}’ in /homepages/23/d393606834/htdocs/gplusdecoded2/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(83) : eval()’d code on line 1
Last edited by Cristián Lávaque on December 23rd, 2011, 5:57 am, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
yifatcohen
Registered User
Registered User
 
Posts: 8
Joined: May 19, 2011

Re: Register by buying a product

Postby Raam Dev » December 22nd, 2011, 3:24 pm

I'm not sure how that plugin evaluates the PHP code (I've had good luck with the PHP Execution plugin), but it might have trouble separating the PHP IF block into separate [php][/php] blocks.

Can you try giving the other PHP plugin a try and see if that works?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Register by buying a product

Postby Cristián Lávaque » December 23rd, 2011, 6:03 am

Yifat, you had the var name wrong in the $_GET array, and the header function was missing 'Location: ' before the URL.
http://php.net/manual/en/reserved.variables.get.php
http://www.php.net/manual/en/function.header.php

About the syntax error, it's probably a limitation with those PHP shortcodes, not sure.

Here's what I'd try, since you'll be doing a redirection instead of showing one content or another.

Create the dir/file /wp-content/mu-plugins/s2hacks.php and add this:

Code: Select all
<?php 

if 
(isset($_GET['s2p-coupon'] && $_GET['s2p-coupon'] == 'free')) { 
    header
('Location: http://gplusdecoded.com/wp-login.php?action=register');
}

?>
Don't leave any spaces or lines outside the PHP tags.

Let me know if that works. I hope it helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

cron