PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / form-builder / integrations / mailchimp-integration.php

mailchimp-integration.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 4.0.3, at form-builder/integrations/mailchimp-integration.php

37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MailChimp ↔ Form Builder: enable field type + publish cached lists to the editor.
4 */
5
6 if ( ! defined( 'ABSPATH' ) ) exit;
7
8 // Loaded via wppb_fb_load_addon_integrations(); do not include directly.
9
10 wppb_fb_register_subscribe_bridge( array(
11 'field_type' => 'MailChimp Subscribe',
12 'bridge_key' => 'mailchimp',
13 'settings_url' => admin_url( 'admin.php?page=profile-builder-mailchimp' ),
14 'lists' => 'wppb_in_mci_fb_get_lists',
15 ) );
16
17 /**
18 * MailChimp lists for the editor selector.
19 *
20 * @return array[] `[ { value, label } ]`
21 */
22 function wppb_in_mci_fb_get_lists() {
23 $settings = get_option( 'wppb_mci_settings' );
24 $valid = get_option( 'wppb_mailchimp_api_key_validated', false );
25
26 $lists = array();
27 if ( $valid && ! empty( $settings['lists'] ) && is_array( $settings['lists'] ) ) {
28 foreach ( $settings['lists'] as $list_id => $list ) {
29 $lists[] = array(
30 'value' => (string) $list_id,
31 'label' => isset( $list['name'] ) ? $list['name'] : (string) $list_id,
32 );
33 }
34 }
35 return $lists;
36 }
37