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

  1. _fenrir
    Posted 1 year 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');


  2. Chad Butler
    Plugin Author

    Posted 1 year 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
    Posted 1 year 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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members: Membership Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic