Custom Fields in usermeta Table
Posted: January 3rd, 2011, 1:14 pm
Hi everyone!
As of now the s2member custom fields get saved as a single, serialized array in the wp_s2member_custom_fields usermeta.
First of all: why is that so?
Then the problem is this:
how do I filter my users based on a s2Member custom field (like "province")?
If it was a simple usermeta field, I could have used a straightforward query like this one:
Given I can't, what's the fastest solution available?
(a "this feature is planned" response is very welcome, of course, but I need a viable solution with the stuff I have at present).
btw Happy new year everybody!
edit: I'm also open to intercepting fields and creating usermeta during the signup process, but what's the exact hook? is there a hook that fires after a successful user registration?
As of now the s2member custom fields get saved as a single, serialized array in the wp_s2member_custom_fields usermeta.
First of all: why is that so?
Then the problem is this:
how do I filter my users based on a s2Member custom field (like "province")?
If it was a simple usermeta field, I could have used a straightforward query like this one:
- Code: Select all
$wp_user_search = $wpdb->get_results("
SELECT u.ID, u.display_name, um.meta_value
FROM $wpdb->users u
JOIN $wpdb->usermeta um ON um.user_id = u.ID
WHERE um.meta_key = 'province'
AND um.meta_value = 'value'
");
Given I can't, what's the fastest solution available?
(a "this feature is planned" response is very welcome, of course, but I need a viable solution with the stuff I have at present).
btw Happy new year everybody!
edit: I'm also open to intercepting fields and creating usermeta during the signup process, but what's the exact hook? is there a hook that fires after a successful user registration?