@ Tim
How odd because that error message about GD is actually triggered from core a WordPress function that checks that the are installed. I added the actual output of the message primarily for my testing.
As for the state drop downs is is actually even easier that I said. You still make the two changes.
Here’s the code for the first change:
cnHTML::field(
array(
'type' => 'select',
'class' => '',
'id' => 'address[::FIELD::][state]',
'required' => FALSE,
'label' => __( 'State', 'connections' ),
'before' => '<div class="address-state">',
'after' => '</div>',
'options' => cnGEO::US_Regions(),
'return' => FALSE,
)
);
Here’s the code for the second change:
cnHTML::field(
array(
'type' => 'select',
'class' => '',
'id' => 'address[' . $token . '][state]',
'required' => FALSE,
'label' => __( 'State', 'connections' ),
'before' => '<div class="address-state">',
'after' => '</div>',
'options' => cnGEO::US_Regions(),
'return' => FALSE,
),
$address->state
);
I forgot that I already had built in the regions (states) for several countries.
Two caveats … First, unless you were adding states with their two letter abbr and in all caps, editing an entry, you have to select the correct state otherwise I think it’ll simply default to AL. Second, when the states are actually displayed, they’ll be displayed with their abbr instead of the full name. Doing the opposite would require more changes in several areas of code.
