Hi there!
In order to show dedicated portfolio items to each user, I released a simple function which is automatically creating a portfolio category named “tips_username” when a user registers on the website. This is the function I use:
add_action('user_register', 'auto_create_traveltip_category');
function auto_create_traveltip_category($user_id) {
$tip_category_name = 'tips_' . $_POST['user_login'];
wp_insert_term($tip_category_name, 'portfolio_entries', array(
'description' => 'Travel Tips ' . $_POST['user_login'],
'slug' => 'tips-' . $_POST['user_login'],
'parent' => '324',
)
);
}
I would like to make it work with the Free Registration Form too.
I tried to create the file s2-hacks.php in the folder mu-plugin with the following code, but it’s not working.
add_action('ws_plugin__s2member_during_configure_user_registration', 's2m_auto_create_traveltip_category');
function s2m_auto_create_traveltip_category($user_id) {
$tip_category_name = 'tips_' . $_POST['user_login'];
wp_insert_term($tip_category_name, 'portfolio_entries', array(
'description' => 'Travel Tips ' . $_POST['user_login'],
'slug' => 'tips-' . $_POST['user_login'],
'parent' => '313',
)
);
}
I suppose that I’m hacking the wrong function.
Can anybody help with this?
Thanks in advance