Skip to content

Commit 3b3c332

Browse files
committed
Merge branch 'bug/49'
2 parents 43d8cdf + ec3d2d7 commit 3b3c332

File tree

4 files changed

+78
-69
lines changed

4 files changed

+78
-69
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ To do so, download the meta for taxonomies plugin and let the plugin migrate the
1919

2020
## Changelog ##
2121

22+
### 1.0.1
23+
* 5 Dec 2016
24+
* Fix wrong default register notification.
25+
2226
### 1.0.0
2327
* 28 Nov 2016
2428
* Add for email notifications the available replacements values which are automatically replaced before email send.

classes/admin/class-settings-main.php

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?php
2-
class MPT_Admin_Settings_Main {
1+
<?php class MPT_Admin_Settings_Main {
32
static $settings_api;
43
static $id = 'mpt-main';
54

@@ -10,15 +9,18 @@ class MPT_Admin_Settings_Main {
109
*
1110
* @return mixed Value.
1211
*/
13-
public function __construct( ) {
14-
self::$settings_api = new WeDevs_Settings_API( );
12+
public function __construct() {
13+
self::$settings_api = new WeDevs_Settings_API();
1514

1615
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
1716
add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
1817

1918
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ), 10, 1 );
2019

21-
add_filter( 'mpt_admin\setting\replacement_values', array( $this, 'add_default_available_replacements_values' ), 20, 2 );
20+
add_filter( 'mpt_admin\setting\replacement_values', array(
21+
$this,
22+
'add_default_available_replacements_values'
23+
), 20, 2 );
2224
}
2325

2426
/**
@@ -32,8 +34,8 @@ public function __construct( ) {
3234
* @return mixed Value.
3335
*/
3436
public static function admin_enqueue_scripts( $hook ) {
35-
if( $hook == 'settings_page_'.'mpt-settings' ) {
36-
wp_enqueue_script( MPT_CPT_NAME.'-admin-settings', MPT_URL.'assets/js/admin-settings.js', array( 'jquery' ), MPT_VERSION, true );
37+
if ( $hook == 'settings_page_' . 'mpt-settings' ) {
38+
wp_enqueue_script( MPT_CPT_NAME . '-admin-settings', MPT_URL . 'assets/js/admin-settings.js', array( 'jquery' ), MPT_VERSION, true );
3739
}
3840
}
3941

@@ -47,8 +49,11 @@ public static function admin_enqueue_scripts( $hook ) {
4749
*
4850
* @return mixed Value.
4951
*/
50-
public static function admin_menu( ) {
51-
add_options_page( __( 'Members Post Type', 'mpt' ), __( 'Members Post Type', 'mpt' ), 'manage_options', 'mpt-settings', array( __CLASS__, 'render_page_settings' ) );
52+
public static function admin_menu() {
53+
add_options_page( __( 'Members Post Type', 'mpt' ), __( 'Members Post Type', 'mpt' ), 'manage_options', 'mpt-settings', array(
54+
__CLASS__,
55+
'render_page_settings'
56+
) );
5257
}
5358

5459
/**
@@ -59,8 +64,8 @@ public static function admin_menu( ) {
5964
*
6065
* @return mixed Value.
6166
*/
62-
public static function render_page_settings( ) {
63-
include (MPT_DIR.'views/admin/page-settings.php');
67+
public static function render_page_settings() {
68+
include( MPT_DIR . 'views/admin/page-settings.php' );
6469
}
6570

6671
/**
@@ -71,13 +76,13 @@ public static function render_page_settings( ) {
7176
*
7277
* @return mixed Value.
7378
*/
74-
public static function admin_init( ) {
79+
public static function admin_init() {
7580
//set the settings
76-
self::$settings_api->set_sections( MPT_Plugin::get_default_settings_sections( ) );
77-
self::$settings_api->set_fields( MPT_Plugin::get_default_settings_fields( ) );
81+
self::$settings_api->set_sections( MPT_Plugin::get_default_settings_sections() );
82+
self::$settings_api->set_fields( MPT_Plugin::get_default_settings_fields() );
7883

7984
//initialize settings
80-
self::$settings_api->admin_init( );
85+
self::$settings_api->admin_init();
8186
}
8287

8388
/**
@@ -95,20 +100,20 @@ public static function validate_input( $input ) {
95100
$input = stripslashes_deep( $input );
96101

97102
// Create our array for storing the validated options
98-
$output = array( );
103+
$output = array();
99104

100105
// Loop through each of the incoming options
101-
foreach( self::get_default_options() as $key => $value ) {
102-
if( isset( $input[$key] ) ) {
103-
$output[$key] = strip_tags( $input[$key] );
106+
foreach ( self::get_default_options() as $key => $value ) {
107+
if ( isset( $input[ $key ] ) ) {
108+
$output[ $key ] = strip_tags( $input[ $key ] );
104109
// TODO : Remove striptags depending fields
105110
} else {
106-
$output[$key] = 0;
111+
$output[ $key ] = 0;
107112
}
108113
}
109114

110115
// Constraint & Signon
111-
if( (int)$output['allow-signon-email'] == 1 ) {
116+
if ( (int) $output['allow-signon-email'] == 1 ) {
112117
$output['unique-email'] = 1;
113118
}
114119

@@ -123,8 +128,8 @@ public static function validate_input( $input ) {
123128
* @since 1.0.0
124129
* @author Maxime CULEA
125130
*
126-
* @param array $available_values, By default it is empty
127-
* @param string $context, Where it has been called from.
131+
* @param array $available_values , By default it is empty
132+
* @param string $context , Where it has been called from.
128133
*
129134
* @return array, key / value corresponding to replacement value and description.
130135
*/
@@ -149,10 +154,10 @@ public function add_default_available_replacements_values( $available_values, $c
149154

150155
case 'register_member' :
151156
$available_values = array(
152-
'blog_name' => __( "Blog's name", 'mpt' ),
153-
'user_name' => __( "User's name", 'mpt' ),
154-
'password' => __( "User's password", 'mpt' ),
155-
'login_url' => __( "The site's login url", 'mpt' ),
157+
'blog_name' => __( "Blog's name", 'mpt' ),
158+
'user_name' => __( "User's name", 'mpt' ),
159+
'user_password' => __( "User's password", 'mpt' ),
160+
'login_url' => __( "The site's login url", 'mpt' ),
156161
);
157162
break;
158163

classes/helpers/default-settings.php

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@
136136
),
137137
'mpt-security' => array(
138138
array(
139-
'name' => 'mode',
140-
'label' => __( 'Password strength', 'mpt' ),
141-
'desc' => __( 'Enforce a specific password strength for your members.', 'mpt' ),
142-
'type' => 'metabox',
139+
'name' => 'mode',
140+
'label' => __( 'Password strength', 'mpt' ),
141+
'desc' => __( 'Enforce a specific password strength for your members.', 'mpt' ),
142+
'type' => 'metabox',
143143
),
144144
array(
145145
'name' => 'mode-select',
@@ -261,15 +261,15 @@
261261
),
262262
'mpt-emails' => array(
263263
array(
264-
'name' => 'register_member_admin_mail',
265-
'label' => __( 'Admin mail for Member registration', 'mpt' ),
266-
'desc' => __( 'Management of mail notification to the site administrator when a new member joins the site.', 'mpt' ),
267-
'type' => 'metabox',
264+
'name' => 'register_member_admin_mail',
265+
'label' => __( 'Admin mail for Member registration', 'mpt' ),
266+
'desc' => __( 'Management of mail notification to the site administrator when a new member joins the site.', 'mpt' ),
267+
'type' => 'metabox',
268268
),
269269
array(
270-
'name' => MPT_Options::description_setting_name( 'register_member_admin' ),
271-
'desc' => MPT_Options::description_setting_desc( 'register_member_admin' ),
272-
'type' => 'html',
270+
'name' => MPT_Options::description_setting_name( 'register_member_admin' ),
271+
'desc' => MPT_Options::description_setting_desc( 'register_member_admin' ),
272+
'type' => 'html',
273273
),
274274
array(
275275
'name' => 'registration_member_admin_mail_to',
@@ -292,15 +292,15 @@
292292
'sanitize_callback' => 'strip_tags'
293293
),
294294
array(
295-
'name' => 'register_member_mail',
296-
'label' => __( 'Member registration email', 'mpt' ),
297-
'desc' => __( 'Management of notification\'s mail by a Member upon registration.', 'mpt' ),
298-
'type' => 'metabox',
295+
'name' => 'register_member_mail',
296+
'label' => __( 'Member registration email', 'mpt' ),
297+
'desc' => __( 'Management of notification\'s mail by a Member upon registration.', 'mpt' ),
298+
'type' => 'metabox',
299299
),
300300
array(
301-
'name' => MPT_Options::description_setting_name( 'register_member' ),
302-
'desc' => MPT_Options::description_setting_desc( 'register_member' ),
303-
'type' => 'html',
301+
'name' => MPT_Options::description_setting_name( 'register_member' ),
302+
'desc' => MPT_Options::description_setting_desc( 'register_member' ),
303+
'type' => 'html',
304304
),
305305
array(
306306
'name' => 'register_member_subject',
@@ -312,19 +312,19 @@
312312
'name' => 'register_member_content',
313313
'label' => __( 'Content mail', 'mpt' ),
314314
'type' => 'textarea',
315-
'default' => __( "Username: %%user_name%%\nPassword: %%password%%\n\n%%login_url%%", 'mpt' ),
315+
'default' => __( "Username: %%user_name%%\nPassword: %%user_password%%\n\n%%login_url%%", 'mpt' ),
316316
'sanitize_callback' => 'strip_tags'
317317
),
318318
array(
319-
'name' => 'register_member_validation_mail',
320-
'label' => __( 'Member registration email validation', 'mpt' ),
321-
'desc' => __( 'Registration confirmation email with link validation counted', 'mpt' ),
322-
'type' => 'metabox',
319+
'name' => 'register_member_validation_mail',
320+
'label' => __( 'Member registration email validation', 'mpt' ),
321+
'desc' => __( 'Registration confirmation email with link validation counted', 'mpt' ),
322+
'type' => 'metabox',
323323
),
324324
array(
325-
'name' => MPT_Options::description_setting_name( 'register_member_validation' ),
326-
'desc' => MPT_Options::description_setting_desc( 'register_member_validation' ),
327-
'type' => 'html',
325+
'name' => MPT_Options::description_setting_name( 'register_member_validation' ),
326+
'desc' => MPT_Options::description_setting_desc( 'register_member_validation' ),
327+
'type' => 'html',
328328
),
329329
array(
330330
'name' => 'register_member_validation_subject',
@@ -340,15 +340,15 @@
340340
'sanitize_callback' => 'strip_tags'
341341
),
342342
array(
343-
'name' => 'lost_password_admin',
344-
'label' => __( 'Admin mail for Member lost password', 'mpt' ),
345-
'desc' => __( 'Management of notification\'s mail to the administrator when a member has lost his password.', 'mpt' ),
346-
'type' => 'metabox',
343+
'name' => 'lost_password_admin',
344+
'label' => __( 'Admin mail for Member lost password', 'mpt' ),
345+
'desc' => __( 'Management of notification\'s mail to the administrator when a member has lost his password.', 'mpt' ),
346+
'type' => 'metabox',
347347
),
348348
array(
349-
'name' => MPT_Options::description_setting_name( 'lost_password_admin' ),
350-
'desc' => MPT_Options::description_setting_desc( 'lost_password_admin' ),
351-
'type' => 'html',
349+
'name' => MPT_Options::description_setting_name( 'lost_password_admin' ),
350+
'desc' => MPT_Options::description_setting_desc( 'lost_password_admin' ),
351+
'type' => 'html',
352352
),
353353
array(
354354
'name' => 'lost_password_admin_mail',
@@ -371,15 +371,15 @@
371371
'sanitize_callback' => 'strip_tags'
372372
),
373373
array(
374-
'name' => 'lost_password_member',
375-
'label' => __( 'Member lost password mail', 'mpt' ),
376-
'desc' => __( 'Management of notification\'s mail by a Member lost his password.', 'mpt' ),
377-
'type' => 'metabox',
374+
'name' => 'lost_password_member',
375+
'label' => __( 'Member lost password mail', 'mpt' ),
376+
'desc' => __( 'Management of notification\'s mail by a Member lost his password.', 'mpt' ),
377+
'type' => 'metabox',
378378
),
379379
array(
380-
'name' => MPT_Options::description_setting_name( 'lost_password_member' ),
381-
'desc' => MPT_Options::description_setting_desc( 'lost_password_member' ),
382-
'type' => 'html',
380+
'name' => MPT_Options::description_setting_name( 'lost_password_member' ),
381+
'desc' => MPT_Options::description_setting_desc( 'lost_password_member' ),
382+
'type' => 'html',
383383
),
384384
array(
385385
'name' => 'lost_password_member_subject',

members-post-type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/*
33
Plugin Name: Members post type
4-
Version: 1.0.0
4+
Version: 1.0.1
55
Plugin URI: http://www.beapi.fr
66
Description: Manage members on WordPress as post type. Implement: post type, authentification, role, clone from WP.
77
Author: BE API Technical team
@@ -58,7 +58,7 @@
5858
}
5959

6060
// Plugin constants
61-
define('MPT_VERSION', '1.0.0');
61+
define('MPT_VERSION', '1.0.1');
6262
define('MPT_CPT_NAME', 'member');
6363
define('MPT_TAXO_NAME', 'members-role');
6464

0 commit comments

Comments
 (0)