Statistics: Posted by martonic — July 31st, 2010, 6:54 pm
Statistics: Posted by johnny g — July 30th, 2010, 10:55 pm
Statistics: Posted by martonic — July 30th, 2010, 1:18 pm
Statistics: Posted by johnny g — July 30th, 2010, 12:50 pm
Statistics: Posted by johnny g — July 29th, 2010, 8:15 pm
Statistics: Posted by martonic — July 29th, 2010, 7:23 pm
Statistics: Posted by johnny g — July 29th, 2010, 6:30 pm
Statistics: Posted by Jason Caldwell — July 29th, 2010, 2:13 pm
// get custom registration fields set by s2member
$telephone = "";
$address = "";
$gender = "M";
$year = 1900;
$key = "s2member_custom_fields";
$fields = get_user_meta($wp_id, $key, false);
@$gender = $fields[0]["gender"];
@$year = $fields[0]["birthyear"];
@$address = $fields[0]["mailing_address"];
@$telephone = $fields[0]["telephone"];
Statistics: Posted by martonic — July 28th, 2010, 11:27 am
S2MEMBER_CURRENT_USER_FIELDS
This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: id, ip, email, login, first_name, last_name, display_name, subscr_id, custom. If you've configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: Street Address, it would be included in this array as: street_address. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true)); to get a full list for testing.
<?php $fields = json_decode(S2MEMBER_CURRENT_USER_FIELDS, true); ?>
<?php echo $fields["first_name"]; ?> <?php echo $fields["last_name"]; ?>
This would output the first and last name for the current user.
Custom Fields are also included in the JSON decoded array.
<?php print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true)); ?>
( Displays a full list of all associative array elements. )
<?php
$user = wp_get_current_user();
$fields = get_usermeta($user->ID, "s2member_custom_fields");
print_r($fields);
?>
Statistics: Posted by Jason Caldwell — July 28th, 2010, 7:20 am
Statistics: Posted by johnny g — July 27th, 2010, 8:26 pm
Statistics: Posted by martonic — July 23rd, 2010, 1:02 pm
Statistics: Posted by martonic — July 23rd, 2010, 11:21 am
Statistics: Posted by martonic — July 23rd, 2010, 10:38 am
Statistics: Posted by Jason Caldwell — July 22nd, 2010, 6:21 pm
Jason Caldwell wrote:
Gotchya. Yea, this is a feature that we're working on as well. Custom Registration Fields are being revamped to support many new features in a future version of s2Member. The hold-up is the UI portion. As you can imagine, the UI for this has to be very inutitive; so we're taking our time on that part.
Until then, you could use Hooks/Filters for s2Member.
Inside /s2member/includes/functions/register-access.inc.php
you will find this function: ws_plugin__s2member_custom_registration_fields()
which integrates several Hooks that you can use to add things of your own ( i.e. custom code ).
Here is an example, which adds a drop down SELECT menu.
( put something like this inside the functions.php for your WP theme )
- Code:
<?php
$hook = "ws_plugin__s2member_during_custom_registration_fields_after_last_name";
add_action($hook, "my_custom_fields");
function my_custom_fields($vars = FALSE)
{
echo '<select name="ws_plugin__s2member_custom_reg_field_state">';
echo '<option value="GA">Georgia</option>';
echo '<option value="FL">Flordia</option>';
echo '</select>';
}
$hook = "ws_plugin__s2member_before_configure_user_registration";
add_action($hook, "add_my_custom_fields");
function add_my_custom_fields($vars = FALSE)
{
$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"] .= ",State";
}
?>
Or, if you really need to; you can just make some direct edits inside this file:
/s2member/includes/functions/register-access.inc.php
Statistics: Posted by martonic — July 21st, 2010, 6:33 pm
Statistics: Posted by martonic — July 18th, 2010, 11:40 am
<?php
$hook = "ws_plugin__s2member_during_custom_registration_fields_after_last_name";
add_action($hook, "my_custom_fields");
function my_custom_fields($vars = FALSE)
{
echo '<select name="ws_plugin__s2member_custom_reg_field_state">';
echo '<option value="GA">Georgia</option>';
echo '<option value="FL">Flordia</option>';
echo '</select>';
}
$hook = "ws_plugin__s2member_before_configure_user_registration";
add_action($hook, "add_my_custom_fields");
function add_my_custom_fields($vars = FALSE)
{
$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"] .= ",State";
}
?>
Statistics: Posted by Jason Caldwell — July 18th, 2010, 2:15 am
Statistics: Posted by martonic — July 17th, 2010, 11:46 am
Statistics: Posted by gwc_wd — July 16th, 2010, 1:47 pm
Statistics: Posted by Jason Caldwell — July 16th, 2010, 1:04 am
Statistics: Posted by gwc_wd — July 15th, 2010, 3:30 pm