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 / mailpoet-integration.php

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

40 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 * MailPoet ↔ Form Builder: enable field type + publish local lists.
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' => 'MailPoet Subscribe',
12 'bridge_key' => 'mailpoet',
13 'settings_url' => '',
14 'lists' => 'wppb_in_mpi_fb_get_lists',
15 ) );
16
17 /**
18 * MailPoet lists for the editor selector.
19 *
20 * @return array[] `[ { value, label } ]`
21 */
22 function wppb_in_mpi_fb_get_lists() {
23 $lists = array();
24 if ( function_exists( 'wppb_in_mpi_get_lists' ) ) {
25 $raw = wppb_in_mpi_get_lists();
26 if ( is_array( $raw ) ) {
27 foreach ( $raw as $list ) {
28 if ( ! is_array( $list ) ) continue;
29 $id = isset( $list['id'] ) ? $list['id'] : ( isset( $list['list_id'] ) ? $list['list_id'] : '' );
30 if ( $id === '' ) continue;
31 $lists[] = array(
32 'value' => (string) $id,
33 'label' => isset( $list['name'] ) ? $list['name'] : (string) $id,
34 );
35 }
36 }
37 }
38 return $lists;
39 }
40