WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Register Hook (3 posts)

  1. _fenrir
    Member
    Posted 6 months ago #

    I can't seem to get the register hook to work. I have included the code below in my theme functions.php. I'm trying to add active, paid and notes to the wp_usermeta table on registration. Any ideas where I might be going wrong here?

    /**
     * Hook WP Members new registration data and append fields
     *
     */
    function my_register_data($fields) {
    	// Append fields to array and return
    	$fields['active']  	= 0;
    	$fields['paid']  	= 0;
    	$fields['notes'] 	= 'This member has no notes yet.';
    
    	return $fields;
    }
    
    add_filter('wpmem_register_data', 'my_register_data');
    ?>

    http://wordpress.org/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 6 months ago #

    If those fields don't exist in the WP-Members fields manager tab, you won't be able to add them by just adding to the array with that filter. You could do it with the wpmem_post_register_data action which comes after the user is inserted. At that point, you would have $fields['ID'] available and could just insert each of these with add_user_meta.

  3. _fenrir
    Member
    Posted 6 months ago #

    Excellent, thank you. The wpmem_post_register_data action worked for me. Great work on the plugin and thanks again for the quick response.

Reply

You must log in to post.

About this Plugin

About this Topic