Skip Navigation

[Resolved] Simple Submission for Checking in and out

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Minesh 6 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#605319

On a single content page, I need to have a very simple form that is basically button. When that button is clicked, the "form" is submitted and that date and time is recorded onto the post that the form is on. This allows the person to check in and out and there will be a record of it.

I have a child post of Member and it is called Check Ins/Check Outs. Basically I need each check in/out assigned to the member and then a line item shown on the front end.

I don't know if I am explaining this properly. I think if I had a way to show current members in a dropdown on the check in out cred post form, that might be a good start.

Thank you

#605414

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand you have parent post type set as "Member" and child post type as "Check Ins/Check Outs".

Basically I need each check in/out assigned to the member and then a line item shown on the front end.
==> is Member will be logged in when they do checkin/check out?
OR
I think if I had a way to show current members in a dropdown on the check in out cred post form, that might be a good start.
=> Do you want to display member names list as dropdown?

#605500

The member will not be logged it.

If there is a way on the single content post like on this page: hidden link

to have a simple button (with hidden fields) that have pre selected the Donald McGuinn member and records the date and timestamp in a custom field. When submitted. It shows up below in row.

#605625

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - its possible, could you please tell me where exactly you want to add button or you should add your button and send me access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#605631

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I've further logical question.

I will add the CRED form so that when you click on checkin button it will save the current time in custom field and when you click on checkout it will again save the current time in custom field. But how you want to relate checkin/checkout.
- I mean how you want to manage the checkin/checkout?

Will user click checkin and checkout button at same time - what will be the process?

#605634

The user will search for their name on this page hidden link

The user will click on their name to get to their profile: hidden link

The user will have a check in and a check out button (2 separate buttons)

If the user is checking in, then they will click the check in button. That button will record date and time to the post type timesheets and hopefully it will be associated with their member post as well. Also, bonus if it can be show below the single member content and above the edit member information accordion.

If the user is checking out, then they click check out and the whole process above happens. The system does NOT need to know if they are checked in or out. It just simple needs to record the time and date.

IF IT IS POSSIBLE OR IF EASIER: put the buttons inline with their information on this page instead? hidden link right after youth troupe in two columns.

#605655

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well -

I've adjusted post fields for your timesheet post (both field is date field now):
=> hidden link

I've created two forms:
"Form-time-in":
=> hidden link

"Form-time-out":
=> hidden link

You should visit the above link to see what content I've added to form body.

Then, I've added those form to your view:
=> hidden link

 <div class="member_youth column"><span><strong> Check IN </strong></span>[cred_form form="form-time-in"]</div>
  <div class="member_youth column"><span><strong> Check OUT </strong></span>[cred_form form="form-time-out"]</div>

I've added following code to your current theme's functions.php file:

/* form time in */
add_action('cred_save_data_84', 'save_data_for_time_in',10,2);
function save_data_for_time_in($post_id, $form_data){
	
	update_post_meta( $post_id, 'wpcf-time-in', time() );
	$my_post = array(
    'ID' => $post_id,
    'post_title' => "Time In - Post Belongs Member ID-".$_POST['_wpcf_belongs_member_id'],
    'post_name' => "post-id-".$post_id
  );
 
  // Update the post into the database
  wp_update_post( $my_post );
     
}

/* form time out */
add_action('cred_save_data_85', 'save_data_for_time_out',10,2);
function save_data_for_time_out($post_id, $form_data){
   update_post_meta( $post_id, 'wpcf-time-out', time() );
   
	$my_post = array(
    'ID' => $post_id,
    'post_title' => "Time OUT - Post Belongs Member ID-".$_POST['_wpcf_belongs_member_id'],
    'post_name' => "post-id-".$post_id
  );
 
  // Update the post into the database
 wp_update_post( $my_post );
   
}

Now, I can see that time in and time out entries connected to the member as well as it working fine.

Also, bonus if it can be show below the single member content and above the edit member information accordion.
==> Could you please kindly open a new ticket with your each new question. This will help other users searching on the forum.

#605703

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Is solution I shared working for you?

As You can see I've added two columns to add check in and check out as your described on the following page:
=> hidden link