Home Forums Plugin Support WP User Frontend Pro wpuf_after_register hook question

This topic is: resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Sekander Badsha 4 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #25769


    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.




    Sekander Badsha
    Post count: 2067

    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 2 posts - 1 through 2 (of 2 total)

The topic ‘wpuf_after_register hook question’ is closed to new replies.