Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created January 5, 2011 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/766963 to your computer and use it in GitHub Desktop.
Save spivurno/766963 to your computer and use it in GitHub Desktop.
<?php
add_filter("gform_pre_render", "populate_dropdown");
function populate_dropdown($form){
global $current_user;
get_currentuserinfo();
foreach($form['fields'] as &$field) {
if($field['inputName'] == 'email') {
$email = xprofile_get_field_data('email', $current_user->ID);
$field['choices'] = array(
array('text' => $email, 'value' => $email, 'isSelected' => ''),
array('text' => $email, 'value' => $email, 'isSelected' => ''),
array('text' => $email, 'value' => $email, 'isSelected' => '')
);
}
}
return $form;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment