0

i have a Channel Form that will allow users to apply for a job post, users are registered and logged in when applying, how can i assign the authorship of that entry to the author of the job post (recruiter)? Right now the form works and reflects the author as the job seeker.

Code:

{exp:channel:entries 
channel="recruiter_job"  
status="open|featured|draft"
require_entry="yes" 
limit="1" 
dynamic="no"
entry_id="{segment_3}" 
disable="trackbacks|pagination"
}

<h3>Applying for : {title} </h3>
<hr>

{exp:channel:form 
channel="application" 
return="/jobs/apply/ENTRY_ID/application" 
include_jquery="yes"
include_assets="yes" 
error_handling="inline" 
preserve_checkboxes="yes" 
class='custom'
datepicker="no"
logged_out_member_id="{author_id}"
}

 {if global_errors}<ul><li>{global_errors}{error}{/global_errors}</li></ul>{/if}

 {embed="includes/title_job" author_id="{author_id}" } {!-- /EMBED AUTHOR ID OF THE RECRUITER--}

 {field:job_application}
{if error:job_application}{error:job_application}{/if}


{/exp:channel:form} 
{/exp:channel:entries}

1 Answer 1

1

So your seeker user is logged in? The logged_out_member_id parameter will not work then.

Try setting author_id with a hidden input, e.g.

<input type="hidden" name="author_id" value="{author_id}" />

If that also does not work, consider having instead a custom field containing member_id of recruiter.

9
  • Hi Yuri, i've removed the logged_out_member_id parameter and added the <input type="hidden" name="author_id" value="{author_id}" /> with an embed. {exp:channel:entries status="open|featured|draft" dynamic="no" channel="recruiter_job" limit="1"} <input type="hidden" name="title" value="{title}"/> <input type="hidden" name="author_id" value="{author_id}" /> <input type="hidden" name="author" value="{screen_name}" /> {/exp:channel:entries} now i get this error "You are not authorized to perform this action" Nov 27, 2015 at 11:22
  • Can you update the post above with how your embed code looks like and how you reference the embed? The excerpt you posted above seems incomplete (and SE comments don't allow nice code formatting...) Nov 27, 2015 at 12:06
  • SE comments don't allow nice code formatting, same here..embed code is {exp:channel:entries status="open|featured|draft" dynamic="no" channel="recruiter_job" limit="1"} <input type="hidden" name="title" value="{title}"/> <input type="hidden" name="author_id" value="{author_id}" /> <input type="hidden" name="author" value="{screen_name}" /> {/exp:channel:entries} Pastie: pastie.org/10583954 Nov 27, 2015 at 12:15
  • The code you pasted does not reflect the embed that you reference. Nov 27, 2015 at 13:02
  • The "You are not authorized to perform this action" might be because one of the user does not have permissions to post to channel or can't edit entries authored by others. Nov 27, 2015 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.