Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pending payment jobs not showing in the job dashboard #2127

Closed
3 tasks done
Gnodesign opened this issue Mar 7, 2021 · 10 comments
Closed
3 tasks done

Pending payment jobs not showing in the job dashboard #2127

Gnodesign opened this issue Mar 7, 2021 · 10 comments

Comments

@Gnodesign
Copy link
Collaborator

Gnodesign commented Mar 7, 2021

Describe the bug
Not sure if this should be handled via WC Paid Listings but since the Job Dashboard is handled by WPJM I will just submit this issue here.

If a user decides to leave the page during job submission while they are on the checkout page the job is saved as "pending_payment" in the backend but can not be shown in the job dashboard. This is confusing for users because they think the job never got saved and they have to refill everything again.

We can add the "pending_payment" status via the 'job_manager_get_dashboard_jobs_args' filter but I think this would be a lot better if it were supported by the plugin to allow users to continue their submission as it happens with pending jobs (when the option is enabled).

private function get_job_dashboard_query_args( $posts_per_page = -1 ) {
$job_dashboard_args = [
'post_type' => 'job_listing',
'post_status' => [ 'publish', 'expired', 'pending', 'draft', 'preview' ],
'ignore_sticky_posts' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => 'date',
'order' => 'desc',
'author' => get_current_user_id(),
];

To Reproduce
Steps to reproduce the behavior:

  1. WC Paid Listings required
  2. Start a job submission & leave the page on checkout
  3. Go to Job Dashboard

Expected behavior

  • Show "pending_payment" jobs in the job dashboard
  • Allow users to "continue submission" from the job dashboard (if pending edits

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only WP Job Manager plugin is active.
  • This bug happens with a default WordPress theme active.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

  • WordPress Version: 5.6.2
  • WP Job Manager Version: 1.35.0
  • PHP Version:
@Hastibe
Copy link

Hastibe commented Mar 25, 2021

Yes, could this please be prioritized? I reported this to WPJM support almost a year ago (in May 2020) and a separate issue about this was opened by another user in June 2020. Is anyone working on this? Can anyone?

@Gnodesign
Copy link
Collaborator Author

@Hastibe in case you need to show "pending_payment" jobs in your job dashboard you can use the following snippet:
https://gist.github.com/Gnodesign/adfa7778b1c5d246549cd57e196ad3ea

Just a work around, there should be native support for this though.

@Hastibe
Copy link

Hastibe commented Apr 10, 2021

@Gnodesign -- thanks so much for sharing this! The concern with this snippet to show "Pending Payment" jobs in the job dashboard is that it doesn't provide an obvious way for customers to resume submitting a pending payment job from the dashboard--when hovering over it in the dashboard, pending payment jobs just provide the option to "Edit" them or "Delete" them, instead of providing a "Continue Submission" option (like there is for "Draft" jobs), so that they can actually submit the pending payment jobs.

Any chance that you (or someone else here) would be familiar with how to modify the snippet to provide an option like this for "Pending Payment" jobs shown on the jobs dashboard?

@Gnodesign
Copy link
Collaborator Author

The snippet I provided only adds the "Pending Payment" jobs in the job dashboard with no extra actions. You could add a "Continue Submission" action for these jobs via the snippet below:
https://gist.github.com/Gnodesign/c7b4023e61d7a10184195d1980ac8c13

Hope this helps. :)

@Hastibe
Copy link

Hastibe commented Apr 12, 2021

Oh wow, this is terrific, @Gnodesign -- thank you so much! Are you using these snippets yourself? If so, any issues that have come up with them for you or employers?

@Gnodesign
Copy link
Collaborator Author

You are welcome @Hastibe ! :)

Not really, I created this for customers that are using my theme (Cariera). I know that there are quite a few of them that are currently using the snippets on their live sites, there hasn't been any issues/reports so far. For now this is the best workaround, hopefully there will be native support for this at some point.

@tripflex
Copy link
Collaborator

I recommend using this code snippet instead, to have a continue_pending_payment instead of hooking into native continue which is meant for draft or preview statuses:

function cariera_job_manager_my_job_actions( $actions, $job_id ) {

	$job = get_post( $job_id );

	$base_nonce_action_name = 'job_manager_my_job_actions';

	if ( $job->post_status === 'pending_payment' ) {
		$actions['continue_pending_payment'] = [
			'label' => __( 'Continue Submission', 'wp-job-manager' ),
			'nonce' => $base_nonce_action_name,
		];
	}

	return $actions;
}

add_filter( 'job_manager_my_job_actions', 'cariera_job_manager_my_job_actions', 10, 2 );

add_action( 'job_manager_job_dashboard_do_action_continue_pending_payment', 'smyles_check_continue_pending_payment' );

function smyles_check_continue_pending_payment( $job_id ){
	wp_update_post( [ 'ID' => $job_id, 'post_status' => 'draft' ] );
	wp_safe_redirect( add_query_arg( [ 'job_id' => absint( $job_id ) ], job_manager_get_permalink( 'submit_job_form' ) ) );
	exit;
}

This will set the status back to draft and then continue the submission as if it were a draft/preview status

@onubrooks
Copy link
Contributor

onubrooks commented Jun 1, 2022

Some work has started here. Adding this to the 1.36.0 milestone as one of the fixes for our next release.

@Gnodesign
Copy link
Collaborator Author

@onubrooks This has already been fixed with WCPL 2.9.5.

@onubrooks
Copy link
Contributor

Closing this since it has already been fixed with WCPL 2.9.5. Thanks for informing me @Gnodesign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants