Page 1 of 1

Accessing custom values + custom registration on signup

PostPosted: September 7th, 2011, 4:19 am
by 21inspired
We want to access custom values (CV1 etc.) and custom registration fields programmatically when a user registers on the site.

Is the ws_plugin__s2member_during_configure_user_registration hook the best place to do this?

What index do I need into the vars array to access:

1. The CV values (is it just $vars['cv1']) ?
2. Custom registration fields (is it just $vars['fieldID]?

Thanks, Roger

Re: Accessing custom values + custom registration on signup

PostPosted: September 9th, 2011, 7:01 pm
by Jason Caldwell
Hi Roger. Yes, you've almost got it. Here's a code sample for you.
Code: Select all
<?php
add_action 
("ws_plugin__s2member_during_configure_user_registration", "my_function");
function my_function ($vars = array ())
    {
        $cv1 = $vars["cv"][1];
        print_r($vars); // for a full list during tests.
    }
?>

Re: Accessing custom values + custom registration on signup

PostPosted: September 10th, 2011, 9:09 am
by 21inspired
Hi Jason,

thanks for the feedback... I was quick hacking on a live site, so didn't want to print_r. We have a test environment in place now, so will do that.

It's part of a workflow where we want to redirect to different pages (and do some processing - vote counting) depending on the route they took to initiate their registration.

Cheers, Roger