Support » Plugin: WP-Members: Membership Framework » Register Hook

  • Resolved _fenrir


    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');

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler


    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.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Register Hook’ is closed to new replies.