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™

Registration fields

s2Member Plugin. A Membership plugin for WordPress®.

Registration fields

Postby gwc_wd » July 15th, 2010, 3:30 pm

I think this is likely not strictly an S2Member issue, though it is related by way of the registration system.

I've found quite a few posts on registration and profile fields but none exactly about my problem (which makes me think I'm missing something very basic or others would have posted about it.)

I'm running WP+Buddypress both current.

In the WP Profile there are separate fields for User Name, First Name, Last Name and Nick name with the ability to choose which you wish displayed. If these fields are changed in the WP Profile they are displayed properly in BuddyPress. But I see no way to allow users to access these fields in their Edit Profile page in BP or to include them in the BP registration form.

I definitely need the First Name and Last Name fields to be separate as they are in the WP profile and I want to allow users to choose what form of name is displayed.

Is anyone familiar with this issue?

Is there something basic I'm missing about the integration of WP and BP?

Any links to suggested sources or other guidance greatly appreciated.
User avatar
gwc_wd
Registered User
Registered User
 
Posts: 18
Joined: June 27, 2010

Re: Registration fields

Postby Jason Caldwell » July 16th, 2010, 1:04 am

Thanks for the great question.

This is more of a BuddyPress issue. However, I do understand your concern; we've taken a look at this in the past. There is a ticket in place regarding this issue [ http://trac.buddypress.org/ticket/2225 ]

For now ( given the current limitations ), I recommend changing the default "Name" field in BuddyPress, to "First Name", and adding a "Last Name" field using the Profile Fields editor with BuddyPress. Either that, or see if you can find a BuddyPress plugin that implements a work-around for this issue.
~ 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: Registration fields

Postby gwc_wd » July 16th, 2010, 1:47 pm

Thanks for that. At least I am able to proceed knowing that it is not actually something I am doing or not doing and that's the main thing -- save me many hours of fiddling. I'll test out the work around you suggest.

Thanks!
User avatar
gwc_wd
Registered User
Registered User
 
Posts: 18
Joined: June 27, 2010

Drop-downs in registration form?

Postby martonic » July 17th, 2010, 11:46 am

Hi Jason,

My client does not need buddypress, but they need 2smember! :mrgreen:

However, they really want the registration form to have drop-down lists ("select" fields) for things like state and country (parts of the mailing address) and month, day, year (parts of the birth date, which they require).

Any suggestions? :?: Thanks in advance!
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby Jason Caldwell » July 18th, 2010, 2:15 am

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: Select all
<?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
~ 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: Registration fields

Postby martonic » July 18th, 2010, 11:40 am

Hi Jason,

Very helpful, thank you.

Is there a quick way to get at the custom fields (in this case, state) for display elsewhere.

The issue, of course, is that I need the same drop-downs to appear in "Edit User" - with the right items already selected -

.. can you point me to the include file triggered during "edit user" - thanks.
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

"Select" Registration fields - make visible to admin?

Postby martonic » July 21st, 2010, 6:33 pm

Hi Jason,

If I add custom_registration_fields using "select" inputs as shown below, how can I make the results visible (or even editable) to Site Administrators? They do not come up on the User - Edit page. Even just making them visible would be useful!

EDIT: **** it does work, no problem! I just have to make sure the custom fields in s2member options are configured to read EXACTLY THE SAME as the ones I add. Fantastic!

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: Select all
<?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
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby Jason Caldwell » July 22nd, 2010, 6:21 pm

Thanks for reporting back on this. Much appreciated.
~ Please let me know if you have this resolved;
or if there is a question you had that is still unanswered.
~ 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

Registration - hooks, notifications and custom fields

Postby martonic » July 23rd, 2010, 10:38 am

Hi again Jason,

Thanks in advance for looking at my questions.

1) Are "Custom Registration Fields" passed through API Notifications - Registration?

If so, how can I send and receive them?

2) The following hook:

ws_plugin__s2member_during_handle_profile_modifications
(in functions/profile_modification_inc.php)

--> is this invoked BOTH when a user modifies their own profile, and when an administrator does it?

If not, what do I need to use to catch both cases?

Thanks! :mrgreen:
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby martonic » July 23rd, 2010, 11:21 am

Ah, I'm having another problem.

I put in two custom registration drop-downs using the hook method.

Then, if I add the same fields in s2Member General Options - Custom Registration Fields, they can be modified - but they appear TWICE on the registration page. If I don't add them, they can't be modified during Profile Modifications - also a problem.

Any thoughts?
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby martonic » July 23rd, 2010, 1:02 pm

Hi again,

It seems that if I want to have drop-downs on the registration page, I have to keep everything related to those fields in lower-case letters. I also hacked register-access.inc.php so it would not request duplicate information. Then, it works okay.

However, I can't find a hook that will deliver all of the registration information, including custom registration field values as entered by the end user (whether I'm using drop-downs, or not). Is there a hook that I can use for this?

