Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Core pieces to get assignee info into Gravity Flow status
<?php
add_filter( 'gravityflow_columns_status_table', 'custom_column_titles', 10, 3 );
function custom_column_titles( $columns, $args, $table ) {
$new_column = array(
'assignees' => 'Assignee(s)',
);
$pre_columns = array_slice( $columns, 0, 2 );
$post_columns = array_slice( $columns, 2 );
$columns = array_merge( $pre_columns, $new_column, $post_columns );
return $columns;
}
add_filter( 'gravityflow_field_value_status_table', 'custom_column_field_values', 10, 4 );
function custom_column_field_values( $value, $form_id, $column_name, $entry ) {
if ( $column_name == 'assignees' ) {
$api = new Gravity_Flow_API( $form_id );
$step = $api->get_current_step( $entry );
if( $step !== false ) {
$assignees = $step->get_assignees();
if ( $assignees ) {
foreach( $assignees as $assignee) {
if( $assignee->get_type() === 'user_id' ) {
$value .= "<ul>";
$value .= "<li><strong>KEY</strong>: " . $assignee->get_key() . '</li>';
$value .= "<li><strong>TYPE</strong>: " . $assignee->get_type() . '</li>';
$value .= "</ul>";
}
}
}
}
}
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.