__( 'User Email Customizer', 'profile-builder' ),
'page_title' => __( 'User Email Customizer Settings', 'profile-builder' ),
'menu_slug' => 'user-email-customizer',
'page_type' => 'submenu_page',
'capability' => 'manage_options',
'priority' => 10,
'parent_slug' => 'profile-builder'
);
new WCK_Page_Creator_PB( $args );
}
add_action( 'admin_menu', 'wppb_user_email_customizer_submenu', 1 );
add_action( 'wck_before_meta_boxes', 'wppb_add_tabs_on_top_of_user_email_page' );
function wppb_add_tabs_on_top_of_user_email_page( $hookname ){
if( $hookname == 'profile-builder_page_user-email-customizer' ){
if( isset( $_GET['mustache_action'] ) && $_GET['mustache_action'] == 'save' ) { ?>
'wppb_admin_emailc_common_settings_header', // field id and name
'type' => 'header', // type of field
'default' => __( 'These settings are also replicated in the "Admin Email Customizer" settings-page upon save.', 'profile-builder' ).' '.__( 'Valid tags {{reply_to}} and {{site_name}}', 'profile-builder'), // type of field
),
array(
'label' => __( 'From (name)', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_emailc_common_settings_from_name', // field id and name
'type' => 'text', // type of field
'default' => '{{site_name}}', // type of field
'desc' => '',
),
array(
'label' => __( 'From (reply-to email)', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_emailc_common_settings_from_reply_to_email', // field id and name
'type' => 'text', // type of field
'default' => '{{reply_to}}', // type of field
'desc' => __( 'Must be a valid email address or the tag {{reply_to}} which defaults to the administrator email', 'profile-builder' ),
),
);
new PB_Mustache_Generate_Admin_Box( 'uec_common_settings', __( 'Common Settings', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', '', '', $fields );
/*
* Default Registration
*/
// we format the var like this for proper line breaks.
$uec_default_registration = __("Welcome to {{site_name}}! \nYour username is: {{username}}
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags();
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_default_registration_email_subject', // field id and name
'type' => 'text', // type of field
'default' => 'A new account has been created for you on {{site_name}}', // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_default_registration_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_default_registration_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_default_registration, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_default_registration', __( 'Default Registration', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
/*
* Registration with Email Confirmation
*/
// we format the var like this for proper line breaks.
$uec_reg_with_email_confirm = __( "To activate your user, please click the following link: \n{{{activation_link}}}
\nAfter you activate, you will receive another email with your credentials.
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags( 'email_confirmation' );
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_registr_w_email_confirm_email_subject', // field id and name
'type' => 'text', // type of field
'default' => __( '[{{site_name}}] Activate {{username}}', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_registr_w_email_confirm_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_registr_w_email_confirm_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_reg_with_email_confirm, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_reg_with_email_confirmation', __( 'Registration with Email Confirmation', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
if( PROFILE_BUILDER != 'Profile Builder Free' ){
/*
* Registration with Admin Approval
*/
$uec_reg_with_admin_approval = __( "Welcome to {{site_name}}! \nYour username is: {{username}}
\nBefore you can access your account, an administrator needs to approve it. You will be notified via email.
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags();
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_registration_with_admin_approval_email_subject', // field id and name
'type' => 'text', // type of field
'default' => __( 'A new account has been created for you on {{site_name}}', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_registration_with_admin_approval_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_registration_with_admin_approval_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_reg_with_admin_approval, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_reg_with_admin_approval', __( 'Registration with Admin Approval', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
/*
* Admin Approval Notifications ( on user approval )
*/
$uec_notif_approved_email = __( "Good News! \nAn administrator has just approved your account: {{username}} on {{site_name}}.
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags();
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_admin_approval_notif_approved_email_subject', // field id and name
'type' => 'text', // type of field
'default' => __( 'Your account on {{site_name}} has been approved!', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_admin_approval_notif_approved_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_admin_approval_notif_approved_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_notif_approved_email, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_notif_approved_email', __( 'User Approval Notification', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
/*
* Admin Approval Notifications ( on user unapproval )
*/
$uec_notif_unapproved_email = __( "Hello, \nUnfortunatelly an administrator has just unapproved your account: {{username}} on {{site_name}}.
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags();
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_admin_approval_notif_unapproved_email_subject', // field id and name
'type' => 'text', // type of field
'default' => __( 'Your account on {{site_name}} has been unapproved!', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_admin_approval_notif_unapproved_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_admin_approval_notif_unapproved_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_notif_unapproved_email , // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_notif_unapproved_email', __( 'Unapproved User Notification', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
}
/*
* Password Reset Email
*/
// we format the var like this for proper line breaks.
$uec_reset = __( "Someone requested that the password be reset for the following account: {{site_name}} \nUsername: {{username}}
\nIf this was a mistake, just ignore this email and nothing will happen.
\nTo reset your password, visit the following address: \n{{{reset_link}}}
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags( 'password_reset' );
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_reset_email_subject', // field id and name
'type' => 'text', // type of field
'default' => __( '[{{site_name}}] Password Reset', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_reset_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_reset_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_reset, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_reset', __( 'Password Reset Email', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
/*
* Password Reset Success Email
*/
// we format the var like this for proper line breaks.
$uec_reset_success = __( "You have successfully reset your password.
\n", 'profile-builder' );
$mustache_vars = wppb_email_customizer_generate_merge_tags( 'password_reset_success' );
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_reset_success_email_subject', // field id and name
'type' => 'text', // type of field
'default' => __( '[{{site_name}}] Password Reset Successfully', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_reset_success_email_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_reset_success_email_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_reset_success, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_reset_success', __( 'Password Reset Success Email', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
/*
* Change Email Address Request Notification
*/
$admin_email = get_option('admin_email');
// we format the var like this for proper line breaks.
$uec_change_email_request = sprintf( __( "Hi {{username}}, \nThere is an email address change request on {{site_name}}.
\nTo change your email address click on: {{{user_email_change_link}}}
\nRegards, \nAll at {{site_name}} \n{{site_url}}
", 'profile-builder' ), $admin_email );
$mustache_vars = wppb_email_customizer_generate_merge_tags( 'change_email_address_request' );
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_change_email_address_request_subject', // field id and name
'type' => 'text', // type of field
'default' => __( '[{{site_name}}] Notice of Email Change Request', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_change_email_address_request_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_change_email_address_request_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_change_email_request, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_change_email_request', __( 'Change Email Address Request Notification', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
/*
* Change Email Address Notification
*/
$admin_email = get_option('admin_email');
// we format the var like this for proper line breaks.
$uec_change_email = sprintf( __( "Hi {{username}}, \nThis notice confirms that your email was changed on {{site_name}}.
\nIf you did not change your email, please contact the Site Administrator at %s
\nThis email has been sent to {{user_email}}
\nRegards, \nAll at {{site_name}} \n{{site_url}}
", 'profile-builder' ), $admin_email );
$mustache_vars = wppb_email_customizer_generate_merge_tags( 'change_email_address' );
$fields = array(
array(
'label' => __( 'Email Subject', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_change_email_address_subject', // field id and name
'type' => 'text', // type of field
'default' => __( '[{{site_name}}] Notice of Email Change', 'profile-builder' ), // type of field
),
array(
'label' => __( 'Enable email', 'profile-builder' ), //
'desc' => '', // description
'id' => 'wppb_user_emailc_change_email_address_enabled', // field id and name
'type' => 'checkbox', // type of field
'default' => 'on',
),
array( // Textarea
'label' => '', //
'desc' => '', // description
'id' => 'wppb_user_emailc_change_email_address_content', // field id and name
'type' => 'textarea', // type of field
'default' => $uec_change_email, // type of field
)
);
new PB_Mustache_Generate_Admin_Box( 'uec_change_email', __( 'Changed Email Address Notification', 'profile-builder' ), 'profile-builder_page_user-email-customizer', 'core', $mustache_vars, '', $fields );
}