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™

S2Member Pro User Registration Form

s2Member Plugin. A Membership plugin for WordPress®.

S2Member Pro User Registration Form

Postby peterhuk » April 29th, 2011, 3:36 pm

Hi J/C,

I recently implemented the S2Member Pro registration form.
The form blends in with the theme really well and looks great.

The only problem is I previously created a function for the WP
registration form to dynamically insert Input fields into the form.
The field names and values are generated randomly so I cannot use the
S2 Pro ‘Custom Registration Fields’.

In addition some of the randomly generated keys and values
are temporary values so they would not be suitable
for use in the ‘Custom Registration Fields’ configuration.
Whilst other inputs are hidden and auto completed at point
of page access.

My function also requires some of the key, value pairs to
generates errors in certain conditions halting the registration
process and display an error.

I have not been able to find a similar modification route with
the S2Member registration form.

Any ideas?

Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby Cristián Lávaque » April 29th, 2011, 8:52 pm

You could look at the Registration Pro-Form's code and see what you can do with it. wp-content/plugins/s2member-pro/includes/classes/gateways/paypal/paypal-registration-in.inc.php
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

Re: S2Member Pro User Registration Form

Postby peterhuk » April 29th, 2011, 9:21 pm

Hi Cristián,

Many thanks for your suggestion. I have already had a look, there
are no filters to return data to S2 so the only option seems to be a
phyical hack to the file.

This would be an easy solution until the next S2 Pro update then
will have to remember where all the changes were.

There is an other approach which is to pull the full complete form
data in form the ws_plugin__s2member_pro_sc_paypal_form and
do the odd regex and str_replace.

Will let you know if I have any success.

Many thanks

Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby Cristián Lávaque » April 29th, 2011, 9:48 pm

You could edit the file just to add the hook you want, then do the rest from outside via the hook.
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

Re: S2Member Pro User Registration Form

Postby peterhuk » April 30th, 2011, 6:19 am

Hi Cristián,

Many thanks for your suggestion. My biggest concern about altering
program files is that months later an update is implemented and
changes are overwriten then things stop working.

I learned that the hard way and I'm a bit reluctant to make changes
to application files.

I am working on a workaround. If it work I'll let you know.

Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby Cristián Lávaque » April 30th, 2011, 11:18 am

I look forward to your update. :)
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

Re: S2Member Pro User Registration Form

Postby peterhuk » April 30th, 2011, 5:39 pm

Hi Cristián

O.k, this is where we are at the present. First my shortcode runs to check
If there are any issues.

In either case I run the s2Member-Pro-PayPal-Form register="1" etc shortcode.
The entire form is loaded into a var via the ws_plugin__s2member_pro_sc_paypal_form
filter.

I add my input variables to the end of the form with a cheeky
Code: Select all
$form = str_replace(“</form>”,“my input vars</form>”,$form)

If my shortcode brings up any errors I insert my error code between the
id="s2member-pro-paypal-registration-form-response-div" div
(using strpos to locate the id position and some other cmd’s to find the
position of the end of the tag '>') then use substr_replace
to insert my error code into the response code div section.

All good so far. If my shortcode generates an error I would like to
suppress any S2 Pro errors (else two response div’s looks ugly).

To prevent this I have used
Code: Select all
unset($_POST["s2member_pro_paypal_registration"]);

to suppress the display of S2 Pro user input.

This removes user inputs from the fields but S2 still seems to be
able to produce it’s own errors. Even with cookies disabled S2 Pro
can still generate an error i.e if using an email address that is already
in use (this is fine but I don’t want want it to show whilst my short code
is displaying an error).

This is where I could use your help. What $GLOBALl variable do I need
to unset or alter in order to halt S2 Pro whilst my shortcode has
determined an error?

Ultimately what I would like is if my shortcode determines an error on a
submitted page I would like S2 Pro to treat the page as a non $_POST
(accessed via click) page (if that makes any sense).

Many thanks

Peter..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby peterhuk » May 1st, 2011, 4:02 am

Hi Cristián

Just a quick update.

Code: Select all
unset($_POST["s2member_pro_paypal_registration"]);


I found that applying the above earlier in the process, provides the desired
result in this work around.


Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby Cristián Lávaque » May 1st, 2011, 4:05 am

Oh. Thanks for the update! :)

I emailed Jason about your question earlier already, so he may come and comment at some point.
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

Re: S2Member Pro User Registration Form

Postby peterhuk » May 1st, 2011, 12:56 pm

Hi Cristián,

Do you know what filter loads the

Code: Select all
c_ws_plugin__s2member_pro_paypal_registration::paypal_registration


Class, in paypal-registration.inc.php. This one is buggin me, this appears to be the
class that processes the $_POST data for the registration form.

if I can intrercept this filter before it loads then when my function generates an
error It can suppress the above class otherwise if no errors are generated by my
function then the above can run normally.

Many thanks

Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby peterhuk » May 1st, 2011, 6:21 pm

Cristián,

I thnik I've got it, paypal-hooks.inc.php has the following action.

Code: Select all
add_action ("init", "c_ws_plugin__s2member_pro_paypal_registration::paypal_registration");


As this runs at default priority 10 I have added an action which runs at priorty 9. using a similar
wp_verify_nonce check I was able to lock unto this action and simply unset the global post nonce
when a function generates and error.

Once the nonce is cleared the action will not be activated.

Does that sound correct?

Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: S2Member Pro User Registration Form

Postby Jason Caldwell » May 3rd, 2011, 9:11 pm

Hi Pete.
I just finished reading over this thread.

Yes, it sounds like a good solution to me.
unset($_POST["s2member_pro_paypal_checkout"]["nonce"]);

In the mean time, we ARE working to add some Hooks/Filters into the Pro Module.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: S2Member Pro User Registration Form

Postby peterhuk » May 4th, 2011, 1:34 am

Many thanks Jason,

I used
Code: Select all
unset($_POST["s2member_pro_paypal_registration"]["nonce"]);
which seems to work fine.

Pete..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron