How to use hooks when registering users
-
I’d like to create a topic with his name at user registration.
What’s wrong with this codeļ¼
function bp_user_fst_topic (){ // get user name $user_data = get_user_by( 'id', bp_loggedin_user_id() )->data; $user_nicename = = $user_data->user_nicename; // create slug $new_slug = 'first-topic-' . $user_nicename; // create topic $post_value = array( 'post_name' => $new_slug, 'post_type' => 'topic', 'post_author' => $userid, 'post_title' => 'first topic', 'post_content' => 'This topic was created when you registered.', 'post_category' => array(1,5), 'tags_input' => array('tag1','tag2'), 'post_status' => 'publish' ); wp_insert_post($post_value); } add_filter( 'bp_core_activated_user', 'bp_user_fst_topic',1 );
Could you tell me how to do this..?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.