Home › Forums › Plugin Support › Different type of registration
Tagged: registration
- This topic has 7 replies, 2 voices, and was last updated 10 years, 11 months ago by pixel016.
-
AuthorPosts
-
January 17, 2014 at 5:05 pm #4618January 18, 2014 at 4:44 pm #4631pixel016Member
Nobody can help me ?
January 18, 2014 at 5:38 pm #4632SupportMemberHello,
First of all, custom post type “artist” could not treat as user because they are post. You can create two roles: artist and booker in your site and use two different UMP registration form for them. And after artist registration, you can use UMP hook to create custom post type for each artist.(UMP don’t have visual solution to deal with post), or redirect user to specific page where they can fill up there post data.
Thanks.
January 18, 2014 at 7:05 pm #4634pixel016MemberThank you very much for your help.
Can you explain to me how to use UMP hook to create custom post type for each artist ?
Thanks
January 19, 2014 at 6:56 am #4636SupportMemberHello, These are some example code. You can use customize these code as your need.
add_action( 'user_meta_after_user_register', 'createNewPost' ); function createNewPost( $response ){ global $userMeta; $userID = $response->ID; $user = new WP_User( $userID ); $role = $userMeta->getUserRole(); if( $role = 'artist' ){ // Assume you have custom role named 'artist' $newPost = array( 'post_title' => 'New post', // You can use user data here, for first_name: $user->first_name 'post_content' => 'This is a new post.', 'post_status' => 'publish', 'post_author' => $userID, 'post_type' => 'artist', // Assume, you have a custom post type named 'artist' ); wp_insert_post( $newPost ); } }
Thanks.
January 19, 2014 at 4:17 pm #4638pixel016MemberHooo perfect ! Thanks you very much for you help, really !
King regards
January 23, 2014 at 5:35 pm #4667pixel016MemberI have a last question :
I can’t set terms of my custom taxonomy. If i use this code :
$userID = $response->ID; $user = new WP_User( $userID ); $role = $userMeta->getUserRole(); //$catId = get_cat_ID("dj"); if( $role = 'artiste' ){ $newPost = array( 'post_title' => $user->nickname, 'post_content' => $user->description, 'post_status' => 'pending', 'post_author' => $userID, 'post_type' => 'cpt_artists', 'tax_input' => array('artist-category' => array('dj') )); $post_id = wp_insert_post( $newPost ); wp_set_post_terms( $post_id, array( 'dj'), 'artist-category'); }
It doesn’t work.
I test this :
wp_get_post_terms($post_id, 'artist-category', array("fields" => "all"));
and the result is :
WP_Error Object ( [errors] => Array ( [invalid_taxonomy] => Array ( [0] => La taxinomie est invalide ) ) [error_data] => Array ( ) )
Why my custom taxonomy “artist-category” is invalid ??
January 24, 2014 at 4:35 am #4670pixel016MemberI think i can’t use the custom taxonomy because i’m on the functions.php file and this file is loaded before init.
Can you help ?
-
AuthorPosts
- You must be logged in to reply to this topic.