You will need to generate it for the admin page too, and place there by s2M’s action hooks.
Thanks very much for the reply!
Would you be able to provide a link/guide on how to do that? I’ve no clue how to do this 🙁
You must create a function, I will name it “show_dropdown”, which will show the dropdown list, and hook it to the “edit user” admin page by this hook inside s2M:
add_action('ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields', 'show_dropdown', 10, 2);
Also this field must be saved, this need another function “save_dropdown”, which can be hooked like this:
add_action('init', 'save_dropdown');
or like this:
add_action("edit_user_profile", "save_dropdown");
add_action("edit_user_profile_update", "save_dropdown");
Note, that different “hooking” may need different way of saving.
Sorry for the delay, thanks again for the response. I’ll be trying this today/tomorrow to see how it works! Currently I semi-resolved the issue by creating the fields in s2member, hiding them with css, and adding the same ID names to my custom fields, but obviously this isn’t exactly a good solution.
So, this does print out the dropdown list on the bottom of the user edit page on the admin end, which is very cool! However saving them doesn’t appear to have any effect 🙁
Here’s a snippet of the save function:
$_p = stripslashes_deep($_POST);
if (!empty($_p['xp_category']) && is_string($_p['xp_category']))
update_user_option($user->ID, 'xp_category', esc_html($_p['xp_categories']));
In addition, I notice that adding a new user from the admin end doesn’t show the fields – would you or anyone else happen to know the correct s2member hook for this one? Thanks!
Is the saving function works? Where you get the $user object?
For hooks, best is to search in s2M codes.
Saving doesn’t work. Sorry, maybe a newbie mistake here –
$user = $vars['user'];
Shouldn’t vars carry over any variables used by s2member in the hook? In this case, the user -> ID for the option updates.
At any rate, I did some more research and discovered this hook:
ws_plugin__s2member_before_custom_field_gen
This guide indicates that adding my field (or simply modifying an s2member profile field via php) through this hook would basically add it to all relevant functions – saving, editing, etc.. I emulated what Jason is doing here and it doesn’t appear to do anything at all, though…