Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP Job Manager - Change registration flow for Adding a job lisitng

Tags:

php

wordpress

I am looking for a way or some advice on how to achieve the following.

I want to be able to change to flow of how a user registers for adding a job lisitngs. The current flow is as follows

  1. User adds job details
  2. User then hits the "preview" button
  3. At this point, the user is prompted to either log in or register.
  4. User logs in or registers
  5. User then sees the previewed item
  6. User submits listing

What I want to have happen is ad follows:

  1. User adds job details
  2. User hits the "preview" button
  3. User sees the previewed items
  4. User tries to submit listing
  5. System only now prompts the user for a login or register
  6. User logs in/registers
  7. Listing is submitted

Now I know we can disable the user register field on the add listing page by using the following code to our functions.php:

add_filter( 'submit_job_form_show_signin', '__return_false' );

But I can't find a way anywhere on how to ask for the registration/login from the submit button on the preview page, any have any idea how I would go about achieving this?

Regards,

like image 765
Johan Rheeder Avatar asked May 16 '16 22:05

Johan Rheeder


1 Answers

I know this is an old post but hope this can help. There are noticeably a few filters & actions in wp job manager you can hook to insert login/ register form in job submit flow.

However, merely disabling the login form from the submit form they way your doing by adding below filter is not a good idea:

 `add_filter( 'submit_job_form_show_signin', '__return_false' );` 

Note: WP Job Manager Submit Form template checks for the below capabilities before rendering the job submit form(So don't forget to set access for guest user)

<?php if ( job_manager_user_can_post_job() || job_manager_user_can_edit_job( $job_id ) ) : ?>

A better way to manipulate job submission flow is, I think through Steps wizard or through the following filter: submit_job_steps

hook to above filter to modify the flow, just change the priority of following callbacks submit, preview and done:

$this->steps  = (array) apply_filters( 'submit_job_steps', array(
            'submit' => array(
                'name'     => __( 'Submit Details', 'wp-job-manager' ),
                'view'     => array( $this, 'submit' ),
                'handler'  => array( $this, 'submit_handler' ),
                'priority' => 10
                ),
            'preview' => array(
                'name'     => __( 'Preview', 'wp-job-manager' ),
                'view'     => array( $this, 'preview' ),
                'handler'  => array( $this, 'preview_handler' ),
                'priority' => 20
            ),
            'done' => array(
                'name'     => __( 'Done', 'wp-job-manager' ),
                'view'     => array( $this, 'done' ),
                'priority' => 30
            )
        ) );

However, if you still wish to go the path you are doing (Note recommended) you can do so by modifying the WP-Job-Manager/templates/job-preview.php, add the below line to the end.

<?php get_job_manager_template( 'account-signin.php' ); ?>
like image 80
Amar Pratap Avatar answered Nov 15 '22 14:11

Amar Pratap