• Hi Guys

    Could someone give me some ideas on where to place some code to redirect the user, after they have submitted their application?

    I am asking because we need the user to send us a file, but not by uploading it to the server ( like broadbean used to work )

    We want to redirect the user to another page to do the file sending via another plugin, that emails the files directly & securely, rather than being stored in the media folders on the server.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mark Wilkinson

    (@wpmarkuk)

    Hi there,

    If you have updated to the latest version of the plugin, any application uploads are deleted from the server after the email is sent over to Broadbean, for new applications.

    You could, of course, remove the application form altogether and create your own application form.

    In terms of redirect users after they have submitted their application you could use the wpbb_after_application_form_processing hook here:

    https://github.com/highrisedigital/wpbroadbean/blob/master/functions/application-form.php#L379

    Attaching a function that hook will run that code, however, it would mean that the deleting of attachment would not happen as the code runs after this hook, and you would be redirecting and exiting at this point. There in your function hooked at this point you would need to delete the attachment as well.

    I hope that helps.

    Thread Starter mattqssit

    (@mattqssit)

    Hi Mark

    Thanks for replying so quickly.

    As i understand, the way it works now with the attachment is deleted, and never gets to the website owner ( because the url that would be given in the email for the attachment is invalid link to the wp-content/uploads/ media directory )

    The owner of the website still needs to see the attachment, but does not want it hosted on the server due to GDPR.

    So my idea was this…

    1. comment out attachment code from the application form ( which i have done already )
    2. comment out the validation for the file upload ( so user doesn’t see error message )
    3. Once user applies for application, to redirect to another page where they can upload their CV from another form ( something like a basic contact form with file attachment, which sends directly to website owner, bypassing file uploading to server )

    Thanks

    Matt

    Thread Starter mattqssit

    (@mattqssit)

    I cannot get it to redirect, i’ve tried using a php header redirect, also a meta redirect.

    Both fail to redirect..

    I’m not great with php coding, so could you give me some pointers to correct this ?

    I have put the code like this :

    
    		/**
    		 * @hook wpbb_after_application_form_processing
    		 * @param int $wpbb_application_id 	the application post id of the application submitted
    		 * @param obj $job_post the post object for the job being applied for
    		 */
    		do_action( 'wpbb_after_application_form_processing', $wpbb_application_id, $job_post );
    		
    		echo "<meta http-equiv='refresh' content='0;URL=https://www.domain.co.uk/cv-upload'>";
    		
    
    		// should we remove the application cv just uploaded
    		if( true === wpbb_maybe_remove_application_attachments() ) {
    			
    			// lets remove the file that was just uploaded
    			$attachment_deleted = wp_delete_attachment( $wpbb_attach_id, true );
    Plugin Author Mark Wilkinson

    (@wpmarkuk)

    From your answer above, it seems as though you want a couple of things:

    1. Application confirmation emails to go to the client as well as Broadbean
    2. Application attachments not to be saved in WordPress

    The email that is sent when an application is completed goes to Broadbean. This has to happen or the application cannot be tracked in Broadbean. This email contains the CV attachment upload in the form.

    Therefore to solve the first item above, I think all you need to do is to add in a CC address for each of the confirmation emails sent to Broadbean. You can do that by using the wpbb_application_email_headers filter which can be seen here:

    https://github.com/highrisedigital/wpbroadbean/blob/master/functions/application-form.php#L367

    You would need to add a CC header into that array.

    In terms of point 2 above, the plugin already handles this as of now, since the attached file is deleted from the server once the email is sent.

    Another thing to remember is that you should not be editing the actual plugin files as when you update the plugin any of your changes will be lost.

    Any customisations you make through the use of actions and filters should be placed, either in a plugin of your own, or your themes functions.php file. If you want to understand WordPress hooks, actions and filters, I wrote a blog post all about this which is here:

    https://highrise.digital/blog/wordpress-hooks-action-filters/

    Thread Starter mattqssit

    (@mattqssit)

    Hi Mark

    Thanks for the reply. Unfortunately i’m not very good at php and basically have to “wing it” sometimes. So talking about hooks and adding functions is not something i’m going to be able to do in the short time i have to put a fix on this website.

    All i really need to do is redirect away from the application page once it’s submitted.

    I am in charge of the website, so editing the plugin code directly won’t be a problem with code being over written once i have it working.

    I have tried calling a header redirect like this… and it still does not redirect..

    /**
    		 * @hook wpbb_after_application_form_processing
    		 * @param int $wpbb_application_id 	the application post id of the application submitted
    		 * @param obj $job_post the post object for the job being applied for
    		 */
    		
    		$redirect = header("Location: https://www.domain.co.uk/cv-upload");
    		
    		do_action( 'wpbb_after_application_form_processing', $wpbb_application_id, $job_post, $redirect );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add code to redirect to another page after application submitted’ is closed to new replies.