Changeset 120
- Timestamp:
- 11/16/2013 06:24:02 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-mailchimp/addons/camptix-mailchimp.php
r102 r120 182 182 183 183 foreach ( $tickets as $ticket ) { 184 $group_name = apply_filters( 'the_title', $ticket->post_title );184 $group_name = $ticket->post_title; 185 185 186 186 // Look into the current MailChimp groupings and skip adding existing groups. … … 229 229 $grouping_id = absint( $existing_groups['questions'][ $question->ID ] ); 230 230 231 $grouping_name = sprintf( 'CampTix: %s', apply_filters( 'the_title', $question->post_title ) );231 $grouping_name = $this->trim_group( sprintf( 'CampTix: %s', $question->post_title ) ); 232 232 233 233 // Attempt to find the grouping from MailChimp by name. 234 234 if ( ! $grouping_id ) { 235 235 foreach ( $current_groupings as $grouping ) { 236 if ( $grouping_name == $ grouping->name) {236 if ( $grouping_name == $this->trim_group( $grouping->name ) ) { 237 237 $grouping_id = $grouping->id; 238 238 break; … … 245 245 $result = $this->api( 'lists/interest-grouping-add', array( 246 246 'id' => $this->options['mailchimp_list'], 247 'name' => sprintf( 'CampTix: %s', apply_filters( 'the_title', $question->post_title ) ),247 'name' => $grouping_name, 248 248 'type' => 'hidden', 249 249 'groups' => array( 'None' ), // @todo: add groups here vs more api calls … … 264 264 foreach ( $question->tix_values as $group_name ) { 265 265 266 $group_name = $this->trim_group( $group_name ); 267 266 268 // Look into the current MailChimp groupings and skip adding existing groups. 267 269 if ( isset( $current_groupings[ $grouping_id ] ) && ! empty( $current_groupings[ $grouping_id ]->groups ) ) { 268 270 foreach ( $current_groupings[ $grouping_id ]->groups as $group ) { 269 if ( $group_name == $ group->name) {271 if ( $group_name == $this->trim_group( $group->name ) ) { 270 272 continue 2; 271 273 } … … 361 363 else 362 364 $groups = array( $answer ); 365 366 $groups = array_map( 'the_title', $groups ); 367 $groups = array_map( array( $this, 'trim_group' ), $groups ); 363 368 } 364 369 … … 373 378 $groupings[] = array( 374 379 'id' => $existing_groups['tickets'], 375 'groups' => array( apply_filters( 'the_title', $ticket->post_title )),380 'groups' => array( $ticket->post_title ), 376 381 ); 377 382 } … … 460 465 } 461 466 467 public function trim_group( $group_name ) { 468 return trim( substr( $group_name, 0, 50 ) ); 469 } 470 462 471 public function menu_setup_section_mailchimp() { 463 472 _e( 'Your main MailChimp export settings are here. Make sure your API key is valid and active. To obtain your API key, please refer to <a href="http://kb.mailchimp.com/article/where-can-i-find-my-api-key">this article</a>.' );
Note: See TracChangeset
for help on using the changeset viewer.