@ Eric
Pre-population, I like it… I just added a filter to both Form 2.0 and Link 2.0 that will easily allow this to be accomplished.
Assuming you’re using Link 1.0.5, change line 37 to this:
$entry = apply_filters( 'cnl_admin_add_entry_object', new cnEntry() );
Now you’ll be able to hook into the cnl_admin_add_entry_object
filter for pre-population and be ready for Link 2.0 to boot.
Here’s an example on how to use the filter:
add_filter( 'cnl_admin_add_entry_object', 'cnl_alter_add_entry_object' );
add_filter( 'cnf_add_entry_object', 'cnl_alter_add_entry_object' );
function cnl_alter_add_entry_object( $entry ) {
// Add the filters necessary to save data in the cache.
add_filter( 'cn_email_cached', '__return_true' );
add_filter( 'cn_address_cached', '__return_true' );
$entry->setFirstName( 'First' );
$entry->setLastName( 'Last' );
// Setup the email data to prepopulate.
$email = array();
$email[1] = array();
$email[2] = array();
$email[1]['type'] = 'personal';
$email[1]['address'] = 'personal@email.add';
$email[2]['type'] = 'work';
$email[2]['address'] = 'work@email.add';
// Store the email address in the cache.
$entry->setEmailAddresses( $email );
// Setup the address data to prepopulate.
$address = array();
$address[1] = array();
$address[1]['type'] = 'home';
$address[1]['city'] = 'Reading';
$address[1]['state'] = 'PA';
$address[1]['country'] = 'United States of America';
// Store the address data in the cache
$entry->setAddresses( $address );
return $entry;
}
Of course you’ll need to add the code necessary to pull the data from your source for pre-population and some conditional to determine when the to pre-populate because you would want to do it for every single entry with the same data.
Can you tell me where exactly you added the code that renders the instruction text? If it makes sense from a big picture view, I can add an action that can be hooked into to render anything one could dream of before the form.