the classes of interest (no pun intended) are
MC4WP_MailChimp
MC4WP_MailChimp_List
MC4WP_MailChimp_Interest_Category
if you find the relevant files you can inspect the methods and attributes you need.
Here is a code snippet..
/**
* Get the list with the required name (case insensitive)
*
* @param $mailchimp MC4WP_MailChimp
* @return MC4WP_MailChimp_List
*/
function get_mailchimp_list( $mailchimp, $list_name ) {
$lists = $mailchimp->get_lists();
foreach( $lists as $list ) {
if( strcasecmp( $list->name, $list_name ) == 0 ) {
return $list;
}
}
log_message( ‘ERROR: No list found = ‘ . $list_name );
return null;
}
/**
* Get the interest category with the required name (case insensitive)
*
* @param $list MC4WP_MailChimp_List
* @return MC4WP_MailChimp_Interest_Category
*/
function get_mailchimp_category( $list, $category_name ) {
// $category is of type MC4WP_MailChimp_Interest_Category
foreach( $list->interest_categories as $category ) {
if ( strcasecmp( $category->name, $category_name ) == 0 )
return $category;
}
log_message( ‘ERROR: No category found = ‘ . $category_name );
return null;
}
function your_fucntion() {
$mailchimp = new MC4WP_MailChimp();
$list = get_mailchimp_list( $mailchimp, ‘your_list_name’ );
if ( !isset( $list) || $list == null ) {
return false;
}
$category = get_mailchimp_category( $list, ‘your_category_name’ );
if ( $category == null ) {
return false;
}
// the list id is here! .. etc.
$list_id = $list->id;
// do some more interesting stuff….
}
hope that helps – Jerry