PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Set a default state dynamically

  1. I know I am doing this wrong, but I am trying to set a default state based on a value in a table. Here's what I have in my functions.php file:

    add_filter('gform_field_value_fhstate', 'fhpopulate_state');
    function fhpopulate_state($value){
    global $wpdb;
    global $current_user;

    get_currentuserinfo();
    $myresult = $wpdb->get_var('select state from fh_contact where user_login="'.$current_user->user_login.'"');

    return $myresult;
    }

    All of my other fields that are text fields, it works great. But how would I do this for the state select field?

    Thanks!

    Posted 11 years ago on Saturday June 1, 2013 | Permalink