Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] Building a "Apply to this job" button, not form, with CRED

$
0
0
I assume your post type candidate is using slug "candidate", and each user only have one post in it, you can try this to
1) "get post of type candidate where author = current user"
global $current_user;
$args = array( 'author' => $current_user->ID, 'post_type'=> 'candidate');
$myposts = query_posts($args);
if ( have_posts() ) {
while ( have_posts() ) : $candidate_id = get_the_ID();;
endwhile; 
}
echo $candidate_id; // the post ID of post type candidate where author = current user

http://codex.wordpress.org/Function_Reference/query_posts

2) assign this post as parent of the job-application post created by this form
I assume your post type job-application is using slug "job-application", you can try like this:

add_post_meta($post_id, '_wpcf_belongs_job-application_id', $candidate_id, true);

http://codex.wordpress.org/Function_Reference/add_post_meta


Viewing all articles
Browse latest Browse all 20145

Trending Articles