Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WC Paid Listings - Give a free package to a new user!
<?php
add_action( 'user_register', 'give_wcpl_user_package_on_registration' );
function give_wcpl_user_package_on_registration( $user_id ) {
global $wpdb;
$wpdb->insert(
"{$wpdb->prefix}wcpl_user_packages",
array(
'user_id' => $user_id,
'product_id' => 0, // This should be set to the ID of a package in WooCommerce if you want it to show a package name!
'package_count' => 0, // Leave
'package_duration' => 30, // How long job listings last
'package_limit' => 1, // How many jobs can be posted for free
'package_featured' => 0, // 0 = not featured
'package_type' => 'job_listing'
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment