Created
January 28, 2018 22:09
-
-
Save Idealien/09c18c321ade1e43ac1ce06f586f0b0e to your computer and use it in GitHub Desktop.
GFlow - Specific User Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "gravityflow_user_field", "gflow_request_manager", 10, 3 ); | |
function gflow_request_manager( $choices, $form_id, $field ) { | |
if ( $form_id == 1 && $field->id == 15 ) { | |
$manager = get_user_by('email', get_user_meta(get_current_user_id(), "manager_email", true) ); | |
if( false !== $manager ) { | |
$choices = array( | |
array('value' => $manager->ID, 'text' => $manager->first_name . ' ' . $manager->last_name) | |
); | |
} else { | |
$choices = array( | |
array('value' => 'ERROR', 'text' => 'ERROR') | |
); | |
} | |
} | |
return $choices; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment