gravityflow_inbox_submitter_name

Description

The gravityflow_inbox_submitter_name filter can be used to override the value which appears in the Submitter column of the Workflow Inbox.

Parameters

ParameterTypeDetails
$submitter_nameStringThe display_name of the logged-in user who submitted the form or the guest ip address.
$entryEntryThe entry object for the row currently being processed.
$formFormThe form object for the current entry.

Examples

Replace the Submitter IP address with a value from a form

This example shows how you can replace the submitter ip address, stored in the entry created_by value when a non-logged in user submits the entry, with the value from a form field, such as a Name field.

add_filter( 'gravityflow_inbox_submitter_name', 'inbox_submitter_name', 10, 3 );
function inbox_submitter_name( $submitter_name, $entry, $form ) {
    if ( ! is_numeric( $entry['created_by'] ) ) {
        if ( $form['id'] == 2 ) {
            $submitter_name = rgar( $entry, '1.3' ) . ' ' . rgar( $entry, '1.6' );
        }
    }

    return $submitter_name;
}

Replace the Submitter Display Name with their User ID

add_filter( 'gravityflow_inbox_submitter_name', 'inbox_submitter_name', 10, 3 );
function inbox_submitter_name( $value, $entry, $form ) {
	if ( is_numeric( $entry['created_by'] ) ) {
		return $entry['created_by'];
	}
	return $value;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?