// Basic usage of how the function is applied: wpmem_set_user_product( $product_meta, $user_id, $date ); /* * The practical example below will set a default * membership for a user when they register. In this * example, it will set access for 'my_basic_product'. * In a real world application, get the slug for the * membership you want to set at registration from the * Membership > All Products table. * * The example uses the 'wpmem_post_register_data' * action to apply the membership at registration. * @see: https://test.rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_post_register_data/ */ add_action( 'wpmem_post_register_data', 'my_set_basic_product' ); function my_set_basic_product( $fields ) { // Defaults. $product_meta = 'my_basic_product'; $user_id = $fields['ID']; // Set product access. wpmem_set_user_product( $product_meta, $user_id ); }
Not sure what to do with this code?
You're not a "coder" and don't know what to do? Don't worry! Code Snippets are the basic building blocks of WordPress customization, and once you know the basics, they are simple to use.
Here are some free articles to get you started:
- Using Code Snippets from the Site
- The functions.php File
- Create a plugin file for custom functions
- Create a child theme
- Do not modify plugin files!
For "hands on" help, consider a plugin support subscription or the Pro Bundle.