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 / features / email-customizer / admin-email-customizer.php

admin-email-customizer.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 4.0.3, at features/email-customizer/admin-email-customizer.php

173 lines 7.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) ) exit;
4
5 /**
6 * Function that creates the Admin Email Customizer menu
7 *
8 * @since v.2.0
9 *
10 * @return void
11 */
12 function wppb_admin_email_customizer_submenu(){
13 $args = array(
14 'menu_title' => __( 'Admin Email Customizer', 'profile-builder' ),
15 'page_title' => __( 'Admin Email Customizer Settings', 'profile-builder' ),
16 'menu_slug' => 'admin-email-customizer',
17 'page_type' => 'submenu_page',
18 'capability' => 'manage_options',
19 'priority' => 10,
20 'parent_slug' => 'profile-builder'
21 );
22
23 new WCK_Page_Creator_PB( $args );
24 }
25 add_action( 'admin_menu', 'wppb_admin_email_customizer_submenu', 1 );
26
27 add_action( 'wck_before_meta_boxes', 'wppb_add_tabs_on_top_of_admin_email_page' );
28 function wppb_add_tabs_on_top_of_admin_email_page( $hookname ){
29 if( $hookname == 'profile-builder_page_admin-email-customizer' ){
30
31 if( isset( $_GET['mustache_action'] ) && $_GET['mustache_action'] == 'save' ) { ?>
32 <div id="setting-error-settings_updated" class="updated settings-error notice">
33 <p><strong><?php esc_html_e( "Settings saved.", 'profile-builder' ); ?></strong></p>
34 </div>
35 <?php
36 }
37
38 wppb_generate_settings_tabs();
39 }
40 }
41
42 /* on the init hook add the mustache boxes */
43 add_action( 'init', 'wppb_admin_email_customizer_add_mustache_in_backend', 11 );
44 /**
45 * Function that ads the mustache boxes in the backend for admin email customizer
46 *
47 * @since v.2.0
48 */
49 function wppb_admin_email_customizer_add_mustache_in_backend(){
50 if( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/assets/lib/class-mustache-templates/class-mustache-templates.php' ) )
51 require_once( WPPB_PAID_PLUGIN_DIR . '/assets/lib/class-mustache-templates/class-mustache-templates.php' );
52 elseif( file_exists( WPPB_PLUGIN_DIR . '/assets/lib/class-mustache-templates/class-mustache-templates.php' ) )
53 require_once( WPPB_PLUGIN_DIR . '/assets/lib/class-mustache-templates/class-mustache-templates.php' );
54
55 $fields = array(
56 array(
57 'id' => 'wppb_admin_emailc_common_settings_header', // field id and name
58 'type' => 'header', // type of field
59 'default' => __( 'These settings are also replicated in the "User Email Customizer" settings-page upon save.', 'profile-builder' ).' '.__( 'Valid tags {{reply_to}} and {{site_name}}', 'profile-builder'), // type of field
60 ),
61 array(
62 'label' => __( 'From (name)', 'profile-builder' ), // <label>
63 'desc' => '', // description
64 'id' => 'wppb_emailc_common_settings_from_name', // field id and name
65 'type' => 'text', // type of field
66 'default' => '{{site_name}}', // type of field
67 'desc' => '',
68 ),
69 array(
70 'label' => __( 'From (reply-to email)', 'profile-builder' ), // <label>
71 'desc' => '', // description
72 'id' => 'wppb_emailc_common_settings_from_reply_to_email', // field id and name
73 'type' => 'text', // type of field
74 'default' => '{{reply_to}}', // type of field
75 'desc' => __( 'Must be a valid email address or the tag {{reply_to}} which defaults to the administrator email', 'profile-builder' ),
76 ),
77 );
78 new PB_Mustache_Generate_Admin_Box( 'aec_common_settings', __( 'Common Settings', 'profile-builder' ), 'profile-builder_page_admin-email-customizer', 'core', '', '', $fields );
79
80
81 $registration_default_email_content = __( "<p>New subscriber on {{site_name}}.</p>\n<p>Username:{{username}}</p>\n<p>Email:{{user_email}}</p>\n", 'profile-builder' );
82 $mustache_vars = wppb_email_customizer_generate_merge_tags();
83
84 $fields = array(
85 array(
86 'label' => __( 'Email Subject', 'profile-builder' ), // <label>
87 'desc' => '', // description
88 'id' => 'wppb_admin_emailc_default_registration_email_subject', // field id and name
89 'type' => 'text', // type of field
90 'default' => '[{{site_name}}] '.__( 'A new subscriber has (been) registered!', 'profile-builder' ), // type of field
91 ),
92 array(
93 'label' => __( 'Enable email', 'profile-builder' ), // <label>
94 'desc' => '', // description
95 'id' => 'wppb_admin_emailc_default_registration_email_enabled', // field id and name
96 'type' => 'checkbox', // type of field
97 'default' => 'on',
98 ),
99 array( // Textarea
100 'label' => '', // <label>
101 'desc' => '', // description
102 'id' => 'wppb_admin_emailc_default_registration_email_content', // field id and name
103 'type' => 'textarea', // type of field
104 'default' => $registration_default_email_content, // type of field
105 )
106 );
107
108 new PB_Mustache_Generate_Admin_Box( 'aec_default_registration', __( 'Registration: Default & Email Confirmation', 'profile-builder' ), 'profile-builder_page_admin-email-customizer', 'core', $mustache_vars, '', $fields);
109
110 if( PROFILE_BUILDER != 'Profile Builder Free' ){
111 $registration_admin_approval_email_content = __( "<p>New subscriber on {{site_name}}.</p>\n<p>Username:{{username}}</p>\n<p>Email:{{user_email}}</p>\n<p>The Admin Approval feature was activated at the time of registration,\nso please remember that you need to approve this user before he/she can log in!</p>", 'profile-builder' );
112
113 $mustache_vars = wppb_email_customizer_generate_merge_tags( 'admin_approval' );
114
115 $fields = array(
116 array(
117 'label' => __( 'Email Subject', 'profile-builder' ), // <label>
118 'desc' => '', // description
119 'id' => 'wppb_admin_emailc_registration_with_admin_approval_email_subject', // field id and name
120 'type' => 'text', // type of field
121 'default' => '[{{site_name}}] A new subscriber has (been) registered!', // type of field
122 ),
123 array(
124 'label' => __( 'Enable email', 'profile-builder' ), // <label>
125 'desc' => '', // description
126 'id' => 'wppb_admin_emailc_registration_with_admin_approval_email_enabled', // field id and name
127 'type' => 'checkbox', // type of field
128 'default' => 'on',
129 ),
130 array( // Textarea
131 'label' => '', // <label>
132 'desc' => '', // description
133 'id' => 'wppb_admin_emailc_registration_with_admin_approval_email_content', // field id and name
134 'type' => 'textarea', // type of field
135 'default' => $registration_admin_approval_email_content , // type of field
136 )
137 );
138
139 new PB_Mustache_Generate_Admin_Box( 'aec_reg_with_admin_approval', __( 'Registration with Admin Approval', 'profile-builder' ), 'profile-builder_page_admin-email-customizer', 'core', $mustache_vars, '', $fields );
140 }
141
142 $user_password_reset_email_content = __( "<p>{{username}} has requested a password change via the password reset feature.</p>\n", 'profile-builder' );
143
144 $mustache_vars = wppb_email_customizer_generate_merge_tags();
145
146 $fields = array(
147 array(
148 'label' => __( 'Email Subject', 'profile-builder' ), // <label>
149 'desc' => '', // description
150 'id' => 'wppb_admin_emailc_user_password_reset_email_subject', // field id and name
151 'type' => 'text', // type of field
152 'default' => '[{{site_name}}] Password Successfully Reset for {{username}}', // type of field
153 ),
154 array(
155 'label' => __( 'Enable email', 'profile-builder' ), // <label>
156 'desc' => '', // description
157 'id' => 'wppb_admin_emailc_user_password_reset_email_enabled', // field id and name
158 'type' => 'checkbox', // type of field
159 'default' => 'on',
160 ),
161 array( // Textarea
162 'label' => '', // <label>
163 'desc' => '', // description
164 'id' => 'wppb_admin_emailc_user_password_reset_email_content', // field id and name
165 'type' => 'textarea', // type of field
166 'default' => $user_password_reset_email_content , // type of field
167 )
168 );
169
170 new PB_Mustache_Generate_Admin_Box( 'aec_user_password_reset', __( 'User Password Reset', 'profile-builder' ), 'profile-builder_page_admin-email-customizer', 'core', $mustache_vars, '', $fields );
171
172 }
173