[buddypress-trac] [BuddyPress Trac] #5481: Buddypress should set user meta for single sites in bp_core_signup_user
buddypress-trac
noreply at wordpress.org
Thu Mar 27 16:18:30 UTC 2014
#5481: Buddypress should set user meta for single sites in bp_core_signup_user
--------------------------+-----------------------------
Reporter: StijnDeWitt | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version: 1.9.2
Severity: minor | Keywords:
--------------------------+-----------------------------
I am working on a website on which users from different sources will be
logging in. Some are existing users that I will perform custom
authentication on and from code will be creating WordPress / BuddyPress
accounts for (using function bp_core_signup_user). Others will register
themselves in the regular way.
I want to prevent sending activation emails only for those users that are
already registered (and activated if you will) in the external system. I
looked into this subject and came to the conclusion that I should
implement a filter hook for 'bp_core_signup_send_activation_key',
returning false to prevent BuddyPress from sending an activation mail. The
problem I am facing is that inside the filter hook I have no idea where
the user came from originally. I can get access to the current user, but
because BuddyPress only just created that user there is nothing on it that
helps me differentiate.
Before calling bp_core_signup_user, the user does not exist yet, so I
cannot update_user_meta on it... By the time the call to
bp_core_signup_user has completed, my bp_core_signup_send_activation_key
hook has already been called and it's too late.
The solution might be simple. I see that bp_core_signup_user accepts an
argument $usermeta. For multi-sites it just passes this argument on to
wpmu_signup_user which adds it to the user account. However, for single
sites it does something spiffy with it for xprofile, but further ignores
it. If it would add the user meta that remains after updating the user's
xprofile, before calling the action hook, I could just pass on the user's
account type in the $usermeta argument to bp_core_signup_user and then in
my bp_core_signup_send_activation_key hook check this meta. Alternatively,
you could pass on the $usermeta parameter to the
bp_core_signup_send_activation_key directly when calling apply_filters. In
any case I think having access to this meta in the filter hook would be
really useful for other BuddyPress users as well.
The way it is now, I see no other alternative than to either change the
BuddyPress core function, or instead of calling it, copy it to my code and
change it there (which is what I intend on doing).
I consider the fact that BuddyPress attaches the meta for WPMU sites but
not for single sites as a bug. Sorry if I'm wrong about that.
Disclaimer: I'm pretty new to WordPress / BuddyPress so I could be
overseeing some really simple/elegant solution. Don't hesitate to close
this bug if that is the case.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5481>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list