[wp-hackers] Members Database

Otto otto at ottodestruct.com
Mon Jun 28 21:37:37 UTC 2010


You'll definitely have an easier time using the users and the usermeta
table. Why reinvent the wheel? You can use the
profile_personal_options action hook to add fields for people to put
in or change their data that is not part of the normal metadata.

You *could* use a custom table and then write your own authenticate
filter to allow people to login using it though, if you really had a
need to do that. However, for them to be "logged in", they'll still
need an entry in the users table.

Here's an example of using the authenticate filter:

add_filter('authenticate','custom_login_check',30,3);

function custom_login_check($user, $name, $pw) {
	if ( is_a($user, 'WP_User') ) { return $user; } // check if user is
already logged in
... do stuff here with $name and $pw to check which user id in the
users table it is ...
	$user = new WP_User($user_id);
	return $user;
}


-Otto



On Mon, Jun 28, 2010 at 4:18 PM, Alex Hempton-Smith
<hempsworth at gmail.com> wrote:
> Yes, each member will have quite a bit of meta (mailing address, telephone)
> which I was going to have as usermeta, would it be unwise to do that? I keep
> hearing that with the flexibility of WP core its inadvisable to create
> tables, that you can achieve it all under the hood.
>
> The first iteration of the membership database was a custom table, but that
> was before we needed to have WP user accounts. Also, the usermeta system
> built in is far more flexible if we need to add extra stuff in later...
>
> -- Alex  (Hempsworth)
>
>
> On Mon, Jun 28, 2010 at 10:11 PM, Brian Layman <bulk at thecodecave.com> wrote:
>
>> You could certainly hack something in and use the WordPress user table and
>> user meta. However, if your full membership list is something totally
>> separate from your WP/BP list - I'd be tempted just to maintain it in a
>> seperate table with the specific columns you need.  I would assume that you
>> have data like mailing address, home address, phone number and etc that
>> isn't needed in WP/BP.  I think I'd keep all that separate and maybe have a
>> field for WordPress ID in that table.
>>
>> It's hard to make a recommendation without knowing the situation better,
>> but
>> that's my first thought.
>>
>> ______________________________________________
>> Brian Layman
>> eHermits, Inc.
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list