Thanks, Marty
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby johnny g » July 27th, 2010, 8:26 pm

I have not added ANY custom fields but my registration page does not show up. I know for several reason;
(1) just attempted to go there, and (2) I have had 3 users from old site attempt to register and they can not.

Any help-

Johnny G.
http://beatthestreets.1urbanwarrior.com
User avatar
johnny g
Registered User
Registered User
 
Posts: 10
Joined: July 6, 2010

Re: Registration fields

Postby Jason Caldwell » July 28th, 2010, 7:20 am

martonic wrote:Hi again,

It seems that if I want to have drop-downs on the registration page, I have to keep everything related to those fields in lower-case letters. I also hacked register-access.inc.php so it would not request duplicate information. Then, it works okay.

However, I can't find a hook that will deliver all of the registration information, including custom registration field values as entered by the end user (whether I'm using drop-downs, or not). Is there a hook that I can use for this?

Thanks, Marty

Hi Marty. You might take a look in your WP Dashboard, under:
s2Member -> API Scripting -> API Contants

Code: Select all
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. )

Either that, or just do this in PHP code:
Code: Select all
<?php
$user = wp_get_current_user();
$fields = get_usermeta($user->ID, "s2member_custom_fields");
print_r($fields);
?>

Let me know if that does NOT answer your question. I was not entirely sure what you meant by "deliver".
~ 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: Registration fields

Postby martonic » July 28th, 2010, 11:27 am

Hi Jason,

Thanks for your answer. I found an easy way to get the custom fields after using a "Registration" notification.

Here it is:

Code: Select all
// 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"];


However, I still had to hack register-access.inc.php to prevent it from showing duplicate input rows for the gender and year fields that were "hooked" in to present them as select items.
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby Jason Caldwell » July 29th, 2010, 2:13 pm

Thanks for the feedback Martonic.

@TODO :: Check the register-access-inc.php routines to see if they can be adjusted for more greater flexibility in this regard. Completed / s2Member v3.5+.
~ 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: Registration fields

Postby johnny g » July 29th, 2010, 6:30 pm

okay guys, it's nice that all you gentlemen read, write and talk php. But I am a self-defense instructor and studying to be a video journalist. My computer language skills go no higher than basic html.. The analogy is high school to master degree or a rookie street punk compared to an experienced combat vet.

If I can not control and get registration to function properly-since this is a membership site-the software does me no good.

THIS MAKES ME SAD, as I am not a rich man.

How about a little cooperation here.

Sincerely Johnny G
User avatar
johnny g
Registered User
Registered User
 
Posts: 10
Joined: July 6, 2010

Re: Registration fields

Postby martonic » July 29th, 2010, 7:23 pm

Hi Johnny,

In your Admin Dashboard, look at S2Member -> General Options -> Open Registration / Free Subscribers.

Make sure it is set to YES (allow open registration / free subscribers)

Please let us know if this does any good.

Otherwise, can you post a link to your site?

Regards, Marty (budding s2Member user)
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby johnny g » July 29th, 2010, 8:15 pm

hey, thanks for the reply. My brother that is one of the first things I did and double checked. The wierd thing is the first day several were able to accomplish it but since than, I have been in contact with several that can not through contact form.

I have no problem loging out and entering back in either, so I have know idea what's happening.
User avatar
johnny g
Registered User
Registered User
 
Posts: 10
Joined: July 6, 2010

Re: Registration fields

Postby martonic » July 29th, 2010, 8:31 pm

Well, post a link so we can have a look.
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby johnny g » July 30th, 2010, 12:50 pm

User avatar
johnny g
Registered User
Registered User
 
Posts: 10
Joined: July 6, 2010

Re: Registration fields

Postby martonic » July 30th, 2010, 1:18 pm

Hi, here is the URL for your registration page:

http://beatthestreets.1urbanwarrior.com/wp-login.php?action=register

I see a link to this on your membership options page.

However, you have made ALL FIELDS REQUIRED, including even "Website URL".

This will definitely make it hard for people to register.

Got to s2member -> General Options -> Custom Registration Fields and remove some of those * symbols that are forcing all of your registration fields to be REQUIRED.
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010

Re: Registration fields

Postby johnny g » July 30th, 2010, 10:55 pm

yeah, this time I saw it also.

I have removed astericks from website Url,city and state, left them on zip,just because I like to chart where members will becoming from regionally.

You think this will work okay than?

Thanks for the insight.
User avatar
johnny g
Registered User
Registered User
 
Posts: 10
Joined: July 6, 2010

Re: Registration fields

Postby martonic » July 31st, 2010, 6:54 pm

Hi Johnny,

As long as your users can find the Registration Page, and don't mind entering zip codes, it should work. Good luck with this! Cheers, Marty
User avatar
martonic
Experienced User
Experienced User
 
Posts: 70
Joined: July 14, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 8 guests

cron