wpuf_after_register hook question

This topic contains 1 reply and 2 voices, and was last updated by Sekander Badsha 9 years, 7 months ago
Viewing 1 Posts - 1 through 1 (of 1 total)
Author Posts
August 24, 2014 at 8:49 pm 25769
Sekander Badsha Hi there, I'm relatively new to Wordpress development having mainly used plugins for my needs. I don't really understand how a function or a hook works or is called by workdpress, I just see them being used and know that I need to access these features. I have a function which sets a new users Display Name and NickName to be FIRSTNAME LASTNAME just after registration. This function works when I add a new user in the Admin panel. However when the user register through WPUF it does not work. I assume that my function is not being called, or is called before the user exists. When I reviewed the documentation I see there is likely a way I can call this function from WPUF also. What I need is help and guidance to figure out how to 'code' the function and hook to work. I have the function in my functions.php and is as follows: class myUsers { static function init() { // Change the user's display name after insertion add_action( 'user_register', array( __CLASS__, 'change_display_name' ) ); } static function change_display_name( $user_id ) { $user = get_userdata( $user_id ); $name = sprintf( '%s %s', $user->first_name, $user->last_name ); $args = array( 'ID' => $user_id, 'display_name' => $name, 'nickname' => $name ); wp_update_user( $args ); } } I assume I need to use the action wpuf_after_register, but I don't understand where I code this what the parameters need to be when I use it. If I am not correct with this assumption, or there is an easier way to make this work I would love to learn about it. ttfn Jevon
August 25, 2014 at 6:38 pm 25838
Sekander Badsha Sekander Badsha

Hello Jevon,
You can use functions, actions, hooks and filters in your themes function.php file. Here’s the official WordPress Documentation about how to use action http://codex.wordpress.org/Function_Reference/add_action

Viewing 1 Posts - 1 through 1 (of 1 total)