
(This post assumes you already own and have installed both Gravity Forms and Gravityview plugins)
This tutorial is an extension of this sign-up tutorial .
The task is the following:
- Create a form that collects student or attendee information
- Generate the list of students or attendants that can be filtered by grade, class etc.
- Allow teachers or admin track attendance on any given day.
- Add the ability to see total days absent, days tardy, etc.
To begin, include the following custom code (which should be inserted into your functions.php file in your child WordPress theme):
function attendance_f($atts = array()) {
$details = shortcode_atts( array(
'form_id' => '204',
'field_num' => '1',
'field_val' => 'xz5et',
'wanted' => '1',
'f_name_field'=>'Jon',
'l_name_field'=>'Smith',
'u_name_field'=>'7',
'date_field' => '3',
'date' => '04/26/2020',
'gv_user_id' =>'6403'
), $atts );
$form_id = $details['form_id'];
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
'mode' => 'all',
array(
'key' => $details['field_num'],
'value' => $details['field_val']
)
,
array(
'key' => $details['date'],
'operator' => 'is',
'value' => date("m/d/Y")
)
)
);
$date = new DateTime();
$date->setTimezone(new DateTimeZone('America/Detroit'));
$fdate = $date->format('Y-m-d');
$f_name=$details['f_name_field'];
$l_name=$details['l_name_field'];
$u_name=$details['u_name_field'];
$countentries = GFAPI::count_entries( $form_id, $search_criteria);
$html = '<button style="margin:10px;background:#008080">Add Attendance</button>';
$amount = $details['wanted'] - $countentries;
$num = do_shortcode('452.'" filter_field2="3" filter_value2="'.$fdate.'"]');
$entries = GFAPI::get_entries( $form_id, $search_criteria );
$signup_name=array();
$attend = implode("<br>",$signup_name);
if($num == 0){
$attend .= do_shortcode('');
}else{
$attend .= do_shortcode('.'"]');
}
return $attend;
}
add_shortcode( 'attendanceform', 'attendance_f' );
Start by creating a Gravity Form to collect student or attendee info
This form should include the following fields:
- Person’s Name (Single Field Type)
- Grade or Group (Single or Dropdown Field Type)
- Personal Unique ID (Hidden Field Type)
Next, create a Gravity Form that the teacher/administrator will fill out when taking attendance.
This form should include the following fields:
- Name of Student/Attendee (Name Field Type)
- Class or Group (Single Field Type)
- Date (Date Field Type)
- Unique ID (hidden)
- Choice of Present or Absent (Radio Field Type)
Create a Gravityview table to display the list of students/attendees.
Add columns using the data source from your initial Gravity Form that collected student/attendee info.
Add a custom content field for the last column in the Gravityview table.

The last column is reserved for the shortcode that will utilize the [attendanceform] custom shortcode added from the beginning of this post. This column will initially contain an “add attendance” button.. It will display the student/attendee attendance status if accounted for.

The shortcode utilizes the following attributes from the initial two forms created in this post:
form_id – (a number value) This should equal the id # of the gravity form used to collect user sign-up info (uses the second form created in this post) My example uses a form who’s id is 237.
field_val (a string value) This should equal the entry id # of the gravity form used to create the slots (uses the first form created in this post). This will utilize the merge tag generated from the Gravityview custom content field. My example uses the merge tag {entry_id}.
field_num (a number value) This should equal the field id # that contains the ‘Unique Id’ from the gravity form used to collect user sign-up info (uses the second form created in this post). My example uses my ‘Unique ID’ field who’s id is 24.
wanted (a number value) This should equal the field id # of the ‘# of Signup slots’ field from the gravity form used to create the slots (uses the first form created in this post). This will utilize the merge tag generated from the Gravityview custom content field. My example uses the merge tag ‘{# Wanted:2}’.
f_name_field (a number value) This should equal the field id # of the first name from the gravity form used to collect user sign-up info (uses the second form created in this post). Gravity Form’s first name field id will contain the field id # with the addition of the decimal ‘.3’. My example uses my form’s name field who’s id is 1 therefore my first name value is “1.3”
l_name_field (a number value) This should equal the field id # of the last name from the gravity form used to collect user sign-up info (uses the second form created in this post)Gravity Form’s first name field id will contain the field id # with the addition of the decimal ‘.6’. My example uses my form’s name field who’s id is 1 therefore my first name value is “1.6”
My full shortcode looks like this:
[signupform form_id=”237″ field_val=”{entry_id}” field_num=”24″ wanted=”{# Wanted:2}” f_name_field=”1.3″ l_name_field=”1.6″]
Next we need to use the Gravityview Single Entry tab to store our User Sign up Form

Add your User Sign Up Gravity Form into a custom content field using the Gavity Form shortcode.
Here’s where you can take advantage of the Gravity Forms shortcode field_values attribute to pre-fill the user sign up form with details from the task. You will need to remember the parameter names set up in step #3 of this post.
The gravityforms id should equal the form id of the User Sign Up form (the second form created in this post). The field_values will equal the parameter names form your form. In my example below, I used the parameter names ‘unique_id‘,’date‘,’starttime‘, and ‘endtime‘:
Gravityview provides merge tags of each entry’s field value that you can use by clicking on the icon to the right of the custom content field
To create a unique id for each sign-up, we will utilize the ‘entry id’ of the entry created in the Sign-up Slots Gravity Form. Just assign the parameter name of the Unique ID field to the Gravityview merge tag {entry_id}
Use the Gravityview merge tag for the date and time fields for the remaining parameters.
Here’s my example:
Oops! We could not locate your form.

User Sign-up Gravity Form.
I suggested sending a notification to both the sender and the coordinator of the signup.
I also recommend the plugin called Delayed Notifications if you’d like to send a reminder close to the sign-up date.

Here is an example of a signup form with multiple sign-up opportunities per/slot
