Re: Plugin update first_name, last_name in wp_usermeta on activation
Mike Pratt, you’re right, that is one way to do it. Then you have the following fields on your registration form: username, name, first name, last name. That is an excellent solution if your aim is to annoy potential members.
Another option is to use the default “fullname” field for first name and create a second one for last name, but then you’re kinda messing with the system and perhaps causing problems in the future. I have already done this solution in an earlier version. It’s my fallback option.
But why would I have to create custom fields when WordPress already has the first_name and last_name fields in wp_usermeta? And there is even a ready-to-use Buddypress function that synchronizes the fields in wp_usermeta with the fullname in BP.
Unfortunately at the moment that function is only run when the user updates his profile, so it’s completely useless. I’m trying to tweak it and make it useful and introduce to Buddypress the wonders of a first_name, last_name in the database. (Wow, I know…)
Also I’d like to get rid of the username on the form, by autogenerating it from the fullname – make lowercase, take out spaces, store as username. That should be a relatively easy next step once I’ve figured out how to use the fullname input from the registration form in a function.
Also I wasn’t able to get bp tags working in a plugin, where I had no problem pulling first_name and last_name from wp_usermeta, providing they were available…
This should be a really easy plugin for any php coder, but as Jeff Sayre has pointed out, having a somewhat clean, professional user registration in Buddypress is reserved for those well-versed in the codebase or with deep-enough pockets.
@Mariusooms, I need to finish the site before Labor Day, with a related event on September 22nd. When will bp1.0.3 be released?
I’ll figure it out somehow, with or without the help of WordPress insiders.