Changeset 3186203
- Timestamp:
- 11/12/2024 06:42:38 AM (16 months ago)
- Location:
- advanced-members/trunk
- Files:
-
- 51 edited
-
acf/fields/base/trait-amem-field.php (modified) (1 diff)
-
acf/fields/class-display-name.php (modified) (2 diffs)
-
acf/fields/class-user-email.php (modified) (1 diff)
-
acf/fields/class-user-password-confirm.php (modified) (1 diff)
-
acf/fields/class-user-password-current.php (modified) (2 diffs)
-
acf/fields/class-user-password.php (modified) (3 diffs)
-
acf/fields/class-username.php (modified) (1 diff)
-
admin/class-admin-forms.php (modified) (4 diffs)
-
admin/class-admin-options.php (modified) (6 diffs)
-
admin/class-admin.php (modified) (5 diffs)
-
admin/class-menu.php (modified) (2 diffs)
-
admin/views/html-dashboard-page.php (modified) (3 diffs)
-
admin/views/html-option-single-role.php (modified) (2 diffs)
-
admin/views/html-options-list-email.php (modified) (1 diff)
-
admin/views/html-options-page.php (modified) (22 diffs)
-
advanced-members.php (modified) (9 diffs)
-
core/abstracts/action.php (modified) (1 diff)
-
core/abstracts/addon.php (modified) (1 diff)
-
core/abstracts/module.php (modified) (1 diff)
-
core/actions/account.php (modified) (18 diffs)
-
core/actions/login.php (modified) (16 diffs)
-
core/actions/password-reset.php (modified) (10 diffs)
-
core/actions/registration.php (modified) (10 diffs)
-
core/class-account.php (modified) (9 diffs)
-
core/class-blocks.php (modified) (2 diffs)
-
core/class-config.php (modified) (1 diff)
-
core/class-errors.php (modified) (1 diff)
-
core/class-fields.php (modified) (3 diffs)
-
core/class-files.php (modified) (1 diff)
-
core/class-local.php (modified) (1 diff)
-
core/class-locations.php (modified) (1 diff)
-
core/class-logout.php (modified) (1 diff)
-
core/class-mail.php (modified) (3 diffs)
-
core/class-options.php (modified) (3 diffs)
-
core/class-password-reset.php (modified) (4 diffs)
-
core/class-rest.php (modified) (1 diff)
-
core/class-setup.php (modified) (8 diffs)
-
core/class-template.php (modified) (1 diff)
-
core/class-user.php (modified) (8 diffs)
-
core/forms/actions.php (modified) (11 diffs)
-
core/forms/render.php (modified) (8 diffs)
-
core/forms/submissions.php (modified) (10 diffs)
-
core/functions-forms.php (modified) (17 diffs)
-
core/functions-helpers.php (modified) (7 diffs)
-
core/functions-submissions.php (modified) (4 diffs)
-
core/modules/class-adminbar.php (modified) (3 diffs)
-
core/modules/class-redirects.php (modified) (6 diffs)
-
core/modules/menu/class-items.php (modified) (1 diff)
-
core/rest/class-rest-controller.php (modified) (2 diffs)
-
languages/advanced-members.pot (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-members/trunk/acf/fields/base/trait-amem-field.php
r3182890 r3186203 18 18 19 19 protected function _form_type() { 20 if ( isset( AMem()->form['_amem_local']) )21 return AMem()->form['type'];22 if ( isset( AMem()->form['post_id']) ) {23 return amem_form_type( AMem()->form['post_id']);20 if ( isset(amem()->form['_amem_local']) ) 21 return amem()->form['type']; 22 if ( isset(amem()->form['post_id']) ) { 23 return amem_form_type(amem()->form['post_id']); 24 24 } 25 25 return null; -
advanced-members/trunk/acf/fields/class-display-name.php
r3182890 r3186203 54 54 if ( amem_user('ID') || $this->_user ) { 55 55 if ( $this->_user ) { 56 AMem()->switch($this->_user->ID);56 amem()->switch($this->_user->ID); 57 57 } 58 58 … … 125 125 } 126 126 if ( $this->_user ) { 127 AMem()->user->restore();127 amem()->user->restore(); 128 128 $this->_user = null; 129 129 } -
advanced-members/trunk/acf/fields/class-user-email.php
r3182890 r3186203 73 73 if( $user_id ){ 74 74 $edit_user = get_user_by( 'ID', $user_id ); 75 } 76 77 if ( $this->mode() == 'login' ) { 78 if ( !email_exists( $value ) ) { 79 return sprintf( __( 'The email is not existing in this site. Please try a different email', 'advanced-members' ) ); 80 } 81 // Validation will be passed to login action validator 82 return $is_valid; 75 83 } 76 84 -
advanced-members/trunk/acf/fields/class-user-password-confirm.php
r3182890 r3186203 32 32 33 33 function prepare_field( $field ) { 34 $form = AMem()->form;34 $form = amem()->form; 35 35 if ( isset( $field['wrapper']['class'] ) ) { 36 36 $field['wrapper']['class'] .= ' amem-password-confirm amem-pwd'; -
advanced-members/trunk/acf/fields/class-user-password-current.php
r3182890 r3186203 43 43 } 44 44 45 $form = AMem()->form;45 $form = amem()->form; 46 46 if ( isset( $form['approval'] ) ) { 47 47 return false; … … 70 70 return __( 'Current password is required', 'advanced-members' ); 71 71 72 $user_data = !empty( AMem()->user->data) ? AMem()->user->data : [];72 $user_data = !empty(amem()->user->data) ? amem()->user->data : []; 73 73 74 74 $user = false; 75 75 if ( $user_data && wp_check_password( $value, $user_data['user_pass'], $user_data['ID'] ) ) { 76 AMem()->submission['form']['auth_id'] = $user_data['ID'];76 amem()->submission['form']['auth_id'] = $user_data['ID']; 77 77 } else { 78 $is_valid = AMem()->errors->text('password_incorrect');//__( 'Current password is incorrect. Please try again.', 'advanced-members' );78 $is_valid = amem()->errors->text('password_incorrect');//__( 'Current password is incorrect. Please try again.', 'advanced-members' ); 79 79 // amem_add_error( $this->name, __( 'Current password is incorrect. Please try again.', 'advanced-members' ) ); 80 80 } -
advanced-members/trunk/acf/fields/class-user-password.php
r3182890 r3186203 52 52 // } 53 53 54 $form = AMem()->form;54 $form = amem()->form; 55 55 if ( isset( $form['approval'] ) ) { 56 56 return false; … … 80 80 } 81 81 82 if ( $field['show_pass_confirm'] && AMem()->is_amem() ) {82 if ( $field['show_pass_confirm'] && amem()->is_amem() ) { 83 83 $ps_confirm_field = sanitize_key( $_POST['custom_password_confirm'] ); // phpcs:disable WordPress.Security.NonceVerification -- already verified by ACF 84 84 if ( !isset($_POST[ $ps_confirm_field ]) || sanitize_text_field($_POST[ $ps_confirm_field ]) != $value ) { // phpcs:disable WordPress.Security.NonceVerification -- already verified by ACF … … 163 163 $confirm = acf_get_local_field('user_password_confirm'); 164 164 165 AMem()->render->render_field( $confirm, $form, $args );165 amem()->render->render_field( $confirm, $form, $args ); 166 166 167 167 remove_action( 'amem/field/after_field/key=' . $field['key'], [$this, 'print_confirm_field'] ); -
advanced-members/trunk/acf/fields/class-username.php
r3182890 r3186203 36 36 public function prepare_field( $field ) { 37 37 // make sure field is not disabled when no value exists 38 if ( ! $field['value'] || !empty( AMem()->submission ) ) {38 if ( ! $field['value'] || !empty( amem()->submission ) ) { 39 39 $field['disabled'] = 0; 40 40 } else { -
advanced-members/trunk/admin/class-admin-forms.php
r3182890 r3186203 7 7 } 8 8 9 if ( ! class_exists( 'AM em_ADMIN_FORMS' ) ) :9 if ( ! class_exists( 'AMEM_ADMIN_FORMS' ) ) : 10 10 class ADMIN_FORMS extends Module { 11 11 … … 255 255 */ 256 256 function register_fields() { 257 $form_ajax = AMem()->options->get('ajax_submit');257 $form_ajax = amem()->options->get('ajax_submit'); 258 258 259 259 $general_fields = [ … … 592 592 593 593 $account_fields = []; 594 // if ( AMem()->options->get('account/use_delete') ) {594 // if ( amem()->options->get('account/use_delete') ) { 595 595 // $account_fields[] = array( 596 596 // 'type' => 'select', … … 1091 1091 } 1092 1092 1093 AMem()->register_module('admin/forms', ADMIN_FORMS::getInstance());1093 amem()->register_module('admin/forms', ADMIN_FORMS::getInstance()); 1094 1094 1095 1095 endif; // class_exists check -
advanced-members/trunk/admin/class-admin-options.php
r3182890 r3186203 95 95 if( isset($_POST['amem_modules'])){ // phpcs:disable WordPress.Security.NonceVerification -- already verified by ACF 96 96 update_option( 'amem_modules', amem_sanitize_vars($_POST['amem_modules']) ); // phpcs:disable WordPress.Security.NonceVerification -- already verified by ACF 97 AMem()->options->modules = amem_sanitize_vars($_POST['amem_modules']); // phpcs:disable WordPress.Security.NonceVerification -- already verified by ACF97 amem()->options->modules = amem_sanitize_vars($_POST['amem_modules']); // phpcs:disable WordPress.Security.NonceVerification -- already verified by ACF 98 98 acf_add_admin_notice( __('Dashboard Update Success', 'advanced-members'), 'success' ); 99 99 } … … 324 324 'account' => __( 'Account', 'advanced-members' ), 325 325 ); 326 if ( AMem()->options->getmodule('_use_redirects') ) {326 if ( amem()->options->getmodule('_use_redirects') ) { 327 327 $option_tabs['redirects'] = __( 'Redirects', 'advanced-members' ); 328 328 } 329 if ( AMem()->options->getmodule('_use_adminbar') ) {329 if ( amem()->options->getmodule('_use_adminbar') ) { 330 330 $option_tabs['adminbar'] = __( 'Admin Bar', 'advanced-members' ); 331 331 } … … 389 389 390 390 function enqueue_admin_scripts() { 391 wp_enqueue_style( 'amem-admin', amem_get_url('assets/build/css/admin.css'), [], AM em_VERSION );391 wp_enqueue_style( 'amem-admin', amem_get_url('assets/build/css/admin.css'), [], AMEM_VERSION ); 392 392 if ( !amem_is_screen( ['amem-form', 'edit-amem-form', 'acf-field-group', 'acf_page_amem_settings', 'acf_page_amem_dashboard']) ) 393 393 return; 394 394 395 AMem()->fields->enqueue_scripts();395 amem()->fields->enqueue_scripts(); 396 396 397 397 $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.min' : ''; 398 wp_register_script( 'amem-admin', amem_get_url('assets/build/js/amem-admin.js'), ['jquery', 'acf-input', 'amem-input'], AM em_VERSION, true );398 wp_register_script( 'amem-admin', amem_get_url('assets/build/js/amem-admin.js'), ['jquery', 'acf-input', 'amem-input'], AMEM_VERSION, true ); 399 399 400 400 $account_forms = array( … … 437 437 438 438 function register_core_page_option_button() { 439 foreach( array_keys( AMem()->config->core_pages) as $page_key ) {440 $name = AMem()->options->get_core_page_id($page_key);439 foreach( array_keys(amem()->config->core_pages) as $page_key ) { 440 $name = amem()->options->get_core_page_id($page_key); 441 441 // $name = "amem_options[{$name}]"; 442 442 add_action( 'acf/render_field/name=' . $name, [$this, 'core_page_option_button'] ); … … 466 466 break; 467 467 case 'account': 468 if ( AMem()->options->get('accform/default') )469 return AMem()->options->get('accform/default');468 if ( amem()->options->get('accform/default') ) 469 return amem()->options->get('accform/default'); 470 470 return false; 471 471 break; … … 497 497 } 498 498 499 AMem()->register_module('admin_options', ADMIN_OPTIONS::getInstance());499 amem()->register_module('admin_options', ADMIN_OPTIONS::getInstance()); 500 500 501 501 endif; // class_exists check -
advanced-members/trunk/admin/class-admin.php
r3182890 r3186203 93 93 */ 94 94 function render_custom_user_profile_fields( $user ) { 95 // if( AMem()->options->get('accform/account_form_showadmin') ) {95 // if( amem()->options->get('accform/account_form_showadmin') ) { 96 96 // Removed option and provides hook 97 97 if ( apply_filters( 'amem/account/fields/showadmin', true ) ) { … … 106 106 ); 107 107 108 $bypass = AMem()->fields->predefined_fields();108 $bypass = amem()->fields->predefined_fields(); 109 109 110 110 echo '<table class="form-table"><tbody>'; … … 127 127 128 128 public function add_display_post_states( $post_states, $post ) { 129 foreach ( AMem()->config->core_pages as $page_key => $page_value ) {130 $page_id = AMem()->options->get( AMem()->options->get_core_page_id($page_key) );129 foreach ( amem()->config->core_pages as $page_key => $page_value ) { 130 $page_id = amem()->options->get( amem()->options->get_core_page_id($page_key) ); 131 131 if ( $page_id == $post->ID ) { 132 132 $post_states[ 'amem_' . $page_key ] = sprintf( 'Advanced Members for ACF %s', $page_value['label'] ); … … 150 150 } 151 151 $role = $user_role; 152 $account_option = AMem()->options->options['accform'];152 $account_option = amem()->options->options['accform']; 153 153 if( is_array($user_role) ){ 154 154 $role = $user_role[0]; … … 183 183 } 184 184 public function not_install_core_pages() { 185 AMem()->setup()->not_install_core_pages();185 amem()->setup()->not_install_core_pages(); 186 186 } 187 187 188 188 public function install_core_pages() { 189 AMem()->setup()->install_default_forms();189 amem()->setup()->install_default_forms(); 190 190 } 191 191 192 192 protected $name = 'amem/admin'; 193 193 } 194 AMem()->register_module('admin', ADMIN::getInstance());194 amem()->register_module('admin', ADMIN::getInstance()); 195 195 196 196 endif; // class_exists check -
advanced-members/trunk/admin/class-menu.php
r3182890 r3186203 23 23 24 24 /** @todo Supports Customizer menu settings and save when WP core supports plugins */ 25 if ( AMem()->is_dev() ) {25 if ( amem()->is_dev() ) { 26 26 add_action( 'wp_nav_menu_item_custom_fields_customize_template', [ __CLASS__, 'custom_fields_customize_template' ] ); 27 27 // add_action( 'customize_controls_print_footer_scripts', [ __CLASS__, 'print_scripts' ] ); … … 52 52 53 53 // if ( $item->object == 'page' ) { 54 // $menu_type = array_search( $item->object_id, AMem()->options->get_core_pages() );54 // $menu_type = array_search( $item->object_id, amem()->options->get_core_pages() ); 55 55 // } 56 56 -
advanced-members/trunk/admin/views/html-dashboard-page.php
r3182890 r3186203 42 42 'key' => '_use_redirects', 43 43 'prefix' => 'amem_modules', 44 'value' => AMem()->options->getmodule('_use_redirects'),44 'value' => amem()->options->getmodule('_use_redirects'), 45 45 'label' => __( 'Redirects', 'advanced-members' ), 46 46 'instructions' => __( 'Redirect users to different pages or URLs after they register, login in and log out based on user roles.', 'advanced-members' ), … … 59 59 'key' => '_use_menu', 60 60 'prefix' => 'amem_modules', 61 'value' => AMem()->options->getmodule('_use_menu'),61 'value' => amem()->options->getmodule('_use_menu'), 62 62 'label' => __( 'Menu Item Visibility', 'advanced-members' ), 63 63 'instructions' => __( 'Enable/disable menu visibility settings on navigation menu screen. You can show or hide the menu by user\'s login status and role.', 'advanced-members' ), … … 84 84 'key' => '_use_adminbar', 85 85 'prefix' => 'amem_modules', 86 'value' => AMem()->options->getmodule('_use_adminbar'),86 'value' => amem()->options->getmodule('_use_adminbar'), 87 87 'label' => __( 'Disable Admin Bar', 'advanced-members' ), 88 88 'instructions' => __( 'Disable the admin bar based on user roles.', 'advanced-members' ), -
advanced-members/trunk/admin/views/html-option-single-role.php
r3182890 r3186203 29 29 'key' => '_after_' . $act, 30 30 'prefix' => $prefix, 31 'value' => AMem()->options->get('redirect/roles/'.$key.'/_after_' . $act),31 'value' => amem()->options->get('redirect/roles/'.$key.'/_after_' . $act), 32 32 'label' => $data['label'], 33 33 'choices' => $_choices, … … 43 43 'key' => $act . '_redirect_url', 44 44 'prefix' => $prefix, 45 'value' => AMem()->options->get('redirect/roles/' .$key .'/'. $act . '_redirect_url'),45 'value' => amem()->options->get('redirect/roles/' .$key .'/'. $act . '_redirect_url'), 46 46 'label' => __( 'Set Custom Redirect URL', 'advanced-members' ), 47 47 'instructions' => $instuction, -
advanced-members/trunk/admin/views/html-options-list-email.php
r3182890 r3186203 49 49 'key' => 'activation_link_expiry_time', 50 50 'prefix' => 'amem_options', 51 'value' => AMem()->options->get('activation_link_expiry_time', 0),51 'value' => amem()->options->get('activation_link_expiry_time', 0), 52 52 'label' => __( 'Email Activation Link Expiry', 'advanced-members' ), 53 53 'instructions' => __( 'Set email activation link expiry time limit in days.', 'advanced-members' ), -
advanced-members/trunk/admin/views/html-options-page.php
r3182890 r3186203 22 22 // Re-initialize updated options 23 23 if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) 24 AMem()->options->init(true);24 amem()->options->init(true); 25 25 26 26 $pages = array( … … 124 124 case 'general': 125 125 echo '<h3>' . esc_html__( 'Advanced Members for ACF Pages', 'advanced-members' ) . '</h3>'; 126 foreach ( AMem()->config->core_pages as $page_key => $page_value) {127 $page_id = AMem()->options->get_core_page_id($page_key);126 foreach (amem()->config->core_pages as $page_key => $page_value) { 127 $page_id = amem()->options->get_core_page_id($page_key); 128 128 // if ( $page_id && $page_key == 'account' ) { 129 129 // $instructions = __('Edit form link for account is \'Default Account Form\' set form Account Forms settings.', 'advanced-members'); … … 137 137 'key' => $page_id, 138 138 'prefix' => 'amem_options', 139 'value' => AMem()->options->get($page_id),139 'value' => amem()->options->get($page_id), 140 140 'label' => $page_value['label'], 141 141 'choices' => $pages, … … 156 156 'key' => 'ajax_submit', 157 157 'prefix' => 'amem_options', 158 'value' => AMem()->options->get('ajax_submit'),158 'value' => amem()->options->get('ajax_submit'), 159 159 'label' => __( 'AJAX Submit', 'advanced-members' ), 160 160 'instructions' => __( 'Enable/disable AJAX form submit instead of page load. This option is overridden by Form and Shorcode option.', 'advanced-members' ), … … 172 172 'key' => 'load_theme', 173 173 'prefix' => 'amem_options', 174 'value' => AMem()->options->get('load_theme', true),174 'value' => amem()->options->get('load_theme', true), 175 175 'label' => __( 'Load default style', 'advanced-members' ), 176 176 'instructions' => __( 'Enable/disable loading default CSS style.', 'advanced-members' ), … … 189 189 // 'key' => 'account_form_showadmin', 190 190 // 'prefix' => 'amem_options[accform]', 191 // 'value' => AMem()->options->get('accform/account_form_showadmin'),191 // 'value' => amem()->options->get('accform/account_form_showadmin'), 192 192 // 'label' => __( 'User Profile', 'advanced-members' ), 193 193 // 'instructions' => __( 'Enable/disable used on the User Profile edit', 'advanced-members' ), … … 203 203 'key' => 'show_current_passwd', 204 204 'prefix' => 'amem_options[account]', 205 'value' => AMem()->options->get('account/show_current_passwd'),205 'value' => amem()->options->get('account/show_current_passwd'), 206 206 'label' => __( 'Current Password on Account', 'advanced-members' ), 207 207 'instructions' => __( 'Show current password confirm field on general account page', 'advanced-members' ), … … 217 217 // 'key' => 'use_password', 218 218 // 'prefix' => 'amem_options[account]', 219 // 'value' => AMem()->options->get('account/use_password'),219 // 'value' => amem()->options->get('account/use_password'), 220 220 // 'label' => __( 'Account Password Change', 'advanced-members' ), 221 221 // 'instructions' => __( 'Enable/disable the Password Change for account. <code>[advanced-members-account tab="password"]</code>', 'advanced-members' ), … … 231 231 // 'key' => 'use_delete', 232 232 // 'prefix' => 'amem_options[account]', 233 // 'value' => AMem()->options->get('account/use_delete'),233 // 'value' => amem()->options->get('account/use_delete'), 234 234 // 'label' => __( 'Account Deletion', 'advanced-members' ), 235 235 // 'instructions' => __( 'Enable/disable the Delete account for account. <code>[advanced-members-account tab="delete"]</code>', 'advanced-members' ), … … 248 248 'key' => 'default', 249 249 'prefix' => 'amem_options[accform]', 250 'value' => AMem()->options->get('accform/default'),250 'value' => amem()->options->get('accform/default'), 251 251 'label' => __( 'Default Account Form', 'advanced-members' ), 252 252 'choices' => $account_forms, … … 263 263 264 264 ); 265 if( !empty( AMem()->options->get('accform/rules') ) ) {266 $view_args['group'] = AMem()->options->get('accform/rules');265 if( !empty( amem()->options->get('accform/rules') ) ) { 266 $view_args['group'] = amem()->options->get('accform/rules'); 267 267 } 268 268 amem_get_view( __DIR__ . '/html-options-rule-fields.php', $view_args ); … … 275 275 'key' => $role_key, 276 276 'prefix' => 'amem_options[accform]', 277 'value' => AMem()->options->get('accform/role_key'),277 'value' => amem()->options->get('accform/role_key'), 278 278 'label' => $role_label, 279 279 'choices' => $account_forms, … … 295 295 'key' => 'delete_account_text', 296 296 'prefix' => 'amem_options[account]', 297 'value' => AMem()->options->get('account/delete_account_text'),297 'value' => amem()->options->get('account/delete_account_text'), 298 298 'label' => __( 'Account Deletion Custom Text', 'advanced-members' ), 299 299 'instructions' => __( 'This is custom text that will be displayed to users before they delete their accounts from your site.', 'advanced-members' ), … … 313 313 'key' => 'delete_account_label', 314 314 'prefix' => 'amem_options[account]', 315 'value' => AMem()->options->get('account/delete_account_label'),315 'value' => amem()->options->get('account/delete_account_label'), 316 316 'label' => __( 'Account Deletion Confirmation Label', 'advanced-members' ), 317 317 'instructions' => __( 'This is label that will be displayed right of account deletion agree check.', 'advanced-members' ), … … 342 342 'key' => '_after_' . $act, 343 343 'prefix' => 'amem_options[redirect]', 344 'value' => AMem()->options->get('redirect/_after_' . $act),344 'value' => amem()->options->get('redirect/_after_' . $act), 345 345 'label' => $data['label'], 346 346 'choices' => $_choices, … … 356 356 'key' => $act . '_redirect_url', 357 357 'prefix' => 'amem_options[redirect]', 358 'value' => AMem()->options->get('redirect/' . $act . '_redirect_url'),358 'value' => amem()->options->get('redirect/' . $act . '_redirect_url'), 359 359 'label' => __( 'Set Custom Redirect URL', 'advanced-members' ), 360 360 'instructions' => $instuction, … … 379 379 'key' => 'apply_roles_redirection', 380 380 'prefix' => 'amem_options[roles]', 381 'value' => AMem()->options->get('roles/apply_roles_redirection'),381 'value' => amem()->options->get('roles/apply_roles_redirection'), 382 382 'label' => __( 'Enable redirection by role', 'advanced-members' ), 383 383 'instructions' => __( 'Enable/disable used on the redirection by role', 'advanced-members' ), … … 393 393 'redirections' => $redirections, 394 394 'choices' => $choices, 395 'table_wrap_class' => AMem()->options->get('roles/apply_roles_redirection', true) ? '' : ' acf-hidden'395 'table_wrap_class' => amem()->options->get('roles/apply_roles_redirection', true) ? '' : ' acf-hidden' 396 396 ); 397 397 amem_get_view( __DIR__ . '/html-options-roles-redirection.php', $view_args ); … … 400 400 case 'email': 401 401 // $email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] ); 402 $email_notifications = AMem()->config->email_notifications;402 $email_notifications = amem()->config->email_notifications; 403 403 if( $email_notifications ){ 404 404 $view_args = array( 405 405 'email_notifications' => $email_notifications, 406 'email_options' => AMem()->options->get_emails(),406 'email_options' => amem()->options->get_emails(), 407 407 ); 408 408 amem_get_view( __DIR__ . '/html-options-list-email.php', $view_args ); … … 416 416 // 'key' => 'global', 417 417 // 'prefix' => 'amem_options[adminbar]', 418 // 'value' => AMem()->options->get('adminbar/global'),418 // 'value' => amem()->options->get('adminbar/global'), 419 419 // 'label' => __( 'Disable Admin Bar', 'advanced-members' ), 420 420 // 'instructions' => __( 'Admin bar on frontend is disabled when this option is on', 'advanced-members' ), … … 430 430 // 'key' => 'by_roles', 431 431 // 'prefix' => 'amem_options[adminbar]', 432 // 'value' => AMem()->options->get('adminbar/by_roles'),432 // 'value' => amem()->options->get('adminbar/by_roles'), 433 433 // 'label' => __( 'Enable admin bar visibility by role', 'advanced-members' ), 434 434 // 'instructions' => __( 'Enable/disable show/hide admin bar by role', 'advanced-members' ), … … 456 456 'key' => $key, 457 457 'prefix' => 'amem_options[adminbar][roles]', 458 'value' => AMem()->options->get('adminbar/roles/'.$key),458 'value' => amem()->options->get('adminbar/roles/'.$key), 459 459 'label' => $role['name'], 460 460 // 'choices' => $choices, -
advanced-members/trunk/advanced-members.php
r3182890 r3186203 4 4 * Plugin URI: https://advanced-members.com/ 5 5 * Description: Lightweight & All-in-One Membership Plugin for ACF Fans. 6 * Version: 0.9. 36 * Version: 0.9.4 7 7 * Author: DanbiLabs 8 8 * Author URI: https://danbistore.com … … 45 45 46 46 /** @var string version */ 47 public static $version = '0.9. 3';47 public static $version = '0.9.4'; 48 48 49 49 /** @var string version */ … … 91 91 function __construct() { 92 92 add_action( 'setup_theme', array( $this, 'setup_plugin' ), 10, 0 ); 93 $this->dev = defined( 'AM em_DEV') && AMem_DEV;93 $this->dev = defined( 'AMEM_DEV') && AMEM_DEV; 94 94 } 95 95 … … 214 214 require_once( __DIR__ . '/core/functions-helpers.php' ); 215 215 216 $this->define( 'AM em_NAME', static::$name );217 $this->define( 'AM em_PATH', plugin_dir_path( __FILE__ ) );218 $this->define( 'AM em_BASENAME', plugin_basename( __FILE__ ) );219 $this->define( 'AM em_URL', plugin_dir_url( __FILE__ ) );220 $this->define( 'AM em_VERSION', static::$version );216 $this->define( 'AMEM_NAME', static::$name ); 217 $this->define( 'AMEM_PATH', plugin_dir_path( __FILE__ ) ); 218 $this->define( 'AMEM_BASENAME', plugin_basename( __FILE__ ) ); 219 $this->define( 'AMEM_URL', plugin_dir_url( __FILE__ ) ); 220 $this->define( 'AMEM_VERSION', static::$version ); 221 221 222 222 load_plugin_textdomain( 'advanced-members', false, basename( __DIR__ ) . '/languages' ); … … 268 268 amem_include( 'core/class-rest.php' ); 269 269 270 do_action( 'amem/setup_plugin', AM em_VERSION );270 do_action( 'amem/setup_plugin', AMEM_VERSION ); 271 271 272 272 // Apply hooks by modules … … 300 300 amem_include( 'core/forms/actions.php' ); 301 301 amem_include( 'core/actions/user.php' ); 302 do_action( 'amem/register_actions', AM em_VERSION );302 do_action( 'amem/register_actions', AMEM_VERSION ); 303 303 304 304 // Load core addons 305 305 global $wp_version; 306 if ( version_compare( $wp_version, '5.4.0', '>=' ) && AMem()->options->getmodule('_use_menu') )306 if ( version_compare( $wp_version, '5.4.0', '>=' ) && amem()->options->getmodule('_use_menu') ) 307 307 amem_include( 'core/modules/menu/class-items.php' ); 308 308 309 if ( AMem()->options->getmodule('_use_redirects') )309 if ( amem()->options->getmodule('_use_redirects') ) 310 310 amem_include( 'core/modules/class-redirects.php' ); 311 311 312 if ( AMem()->options->getmodule('_use_adminbar') )312 if ( amem()->options->getmodule('_use_adminbar') ) 313 313 amem_include( 'core/modules/class-adminbar.php' ); 314 314 315 315 // Load AddOns 316 do_action( 'amem/register_addons', AM em_VERSION );316 do_action( 'amem/register_addons', AMEM_VERSION ); 317 317 318 318 do_action( 'amem/load' ); … … 473 473 474 474 public function is_amem() { 475 return $this->is_amem || AMem()->submission;475 return $this->is_amem || amem()->submission; 476 476 } 477 477 … … 497 497 } 498 498 499 function AMem() {499 function amem() { 500 500 global $amem; 501 501 … … 508 508 509 509 // Initalize plugin 510 AMem();510 amem(); 511 511 512 512 endif; -
advanced-members/trunk/core/abstracts/action.php
r3182890 r3186203 39 39 $nonce_value = sprintf( 'amem_submission_%s_%s', $form['key'], $hashed_args ); 40 40 if ( ! wp_verify_nonce( $nonce, $nonce_value ) ) { 41 amem_add_error( 'field_amem_errors', AMem()->errors->text('nonce_failed') );41 amem_add_error( 'field_amem_errors', amem()->errors->text('nonce_failed') ); 42 42 } 43 43 } -
advanced-members/trunk/core/abstracts/addon.php
r3182890 r3186203 23 23 protected $label = '';// Display name of module 24 24 25 protected $version = AM em_VERSION;// Module version. used for upgrade actions and scripts, styles print25 protected $version = AMEM_VERSION;// Module version. used for upgrade actions and scripts, styles print 26 26 27 27 protected $min_amem_version;// Minimum Advanced Members for ACF version required for module -
advanced-members/trunk/core/abstracts/module.php
r3182890 r3186203 19 19 protected $url = ''; 20 20 21 protected $version = AM em_VERSION;21 protected $version = AMEM_VERSION; 22 22 23 23 public $priority = 10; -
advanced-members/trunk/core/actions/account.php
r3182890 r3186203 42 42 // add_filter( 'amem/form/error_message', [$this, 'error_message'] ); 43 43 44 $this->current_tab =& AMem()->account->current_tab;44 $this->current_tab =& amem()->account->current_tab; 45 45 } 46 46 47 47 function validate( $form, $args, $fields ) { 48 48 if ( !is_user_logged_in() ) { 49 amem_add_error( 'field_amem_errors', AMem()->errors->text('logged_out') );49 amem_add_error( 'field_amem_errors', amem()->errors->text('logged_out') ); 50 50 } 51 51 } … … 170 170 $user_data = array(); 171 171 172 $predefined_fields = AMem()->fields->predefined_fields();172 $predefined_fields = amem()->fields->predefined_fields(); 173 173 $processed = []; 174 174 … … 208 208 $error = $updated_user_id->get_error_message(); 209 209 } 210 AMem()->errors->add( 'user_update_error', $error );210 amem()->errors->add( 'user_update_error', $error ); 211 211 return false; 212 212 } … … 215 215 216 216 if ( ! $user || is_null( $user ) ) { 217 AMem()->errors->add( 'user_update_error', $error );217 amem()->errors->add( 'user_update_error', $error ); 218 218 return false; 219 219 } … … 222 222 223 223 // Save user ID to submission object 224 AMem()->submission['user'] = $user->ID;224 amem()->submission['user'] = $user->ID; 225 225 226 226 do_action( 'amem/user/updated', $user, $form, $args ); … … 241 241 do_action( 'amem/user/delete/before', $user_id, $form, $args ); 242 242 243 if ( ! AMem()->is_dev() )244 AMem()->user->delete($user_id);243 if ( !amem()->is_dev() ) 244 amem()->user->delete($user_id); 245 245 246 246 do_action( 'amem/user/delete/after', $user_id, $form, $args ); … … 305 305 'required' => true, 306 306 // 'custom_username' => true, 307 // 'value' => AMem()->user->get('user_login'),307 // 'value' => amem()->user->get('user_login'), 308 308 '_amem_local' => true, 309 309 ), … … 315 315 'required' => true, 316 316 // 'custom_email' => true, 317 // 'value' => AMem()->user->get('user_email'),317 // 'value' => amem()->user->get('user_email'), 318 318 '_amem_local' => true, 319 319 ), … … 323 323 // 'name' => 'first_name', 324 324 // 'type' => 'first_name', 325 // // 'value' => AMem()->user->get('first_name'),325 // // 'value' => amem()->user->get('first_name'), 326 326 // '_amem_local' => true, 327 327 // ), … … 331 331 // 'name' => 'last_name', 332 332 // 'type' => 'last_name', 333 // // 'value' => AMem()->user->get('last_name'),333 // // 'value' => amem()->user->get('last_name'), 334 334 // '_amem_local' => true, 335 335 // ), … … 403 403 $fields = []; 404 404 405 $alert_text = AMem()->options->get('account/account_delete_text');405 $alert_text = amem()->options->get('account/account_delete_text'); 406 406 if ( !$alert_text ) { 407 407 /* translators: Delete account explain message */ … … 415 415 } 416 416 417 $confirm_text = AMem()->options->get('account/delete_account_label');417 $confirm_text = amem()->options->get('account/delete_account_label'); 418 418 if ( !$confirm_text ) { 419 419 // $confirm_text = sprintf( __( 'I acknowledge that the account and data on "%s" will be deleted.', 'advanced-members' ), get_bloginfo('name') ); … … 466 466 467 467 if ( $field_group ) 468 AMem()->render->render_field_group( $field_group, $form, $args );468 amem()->render->render_field_group( $field_group, $form, $args ); 469 469 } 470 470 … … 475 475 add_action( 'amem/form/after_fields/type=account', [$this, 'local_fields'], 50, 2 ); 476 476 477 AMem()->render->render( AMem()->account->get_form_id(), $args );477 amem()->render->render( amem()->account->get_form_id(), $args ); 478 478 } 479 479 … … 484 484 add_action( 'amem/form/local_fields/type=account', [$this, 'local_fields'], 10, 2 ); 485 485 486 AMem()->render->render( AMem()->account->get_form_id(), $args );486 amem()->render->render( amem()->account->get_form_id(), $args ); 487 487 } 488 488 … … 493 493 add_action( 'amem/form/local_fields/type=account', [$this, 'local_fields'], 10, 2 ); 494 494 495 AMem()->render->render( AMem()->account->get_form_id(), $args );495 amem()->render->render( amem()->account->get_form_id(), $args ); 496 496 } 497 497 498 498 function content_logged_out($args, $data) { 499 499 // Always use local form key to avoid render account fields 500 AMem()->render->render( AMem()->account->form_key, $args );500 amem()->render->render( amem()->account->form_key, $args ); 501 501 } 502 502 … … 510 510 case 'general': 511 511 case 'password': 512 $is_required = AMem()->options->get( 'account/show_current_passwd' );512 $is_required = amem()->options->get( 'account/show_current_passwd' ); 513 513 break; 514 514 case 'delete': … … 532 532 } 533 533 534 AMem()->register_action('account', Account::getInstance());534 amem()->register_action('account', Account::getInstance()); -
advanced-members/trunk/core/actions/login.php
r3182890 r3186203 60 60 // Do not append to existing 61 61 if ( '' == $message && is_user_logged_in() ) { 62 $message = AMem()->errors->text( 'logged_in' );62 $message = amem()->errors->text( 'logged_in' ); 63 63 } 64 64 … … 68 68 function validate( $form, $args, $fields ) { 69 69 if ( is_user_logged_in() ) { 70 amem_add_error( 'field_amem_errors', AMem()->errors->text('logged_in') );70 amem_add_error( 'field_amem_errors', amem()->errors->text('logged_in') ); 71 71 } 72 72 } … … 87 87 88 88 if ( $user_password == '' ) { 89 amem_add_error( $amem['user_password'], AMem()->errors->text('empty_password') );89 amem_add_error( $amem['user_password'], amem()->errors->text('empty_password') ); 90 90 return; 91 91 } 92 92 93 93 if ( isset( $data['username'] ) && $data['username'] == '' ) { 94 amem_add_error( $amem['username'], AMem()->errors->text('empty_username_email') );94 amem_add_error( $amem['username'], amem()->errors->text('empty_username_email') ); 95 95 } 96 96 97 97 if ( isset( $data['user_email'] ) && $data['user_email'] == '' ) { 98 amem_add_error( $amem['user_email'], AMem()->errors->text('empty_email') );98 amem_add_error( $amem['user_email'], amem()->errors->text('empty_email') ); 99 99 } 100 100 … … 103 103 if ( isset($data[$ukey]) ) { 104 104 if ( $data[$ukey] == '' ) { 105 amem_add_error( $amem[$ukey], AMem()->errors->text('empty_username_email') );105 amem_add_error( $amem[$ukey], amem()->errors->text('empty_username_email') ); 106 106 } else { 107 107 $user_name = $data[$ukey]; … … 112 112 113 113 if ( $user_name == '' ) { 114 amem_add_error( 'field_amem_errors', AMem()->errors->text('empty_username_email') );114 amem_add_error( 'field_amem_errors', amem()->errors->text('empty_username_email') ); 115 115 return; 116 116 } … … 125 125 126 126 if ( !$user || is_wp_error($user) ) { 127 amem_add_error( $amem[$ukey], sprintf( AMem()->errors->text('username_not_exists'), $data[$field] ) );127 amem_add_error( $amem[$ukey], sprintf( amem()->errors->text('username_not_exists'), $data[$field] ) ); 128 128 return; 129 129 } … … 131 131 $auth_id = 0; 132 132 if ( wp_check_password( $user_password, $user->data->user_pass, $user->ID ) ) { 133 AMem()->submission['form']['auth_id'] = $user->ID;133 amem()->submission['form']['auth_id'] = $user->ID; 134 134 } else { 135 amem_add_error( $amem['user_password'], AMem()->errors->text('password_incorrect') );135 amem_add_error( $amem['user_password'], amem()->errors->text('password_incorrect') ); 136 136 } 137 137 … … 147 147 amem_add_error( $amem['user_password'], $user->get_error_message() ); 148 148 } else { 149 amem_add_error( $amem['user_password'], AMem()->errors->text('password_incorrect') );149 amem_add_error( $amem['user_password'], amem()->errors->text('password_incorrect') ); 150 150 } 151 151 } … … 156 156 amem_add_error( $amem['user_password'], $user->get_error_message() ); 157 157 } else { 158 amem_add_error( $amem['user_password'], AMem()->errors->text('password_incorrect') );158 amem_add_error( $amem['user_password'], amem()->errors->text('password_incorrect') ); 159 159 } 160 160 } … … 162 162 // if there is an error notify wp 163 163 if ( !$this->is_valid() ) { 164 do_action( 'wp_login_failed', $user_name, AMem()->errors->to_wp_error() );164 do_action( 'wp_login_failed', $user_name, amem()->errors->to_wp_error() ); 165 165 } 166 166 } … … 177 177 } 178 178 179 $user_id = ( isset( AMem()->submission['form']['auth_id'] ) ) ? AMem()->submission['form']['auth_id'] : '';179 $user_id = ( isset( amem()->submission['form']['auth_id'] ) ) ? amem()->submission['form']['auth_id'] : ''; 180 180 $status = ''; 181 181 … … 190 190 case 'rejected': 191 191 $redirect_url = add_query_arg( 'errc', esc_attr( $status ), amem_get_current_url() ); 192 if ( AMem()->submissions->is_ajax() ) {193 amem_add_error( 'field_amem_errors', AMem()->errors->text($status) );194 // amem_add_submission_error( AMem()->errors->text($status) );192 if ( amem()->submissions->is_ajax() ) { 193 amem_add_error( 'field_amem_errors', amem()->errors->text($status) ); 194 // amem_add_submission_error( amem()->errors->text($status) ); 195 195 // remove_action( 'amem/user/login', array( $this, 'process') ); 196 AMem()->submissions->set_redirect( $redirect_url );196 amem()->submissions->set_redirect( $redirect_url ); 197 197 } else { 198 amem_add_error( 'field_amem_errors', AMem()->errors->text($status) );198 amem_add_error( 'field_amem_errors', amem()->errors->text($status) ); 199 199 // wp_safe_redirect( $redirect_url ); 200 200 // exit; … … 213 213 $user_password = !isset($data['user_password']) ? '' : $data['user_password']; 214 214 // double check user is verified by check_fields 215 $user_id = isset( AMem()->submission['form']['auth_id']) ? AMem()->submission['form']['auth_id'] : 0;215 $user_id = isset(amem()->submission['form']['auth_id']) ? amem()->submission['form']['auth_id'] : 0; 216 216 217 217 $user_name = ''; … … 245 245 $rememberme = ( isset( $_REQUEST['amem_login_rememberme'] ) && 1 === (int) $_REQUEST['amem_login_rememberme'] ) ? 1 : 0; 246 246 247 $user_id = isset( AMem()->submission['form']['auth_id']) ? AMem()->submission['form']['auth_id'] : 0;247 $user_id = isset(amem()->submission['form']['auth_id']) ? amem()->submission['form']['auth_id'] : 0; 248 248 $this->auto_login( $form, $rememberme ); 249 249 } … … 298 298 299 299 <?php if ( $data['rememberme'] ) { 300 // AMem()->render->render_field($rememberme, $form, $args); ?>300 // amem()->render->render_field($rememberme, $form, $args); ?> 301 301 <div class="amem-local-field"> 302 302 <label for="amem_login_rememberme"> … … 354 354 } 355 355 356 AMem()->register_action('login', Login::getInstance());356 amem()->register_action('login', Login::getInstance()); -
advanced-members/trunk/core/actions/password-reset.php
r3182890 r3186203 37 37 38 38 function get_mode() { 39 return AMem()->passwordreset->get_mode();39 return amem()->passwordreset->get_mode(); 40 40 } 41 41 … … 54 54 // Do not append to existing 55 55 if ( '' == $message && is_user_logged_in() ) { 56 $message = AMem()->errors->text('logged_in');56 $message = amem()->errors->text('logged_in'); 57 57 } 58 58 … … 70 70 function validate( $form, $args, $fields ) { 71 71 if ( is_user_logged_in() ) { 72 amem_add_error( 'field_amem_errors', AMem()->errors->text('logged_in') );72 amem_add_error( 'field_amem_errors', amem()->errors->text('logged_in') ); 73 73 } 74 74 } … … 99 99 100 100 if ( !$this->user || is_wp_error($this->user) ) { 101 amem_add_error( 'username', AMem()->errors->text('username_not_exists') );101 amem_add_error( 'username', amem()->errors->text('username_not_exists') ); 102 102 return; 103 103 } … … 107 107 // $attempts = (int) get_user_meta( $user_id, 'password_rst_attempts', true ); 108 108 // $is_admin = user_can( absint( $user_id ), 'manage_options' ); 109 // $limit = AMem()->options->get( 'reset_password_limit_number' );110 // if ( $limit && AMem()->options->get( 'enable_reset_password_limit' ) ) {111 // if ( ! ( AMem()->options->get( 'disable_admin_reset_password_limit' ) && $is_admin ) ) {109 // $limit = amem()->options->get( 'reset_password_limit_number' ); 110 // if ( $limit && amem()->options->get( 'enable_reset_password_limit' ) ) { 111 // if ( ! ( amem()->options->get( 'disable_admin_reset_password_limit' ) && $is_admin ) ) { 112 112 // // Doesn't trigger this when a user has admin capabilities and when reset password limit is disabled for admins 113 113 // if ( $attempts >= $limit ) { … … 156 156 } 157 157 158 AMem()->user->email_password_reset($this->user->ID);158 amem()->user->email_password_reset($this->user->ID); 159 159 $redirect = remove_query_arg( ['hash', 'login', 'act', 'sent', 'updated'], amem_get_current_url() ); 160 160 wp_safe_redirect( add_query_arg( 'updated', 'pwreset_checkemail', $redirect) ); … … 164 164 function process_change( $form, $fields, $args ) { 165 165 $record = $form['record']; 166 $user = AMem()->passwordreset->get_requested_user();166 $user = amem()->passwordreset->get_requested_user(); 167 167 168 168 $errors = new \WP_Error(); 169 169 if ( !$user || is_wp_error($user) ) { 170 AMem()->passwordreset->setcookie( null, false );170 amem()->passwordreset->setcookie( null, false ); 171 171 if ( $user && 'expired_key' === $user->get_error_code() ) { 172 172 wp_safe_redirect( add_query_arg( array( 'updated' => 'pwreset_expiredkey' ), amem_get_core_page( 'password-reset' ) ) ); … … 191 191 192 192 // send the Password Changed Email 193 AMem()->user->email_password_changed( $user->ID );193 amem()->user->email_password_changed( $user->ID ); 194 194 195 195 // clear temporary data … … 198 198 update_user_meta( $user->ID, 'password_rst_attempts', 0 ); 199 199 } 200 AMem()->passwordreset->setcookie( null, false );200 amem()->passwordreset->setcookie( null, false ); 201 201 202 202 do_action( 'amem/user/passwordchange/after', $user->ID ); … … 254 254 } 255 255 256 AMem()->register_action('passwordreset', PasswordReset::getInstance());256 amem()->register_action('passwordreset', PasswordReset::getInstance()); -
advanced-members/trunk/core/actions/registration.php
r3182890 r3186203 39 39 // Do not append to existing 40 40 if ( '' == $message && is_user_logged_in() ) { 41 $message = AMem()->errors->text( 'logged_in' );41 $message = amem()->errors->text( 'logged_in' ); 42 42 } 43 43 … … 67 67 function validate( $form, $args, $fields ) { 68 68 if ( is_user_logged_in() ) { 69 amem_add_error( 'field_amem_errors', AMem()->errors->text('logged_in') );69 amem_add_error( 'field_amem_errors', amem()->errors->text('logged_in') ); 70 70 return false; 71 71 } … … 74 74 75 75 if ( 'new' != $user_id && !$user_id ) { 76 amem_add_error( 'field_amem_errors', AMem()->errors->text('invalid_form') );76 amem_add_error( 'field_amem_errors', amem()->errors->text('invalid_form') ); 77 77 return false; 78 78 } … … 93 93 $user_data = array(); 94 94 95 $predefined_fields = AMem()->fields->predefined_fields();95 $predefined_fields = amem()->fields->predefined_fields(); 96 96 97 97 $processed = []; … … 140 140 $error = $inserted_id->get_error_message(); 141 141 } 142 AMem()->errors->add( 'user_insert_error', $error );142 amem()->errors->add( 'user_insert_error', $error ); 143 143 return false; 144 144 } … … 147 147 148 148 if ( ! $user || is_null( $user ) ) { 149 AMem()->errors->add( 'user_insert_error', $error );149 amem()->errors->add( 'user_insert_error', $error ); 150 150 return false; 151 151 } … … 160 160 161 161 // Save user ID to submission object 162 AMem()->submission['user'] = $user->ID;162 amem()->submission['user'] = $user->ID; 163 163 $status = $form['data']['account_status']; 164 164 … … 166 166 switch( $status ) { 167 167 case 'approve': 168 AMem()->user->approve( $user->ID );168 amem()->user->approve( $user->ID ); 169 169 break; 170 170 case 'mailcheck': 171 AMem()->user->email_pending( $user->ID );171 amem()->user->email_pending( $user->ID ); 172 172 add_filter( 'amem/form/submit/redirect/registration', function($url) { 173 173 if ( '' == $url ) … … 187 187 188 188 // if ( $status == 'approve' ) { 189 // AMem()->actions->login->auto_login( amem_encrypt($user->ID) );189 // amem()->actions->login->auto_login( amem_encrypt($user->ID) ); 190 190 // } 191 191 … … 203 203 } 204 204 205 AMem()->register_action('registration', Registration::getInstance());205 amem()->register_action('registration', Registration::getInstance()); -
advanced-members/trunk/core/class-account.php
r3182890 r3186203 65 65 66 66 function acf_form_data($data, $form, $args) { 67 if ( $form['type'] == 'account' && AMem()->user->id > 0 ) {68 $data['post_id'] = "user_" . AMem()->user->id;67 if ( $form['type'] == 'account' && amem()->user->id > 0 ) { 68 $data['post_id'] = "user_" . amem()->user->id; 69 69 } 70 70 return $data; … … 87 87 $role = 'subscriber'; 88 88 89 $form_id = AMem()->options->get('accform/default');90 foreach ( (array) AMem()->options->get('accform/rules') as $rule ) {89 $form_id = amem()->options->get('accform/default'); 90 foreach ( (array) amem()->options->get('accform/rules') as $rule ) { 91 91 if ( !is_array($rule) ) continue; 92 92 if ( in_array($rule['role'], $roles) && $rule['value'] > '0' ) { … … 165 165 ); 166 166 167 // if ( AMem()->options->get('account/use_password') ) {167 // if ( amem()->options->get('account/use_password') ) { 168 168 $tabs[200]['password'] = array( 169 169 'icon' => null, … … 173 173 // } 174 174 175 // if ( AMem()->options->get('account/use_delete') ) {175 // if ( amem()->options->get('account/use_delete') ) { 176 176 // If user cannot delete profile hide delete tab. 177 // if ( AMem()->user->can( 'delete_profile' ) || AMem()->user->can( 'delete_users' ) ) {177 // if ( amem()->user->can( 'delete_profile' ) || amem()->user->can( 'delete_users' ) ) { 178 178 $tabs[99999]['delete'] = array( 179 179 'icon' => null, … … 289 289 // do_action( "amem/account/before" . $args['tab'], $args ); 290 290 291 // AMem()->template->template_load( $args['template'], $args );291 // amem()->template->template_load( $args['template'], $args ); 292 292 } 293 293 … … 327 327 'type' => 'account', 328 328 'data' => array( 329 'ajax' => AMem()->options->get('ajax_submit'),329 'ajax' => amem()->options->get('ajax_submit'), 330 330 'description' => '', 331 331 'success_message' => '', … … 351 351 // $form['data']['redirect_url'] = get_post_meta($_form_id, "amem_form_account_delete_redirect_url", true); 352 352 // } else { 353 // $form['data']['after_submit'] = AMem()->options->get('redirect/_after_account_delete');354 // $form['data']['redirect_url'] = AMem()->options->get('redirect/account_delete_redirect_url');353 // $form['data']['after_submit'] = amem()->options->get('redirect/_after_account_delete'); 354 // $form['data']['redirect_url'] = amem()->options->get('redirect/account_delete_redirect_url'); 355 355 // } 356 356 if ( $form['data']['after_submit'] == 'success_message' ) {// DEV compatibility … … 362 362 } 363 363 364 AMem()->local->add_form($form);364 amem()->local->add_form($form); 365 365 366 366 $registered = true; … … 369 369 } 370 370 371 AMem()->register_module('account', Account::getInstance());371 amem()->register_module('account', Account::getInstance()); -
advanced-members/trunk/core/class-blocks.php
r3182890 r3186203 142 142 'slug' => '' 143 143 ]; 144 $forms = AMem()->rest->forms( ['type' => ['login', 'registration']] );144 $forms = amem()->rest->forms( ['type' => ['login', 'registration']] ); 145 145 $forms = [$blank_form] + $forms; 146 146 147 $preForms = AMem()->rest->preForms();147 $preForms = amem()->rest->preForms(); 148 148 $preForms = [$blank_form] + $preForms; 149 149 … … 211 211 } 212 212 213 AMem()->register_module( 'blocks', Blocks::getInstance() );213 amem()->register_module( 'blocks', Blocks::getInstance() ); -
advanced-members/trunk/core/class-config.php
r3182890 r3186203 316 316 } 317 317 318 AMem()->register_module('config', Config::getInstance());318 amem()->register_module('config', Config::getInstance()); -
advanced-members/trunk/core/class-errors.php
r3182890 r3186203 106 106 } 107 107 108 AMem()->register_module('errors', Errors::getInstance());108 amem()->register_module('errors', Errors::getInstance()); -
advanced-members/trunk/core/class-fields.php
r3182890 r3186203 99 99 amem_include( $this->inc . "class-user-password-confirm.php" ); 100 100 101 do_action( 'amem/include_field_types', AM em_VERSION );101 do_action( 'amem/include_field_types', AMEM_VERSION ); 102 102 103 103 } … … 196 196 function register_scripts() { 197 197 $min = ''; 198 wp_register_script( 'amem-input', amem_get_url("assets/build/js/amem-input{$min}.js"), array( 'jquery', 'acf-input' ), AM em_VERSION, true );198 wp_register_script( 'amem-input', amem_get_url("assets/build/js/amem-input{$min}.js"), array( 'jquery', 'acf-input' ), AMEM_VERSION, true ); 199 199 200 200 do_action( 'amem/register_scripts' ); … … 227 227 } 228 228 229 AMem()->register_module('fields', Fields::getInstance());229 amem()->register_module('fields', Fields::getInstance()); -
advanced-members/trunk/core/class-files.php
r3182890 r3186203 313 313 } 314 314 315 AMem()->register_module( 'files', Files::getInstance() );315 amem()->register_module( 'files', Files::getInstance() ); -
advanced-members/trunk/core/class-local.php
r3182890 r3186203 116 116 } 117 117 118 AMem()->register_module('local', Local::getInstance());118 amem()->register_module('local', Local::getInstance()); -
advanced-members/trunk/core/class-locations.php
r3182890 r3186203 83 83 } 84 84 85 AMem()->register_module('locations', Locations::getInstance());85 amem()->register_module('locations', Locations::getInstance()); -
advanced-members/trunk/core/class-logout.php
r3182890 r3186203 48 48 49 49 } 50 AMem()->register_module('logout', Logout::getInstance());50 amem()->register_module('logout', Logout::getInstance()); -
advanced-members/trunk/core/class-mail.php
r3182890 r3186203 59 59 } 60 60 61 $options = AMem()->options->get_emails();61 $options = amem()->options->get_emails(); 62 62 63 63 if( !isset($options[$template]) ){ … … 123 123 public function add_replace_placeholder( $replace_placeholders ) { 124 124 $replace_placeholders[] = get_bloginfo( 'url' ); 125 $replace_placeholders[] = AMem()->options->get('admin_email');125 $replace_placeholders[] = amem()->options->get('admin_email'); 126 126 $replace_placeholders[] = amem_get_core_page( 'login' ); 127 127 $replace_placeholders[] = esc_html__( 'Your set password', 'advanced-members' ); … … 131 131 } 132 132 } 133 AMem()->register_module('mail', Mail::getInstance());133 amem()->register_module('mail', Mail::getInstance()); -
advanced-members/trunk/core/class-options.php
r3182890 r3186203 135 135 */ 136 136 function get_core_pages() { 137 $core_pages = array_keys( AMem()->config->core_pages );137 $core_pages = array_keys( amem()->config->core_pages ); 138 138 if ( empty( $core_pages ) ) { 139 139 return $this->permalinks; … … 152 152 153 153 function default_emails() { 154 $emails = AMem()->config->email_notifications;154 $emails = amem()->config->email_notifications; 155 155 $options = []; 156 156 foreach ( $emails as $k => $email ) { … … 261 261 } 262 262 263 AMem()->register_module('options', Options::getInstance());263 amem()->register_module('options', Options::getInstance()); -
advanced-members/trunk/core/class-password-reset.php
r3182890 r3186203 67 67 if ( in_array($updated, ['pwreset_checkemail', 'pwreset_password_changed'], true) ) { 68 68 // manually print message 69 amem_form_updated_message( AMem()->local->get_form( $this->form_key ), $atts, true );69 amem_form_updated_message( amem()->local->get_form( $this->form_key ), $atts, true ); 70 70 } else { 71 AMem()->render->render($this->form_key, $atts);71 amem()->render->render($this->form_key, $atts); 72 72 } 73 73 … … 186 186 ); 187 187 188 AMem()->local->add_form($form);188 amem()->local->add_form($form); 189 189 190 190 switch( $this->mode ) { … … 229 229 } 230 230 231 AMem()->local->add_group( array(231 amem()->local->add_group( array( 232 232 'key' => 'group_amem_passwordreset', 233 233 'title' => '', … … 267 267 } 268 268 269 AMem()->register_module('passwordreset', PasswordReset::getInstance());269 amem()->register_module('passwordreset', PasswordReset::getInstance()); -
advanced-members/trunk/core/class-rest.php
r3182890 r3186203 133 133 } 134 134 135 AMem()->register_module( 'rest', REST::getInstance() );135 amem()->register_module( 'rest', REST::getInstance() ); -
advanced-members/trunk/core/class-setup.php
r3182890 r3186203 21 21 public function install_default_options() { 22 22 23 foreach ( AMem()->get_module('config')->default_settings as $key => $value ) {23 foreach ( amem()->get_module('config')->default_settings as $key => $value ) { 24 24 $options[ $key ] = $value; 25 25 } … … 32 32 public function install_default_forms() { 33 33 if ( current_user_can( 'manage_options' ) && ! get_option( 'amem_default_installed' ) ) { 34 foreach ( AMem()->get_module('config')->core_forms as $id ) {35 $isset_form = AMem()->options->find_core( 'amem-form', 'amem_core_form', $id );34 foreach ( amem()->get_module('config')->core_forms as $id ) { 35 $isset_form = amem()->options->find_core( 'amem-form', 'amem_core_form', $id ); 36 36 if ( ! $isset_form ) { 37 37 // if( $id != 'register' ){ … … 57 57 $form_id = wp_insert_post( $form ); 58 58 $form_key = ''; 59 foreach ( AMem()->config->amem_default_form_meta[ $id ] as $key => $value ) {59 foreach ( amem()->config->amem_default_form_meta[ $id ] as $key => $value ) { 60 60 if( $key == 'form_key'){ 61 61 $form_key = $value; … … 64 64 } 65 65 66 $acf_fied_group_content = AMem()->config->amem_default_field_group;66 $acf_fied_group_content = amem()->config->amem_default_field_group; 67 67 $acf_fied_group_content['location'][0][0]['value'] = $form_key; 68 68 $field_group_id = $this->install_default_field_groups( $id, $current_uid , $acf_fied_group_content ); 69 69 70 70 if( $field_group_id ){ 71 $acf_fied_group_fields = AMem()->config->amem_default_fields[$id];71 $acf_fied_group_fields = amem()->config->amem_default_fields[$id]; 72 72 $this->insert_fields( $acf_fied_group_fields , $field_group_id ); 73 73 } … … 116 116 117 117 public function install_default_pages() { 118 $amem_core_pages = AMem()->config->core_pages;118 $amem_core_pages = amem()->config->core_pages; 119 119 $core_pages = array(); 120 120 $current_uid = get_current_user_id(); … … 124 124 125 125 foreach ($amem_core_pages as $slug => $page) { 126 $isset_page = AMem()->options->find_core( 'page', 'amem_core_page', $slug );126 $isset_page = amem()->options->find_core( 'page', 'amem_core_page', $slug ); 127 127 if ( ! $isset_page ) { 128 128 //insert new core page … … 150 150 break; 151 151 default: 152 $form_id = AMem()->options->find_core( 'amem-form', 'amem_core_form', $slug );152 $form_id = amem()->options->find_core( 'amem-form', 'amem_core_form', $slug ); 153 153 if( !empty($form_id) ){ 154 154 $hash = esc_attr( get_post_meta( $form_id, 'form_key', true ) ); … … 197 197 } 198 198 199 AMem()->register_module('setup', Setup::getInstance());199 amem()->register_module('setup', Setup::getInstance()); -
advanced-members/trunk/core/class-template.php
r3182890 r3186203 90 90 } 91 91 92 AMem()->register_module('template', Tempalte::getInstance());92 amem()->register_module('template', Tempalte::getInstance()); -
advanced-members/trunk/core/class-user.php
r3182890 r3186203 225 225 $user->destroy_all(); 226 226 227 AMem()->mail->send( amem_user( 'user_email' ) , 'checkmail_email' );227 amem()->mail->send( amem_user( 'user_email' ) , 'checkmail_email' ); 228 228 229 229 if ( $user_id ) … … 242 242 $key = $this->maybe_generate_password_reset_key( $userdata ); 243 243 244 add_filter( 'amem/template/merge_tags', array( AMem()->passwordreset, 'add_placeholder' ), 10, 1 );245 add_filter( 'amem/template/merge_tags/replace', array( AMem()->passwordreset, 'add_replace_placeholder' ), 10, 1 );246 247 AMem()->mail->send( $userdata->user_email, 'resetpw_email' );244 add_filter( 'amem/template/merge_tags', array( amem()->passwordreset, 'add_placeholder' ), 10, 1 ); 245 add_filter( 'amem/template/merge_tags/replace', array( amem()->passwordreset, 'add_replace_placeholder' ), 10, 1 ); 246 247 amem()->mail->send( $userdata->user_email, 'resetpw_email' ); 248 248 249 249 if ( $user_id ) … … 262 262 } 263 263 264 AMem()->mail->send( amem_user( 'user_email' ) , 'changedpw_email' );264 amem()->mail->send( amem_user( 'user_email' ) , 'changedpw_email' ); 265 265 266 266 if ( $user_id ) … … 286 286 $this->maybe_generate_password_reset_key( $userdata ); 287 287 288 AMem()->mail->send( amem_user( 'user_email' ), 'approved_email' );289 290 } else { 291 AMem()->mail->send( amem_user( 'user_email' ), 'welcome_email' );288 amem()->mail->send( amem_user( 'user_email' ), 'approved_email' ); 289 290 } else { 291 amem()->mail->send( amem_user( 'user_email' ), 'welcome_email' ); 292 292 } 293 293 294 294 // Admin notification 295 AMem()->mail->send( AMem()->options->get('admin_email'), 'notification_new_user', array( 'admin' => true ) );295 amem()->mail->send( amem()->options->get('admin_email'), 'notification_new_user', array( 'admin' => true ) ); 296 296 297 297 … … 352 352 353 353 /** @todo Add options and remove comments on delete */ 354 if ( AMem()->options->get( 'delete_comments' ) ) {354 if ( amem()->options->get( 'delete_comments' ) ) { 355 355 $user = get_user_by( 'id', $this->id ); 356 356 … … 363 363 // send email notifications 364 364 if ( $this->send_deleted_mail ) { 365 AMem()->mail->send( amem_user( 'user_email' ), 'deletion_email' );366 367 $admin_email = AMem()->options->get( 'admin_email' );368 AMem()->mail->send( $admin_email, 'notification_deletion', array( 'admin' => true ) );365 amem()->mail->send( amem_user( 'user_email' ), 'deletion_email' ); 366 367 $admin_email = amem()->options->get( 'admin_email' ); 368 amem()->mail->send( $admin_email, 'notification_deletion', array( 'admin' => true ) ); 369 369 } 370 370 } … … 387 387 $this->usermeta_update( 'registration_secretkey_hash' ); 388 388 389 $expiry_time = (int) AMem()->options->get( 'activation_link_expiry_time' );389 $expiry_time = (int) amem()->options->get( 'activation_link_expiry_time' ); 390 390 if ( $expiry_time ) { 391 391 $expiry_time = $expiry_time * DAY_IN_SECONDS; … … 508 508 } 509 509 510 AMem()->register_module('user', User::getInstance());510 amem()->register_module('user', User::getInstance()); -
advanced-members/trunk/core/forms/actions.php
r3182890 r3186203 40 40 41 41 function __get($key) { 42 if ( $action = AMem()->get_action($key) )42 if ( $action = amem()->get_action($key) ) 43 43 return $action; 44 44 return null; … … 57 57 58 58 if ( in_array($form_type, ['registration', 'login', 'passwordreset']) && is_user_logged_in() ) { 59 return AMem()->errors->text('logged_in');59 return amem()->errors->text('logged_in'); 60 60 } elseif ( $form_type == 'account' && !is_user_logged_in() ) { 61 return AMem()->errors->text('logged_out');62 } elseif ( $form_type == 'account' && AMem()->account->get_current_tab() == 'delete' && is_super_admin() ) {61 return amem()->errors->text('logged_out'); 62 } elseif ( $form_type == 'account' && amem()->account->get_current_tab() == 'delete' && is_super_admin() ) { 63 63 // return __( 'Super administrators can not be deleted.', 'advanced-members' ); 64 64 } … … 74 74 75 75 function redirect_to_redirect_url($url) { 76 cym_debug( sanitize_text_field($_REQUEST['redirect_to']) ); 76 77 if ( !empty($_REQUEST['redirect_to']) ) { // phpcs:disable WordPress.Security.NonceVerification 77 78 return sanitize_text_field($_REQUEST['redirect_to']); // phpcs:disable WordPress.Security.NonceVerification … … 186 187 $after_submit = 'refresh'; 187 188 } 188 if ( $form_type == 'account' && wp_doing_ajax() && AMem()->account->current_tab != 'delete' ) {189 if ( $form_type == 'account' && wp_doing_ajax() && amem()->account->current_tab != 'delete' ) { 189 190 $after_submit = 'success_message'; 190 191 } … … 192 193 $redirect = $this->after_submit_url( $after_submit, $form ); 193 194 195 $redirect = apply_filters( 'amem/form/submit/redirect_url', $redirect, $form, $args ); 194 196 $redirect = apply_filters( "amem/form/submit/redirect/$form_type", $redirect, $form, $args ); 195 197 … … 220 222 case 'just_success_message': 221 223 if ( wp_doing_ajax() ) { 222 AMem()->submissions->set_redirect($after_submit);224 amem()->submissions->set_redirect($after_submit); 223 225 } 224 226 return $after_submit; … … 247 249 if ( in_array($redirect, ['success_message', 'just_success_message'], true) ) { 248 250 if ( wp_doing_ajax() ) { 249 AMem()->submissions->set_redirect($redirect);251 amem()->submissions->set_redirect($redirect); 250 252 } 251 253 return; … … 253 255 254 256 if ( wp_doing_ajax() ) { 255 AMem()->submissions->set_redirect($redirect);257 amem()->submissions->set_redirect($redirect); 256 258 } else { 257 259 wp_safe_redirect( $redirect ); … … 272 274 if ( $allkeys ) { 273 275 $tmp_key = array_shift($allkeys); 274 amem_add_error( $tmp_key, AMem()->errors->text('logged_in') );276 amem_add_error( $tmp_key, amem()->errors->text('logged_in') ); 275 277 } else { 276 amem_add_submission_error( AMem()->errors->text('logged_in') );278 amem_add_submission_error( amem()->errors->text('logged_in') ); 277 279 } 278 280 } … … 301 303 */ 302 304 function form_from_post( $form, $post ) { 303 $amem_fields = apply_filters( 'amem/form/from_post/amem', array_values( AMem()->fields->predefined_fields() ), $form, $post );305 $amem_fields = apply_filters( 'amem/form/from_post/amem', array_values( amem()->fields->predefined_fields() ), $form, $post ); 304 306 305 307 $form['amem'] = array_fill_keys( $amem_fields, false ); … … 338 340 } 339 341 340 AMem()->register_module('actions', Actions::getInstance());342 amem()->register_module('actions', Actions::getInstance()); -
advanced-members/trunk/core/forms/render.php
r3182890 r3186203 19 19 // add_shortcode( 'acf_members', array( $this, 'form_shortcode' ) ); 20 20 add_action( 'amem/form/render', array( $this, 'render' ), 10, 2 ); 21 22 add_filter( 'wp_kses_allowed_html', array( $this, 'allowed_html_tags' ), 10, 2 ); 21 23 } 22 24 … … 42 44 } 43 45 46 function allowed_html_tags( $tags, $context ) { 47 global $allowedposttags, $allowedamemtags; 48 if ( $context != 'amem' ) 49 return $tags; 50 51 if ( is_array( $allowedamemtags) ) 52 return $allowedamemtags; 53 54 $allowedamemtags = $allowedposttags; 55 $allowedamemtags['form'] = array( 56 'action' => true, 57 'accept' => true, 58 'accept-charset' => true, 59 'enctype' => true, 60 'method' => true, 61 'name' => true, 62 'target' => true, 63 ); 64 65 $atts = array( 66 'type' => true, 67 'class' => true, 68 'id' => true, 69 'data-*' => true, 70 'aria-*' => true, 71 'name' => true, 72 'value' => true, 73 'checked' => true, 74 'disabled' => true, 75 'value' => true, 76 'multiple' => true, 77 ); 78 79 $allowedamemtags['input'] = $atts; 80 $allowedamemtags['select'] = $atts; 81 $allowedamemtags['option'] = $atts; 82 83 return $allowedamemtags; 84 } 85 44 86 /** 45 87 * Renders the form specified by ID … … 55 97 56 98 // Set global AMem Form 57 AMem()->set_form($form, $args);58 AMem()->set_amem(true);99 amem()->set_form($form, $args); 100 amem()->set_amem(true); 59 101 60 102 // Enqueue scripts and styles … … 166 208 do_action( 'amem/form/after_render/type=' . $form['type'], $form, $args ); 167 209 168 AMem()->set_amem(false);// End of AMem Form210 amem()->set_amem(false);// End of AMem Form 169 211 } 170 212 … … 176 218 function render_submission_error( $form, $args ) { 177 219 if ( amem_submission_failed( $form['key'] ) ) { 178 // $errors = AMem()->submission['errors'];179 $errors = AMem()->errors->get_errors();220 // $errors = amem()->submission['errors']; 221 $errors = amem()->errors->get_errors(); 180 222 181 223 foreach ( $errors as $error ) { … … 312 354 313 355 // Get all fields for field group 314 if ( ! $fields = AMem()->local->get_group_fields($field_group) ) {356 if ( ! $fields = amem()->local->get_group_fields($field_group) ) { 315 357 $fields = acf_get_fields( $field_group ); 316 358 } … … 533 575 534 576 if ( !empty($submit_button) ) { 535 echo wp_kses _post($submit_button);577 echo wp_kses($submit_button, 'amem'); 536 578 return; 537 579 } … … 545 587 } 546 588 547 AMem()->register_module('render', Render::getInstance());589 amem()->register_module('render', Render::getInstance()); -
advanced-members/trunk/core/forms/submissions.php
r3182890 r3186203 49 49 'valid' => 0, 50 50 'errors' => array( 51 array( 'input' => 'acf[field_amem_errors]', 'message' => AMem()->errors->text('nonce_failed') ),51 array( 'input' => 'acf[field_amem_errors]', 'message' => amem()->errors->text('nonce_failed') ), 52 52 ), 53 53 ) ); … … 67 67 'valid' => 0, 68 68 'errors' => array( 69 array( 'input' => 'acf[field_amem_errors]', 'message' => AMem()->errors->text('nonce_failed') ),69 array( 'input' => 'acf[field_amem_errors]', 'message' => amem()->errors->text('nonce_failed') ), 70 70 ), 71 71 ) ); 72 72 } 73 73 74 $form = AMem()->submission['form'];75 $args = AMem()->submission['args'];76 $fields = AMem()->submission['fields'];74 $form = amem()->submission['form']; 75 $args = amem()->submission['args']; 76 $fields = amem()->submission['fields']; 77 77 78 78 // Process submission. If it fails we return all errors. 79 if ( ! $this->process_submission( AMem()->submission ) ) {79 if ( ! $this->process_submission( amem()->submission ) ) { 80 80 $errors = array(); 81 foreach ( AMem()->submission['errors'] as $message ) {81 foreach ( amem()->submission['errors'] as $message ) { 82 82 $errors[] = array( 83 83 'input' => 'field_amem_errors', … … 168 168 } 169 169 170 $this->process_submission( AMem()->submission );171 172 // static::after_submission( AMem()->submission );170 $this->process_submission( amem()->submission ); 171 172 // static::after_submission( amem()->submission ); 173 173 } 174 174 … … 246 246 } 247 247 248 $form = AMem()->submission['form'];249 $fields = AMem()->submission['fields'];250 $args = AMem()->submission['args'];248 $form = amem()->submission['form']; 249 $fields = amem()->submission['fields']; 250 $args = amem()->submission['args']; 251 251 252 252 if ( !$this->honeypot_check() ) { 253 amem_add_error( 'field_amem_errors', AMem()->errors->text('invalid_honeypot') );253 amem_add_error( 'field_amem_errors', amem()->errors->text('invalid_honeypot') ); 254 254 return; 255 255 } … … 260 260 261 261 /** 262 * Populate AMem()->submission with submission data262 * Populate amem()->submission with submission data 263 263 * Returns boolean indicating whether a submission was loaded 264 264 * … … 269 269 // Check if there is a cookie-passed submission 270 270 if ( $submission = $this->get_submission() ) { 271 AMem()->submission = $submission;271 amem()->submission = $submission; 272 272 273 273 // Return false to stop the submission from being processed again … … 281 281 282 282 // Bail early if already loaded 283 if ( AMem()->submission ) {283 if ( amem()->submission ) { 284 284 return true; 285 285 } … … 304 304 305 305 // Save submission data to the global AMem object 306 AMem()->submission = $submission;307 AMem()->set_form($submission['form'], $submission['args']);306 amem()->submission = $submission; 307 amem()->set_form($submission['form'], $submission['args']); 308 308 309 309 return true; … … 340 340 if ( ! wp_verify_nonce( $nonce, $nonce_value ) ) { 341 341 if ( doing_action( 'acf/validate_save_post') ) { 342 amem_add_error( 'field_amem_errors', AMem()->errors->text('nonce_failed') );342 amem_add_error( 'field_amem_errors', amem()->errors->text('nonce_failed') ); 343 343 return false; 344 344 } else { 345 amem_add_submission_error( AMem()->errors->text('nonce_failed') );345 amem_add_submission_error( amem()->errors->text('nonce_failed') ); 346 346 // wp_die( 'Your submission failed. Please reload the page and try again.' ); 347 347 return false; … … 527 527 } 528 528 529 AMem()->register_module('submissions', Submissions::getInstance());529 amem()->register_module('submissions', Submissions::getInstance()); -
advanced-members/trunk/core/functions-forms.php
r3182890 r3186203 29 29 // Get fields from the global submission object if fields weren't passed 30 30 if ( ! $fields && amem_has_submission() ) { 31 $fields = AMem()->submission['fields'];31 $fields = amem()->submission['fields']; 32 32 } 33 33 … … 100 100 } 101 101 102 $fields = AMem()->submission['fields'];102 $fields = amem()->submission['fields']; 103 103 104 104 // $excluded_fields = array_map( function($field) { return is_array($field) ? $field['name'] : $field; }, (array)$excluded_fields ); … … 135 135 // Get fields from the global submission object if fields weren't passed 136 136 if ( ! $fields && amem_has_submission() ) { 137 $fields = AMem()->submission['fields'];137 $fields = amem()->submission['fields']; 138 138 } 139 139 … … 222 222 223 223 if ( $form ) { 224 AMem()->local->add_form($form);224 amem()->local->add_form($form); 225 225 } 226 226 … … 263 263 'type' => false, 264 264 'data' => array( 265 'ajax' => AMem()->options->get('ajax_submit'),265 'ajax' => amem()->options->get('ajax_submit'), 266 266 'user' => 0, 267 267 'description' => '', … … 338 338 339 339 $form_type = amem_form_type( $form_post->ID ); 340 $form_ajax = AMem()->options->get('ajax_submit');340 $form_ajax = amem()->options->get('ajax_submit'); 341 341 342 342 if ( get_post_meta( $form_post->ID, 'amem_form_ajax_override', true ) ) { … … 401 401 */ 402 402 function amem_form_from_key( $key ) { 403 if ( $form = AMem()->local->get_form($key) ) {403 if ( $form = amem()->local->get_form($key) ) { 404 404 return $form; 405 405 } … … 514 514 515 515 // Get all locally registered forms 516 if ( $local_forms = AMem()->local->get_forms() ) {516 if ( $local_forms = amem()->local->get_forms() ) { 517 517 foreach ( $local_forms as $form ) { 518 518 $forms[] = $form; … … 534 534 } 535 535 536 if ( $groups = AMem()->local->get_form_groups($form_key) ) {536 if ( $groups = amem()->local->get_form_groups($form_key) ) { 537 537 return $groups; 538 538 } … … 551 551 $form_key = $form_key['key']; 552 552 } 553 return AMem()->local->get_form_groups($form_key);553 return amem()->local->get_form_groups($form_key); 554 554 } 555 555 … … 567 567 } 568 568 569 if ( $form_fields = AMem()->local->get_form_fields($form_key) ) {569 if ( $form_fields = amem()->local->get_form_fields($form_key) ) { 570 570 $formFields[$cacheKey] = $form_fields; 571 571 return $form_fields; … … 585 585 if ( $field_groups ) { 586 586 foreach ( $field_groups as $field_group ) { 587 if ( ! $fields = AMem()->local->get_group_fields($field_group) )587 if ( ! $fields = amem()->local->get_group_fields($field_group) ) 588 588 $fields = acf_get_fields( $field_group ); 589 589 if ( ! empty ( $fields ) ) { … … 630 630 return; 631 631 632 $message = AMem()->errors->text($updated_code);632 $message = amem()->errors->text($updated_code); 633 633 $message = apply_filters( 'amem/form/updated_message', $message, $updated_code, $form, $args ); 634 634 $message = apply_filters( 'amem/form/updated_message/type=' . $form['type'], $message, $updated_code, $form, $args ); … … 652 652 return; 653 653 654 $message = AMem()->errors->text($error_code);654 $message = amem()->errors->text($error_code); 655 655 $message = apply_filters( 'amem/form/error_message', $message, $error_code, $form, $args ); 656 656 $message = apply_filters( 'amem/form/error_message/type=' . $form['type'], $message, $error_code, $form, $args ); … … 674 674 // Enqueue the hotfix that prevents validation from firing across all forms on the same page when one is submitted. 675 675 if ( apply_filters( 'amem/settings/enqueue_validation_hotfix', false ) ) { 676 wp_enqueue_script( 'amem-multi-form-validation-hotfix', amem_get_url("assets/build/js/multi-form-validation-hotfix.js"), [ 'acf-input' ], AM em_VERSION, true );676 wp_enqueue_script( 'amem-multi-form-validation-hotfix', amem_get_url("assets/build/js/multi-form-validation-hotfix.js"), [ 'acf-input' ], AMEM_VERSION, true ); 677 677 } 678 678 … … 682 682 $min = ''; 683 683 684 wp_register_script( 'amem-password-strength', amem_get_url("assets/build/js/password-strength{$min}.js"), array( 'password-strength-meter' ), AM em_VERSION, true );684 wp_register_script( 'amem-password-strength', amem_get_url("assets/build/js/password-strength{$min}.js"), array( 'password-strength-meter' ), AMEM_VERSION, true ); 685 685 acf_localize_text( array( 'Passwords Match' => __( 'Passwords Match', 'advanced-members' ) ) ); 686 686 … … 689 689 wp_localize_script( 'acf-input', 'acfL10n', $acf_l10n ); 690 690 691 AMem()->fields->enqueue_scripts();692 693 wp_enqueue_script( 'amem-forms-script', amem_get_url("assets/build/js/forms.js"), ['jquery', 'acf-input', 'amem-input'], AM em_VERSION, true );694 695 wp_enqueue_style( 'amem-form-style', amem_get_url("assets/build/css/form.css"), false, AM em_VERSION );696 697 if ( AMem()->options->get('load_theme', true) ) {698 wp_enqueue_style( 'amem-theme-default', amem_get_url("assets/build/css/themes/default.css"), false, AM em_VERSION );691 amem()->fields->enqueue_scripts(); 692 693 wp_enqueue_script( 'amem-forms-script', amem_get_url("assets/build/js/forms.js"), ['jquery', 'acf-input', 'amem-input'], AMEM_VERSION, true ); 694 695 wp_enqueue_style( 'amem-form-style', amem_get_url("assets/build/css/form.css"), false, AMEM_VERSION ); 696 697 if ( amem()->options->get('load_theme', true) ) { 698 wp_enqueue_style( 'amem-theme-default', amem_get_url("assets/build/css/themes/default.css"), false, AMEM_VERSION ); 699 699 } 700 700 -
advanced-members/trunk/core/functions-helpers.php
r3182890 r3186203 37 37 */ 38 38 function amem_get_path( $filename = '', $base = null ) { 39 return ( !$base ? AM em_PATH : $base ) . ltrim( $filename, '/' );39 return ( !$base ? AMEM_PATH : $base ) . ltrim( $filename, '/' ); 40 40 } 41 41 … … 52 52 */ 53 53 function amem_get_url( $filename = '', $base = null ) { 54 return ( !$base ? AM em_URL : $base ) . ltrim( $filename, '/' );54 return ( !$base ? AMEM_URL : $base ) . ltrim( $filename, '/' ); 55 55 } 56 56 … … 99 99 function amem_get_core_page( $slug, $updated = false, $redirect_to = '' ) { 100 100 $url = ''; 101 if ( isset( AMem()->options->permalinks[ $slug ] ) ) {102 $url = get_permalink( AMem()->options->permalinks[ $slug ] );101 if ( isset( amem()->options->permalinks[ $slug ] ) ) { 102 $url = get_permalink( amem()->options->permalinks[ $slug ] ); 103 103 if ( $updated ) { 104 104 $url = add_query_arg( 'updated', esc_attr( $updated ), $url ); … … 130 130 } 131 131 132 if ( isset( $post->ID ) && isset( AMem()->options->permalinks[ $page ] ) && $post->ID == AMem()->options->permalinks[ $page ] ) {132 if ( isset( $post->ID ) && isset( amem()->options->permalinks[ $page ] ) && $post->ID == amem()->options->permalinks[ $page ] ) { 133 133 return true; 134 134 } … … 257 257 switch ($key) { 258 258 case 'ID': 259 return AMem()->user->id;259 return amem()->user->id; 260 260 break; 261 261 262 262 default: 263 $value = maybe_unserialize( AMem()->user->get($key) );263 $value = maybe_unserialize( amem()->user->get($key) ); 264 264 if ( is_array( $value ) ) { 265 265 $value = implode( ",", $value ); … … 310 310 // Get fields from the global submission object if fields weren't passed 311 311 if ( ! $fields && amem_has_submission() ) { 312 $fields = AMem()->submission['fields'];312 $fields = amem()->submission['fields']; 313 313 } 314 314 … … 875 875 876 876 function amem_is_pro() { 877 return defined( 'AM em_PRO' ) && AMem_PRO;878 } 877 return defined( 'AMEM_PRO' ) && AMEM_PRO; 878 } -
advanced-members/trunk/core/functions-submissions.php
r3182890 r3186203 75 75 */ 76 76 function amem_has_submission( $hash = false ) { 77 $submission = AMem()->submission;77 $submission = amem()->submission; 78 78 79 79 if ( empty( $submission ) ) { … … 95 95 */ 96 96 function amem_submission_failed( $key = false ) { 97 $submission = AMem()->submission;97 $submission = amem()->submission; 98 98 99 99 if ( empty( $submission ) ) { … … 109 109 } 110 110 111 if ( AMem()->errors->has_errors() )111 if ( amem()->errors->has_errors() ) 112 112 return true; 113 113 … … 122 122 */ 123 123 function amem_add_submission_error( $message, $input=null ) { 124 return AMem()->errors->add($input, $message);124 return amem()->errors->add($input, $message); 125 125 } 126 126 -
advanced-members/trunk/core/modules/class-adminbar.php
r3182890 r3186203 21 21 22 22 function __construct() { 23 if ( AMem()->options->getmodule('_use_adminbar') ) {23 if ( amem()->options->getmodule('_use_adminbar') ) { 24 24 add_filter( 'show_admin_bar', [$this, 'show_admin_bar'], 88 ); 25 25 } … … 31 31 32 32 // global disable adminbar option 33 // $bool = ! AMem()->options->get('adminbar/global');33 // $bool = ! amem()->options->get('adminbar/global'); 34 34 35 // if ( AMem()->options->get('adminbar/by_roles') ) {36 foreach ( AMem()->user->get('roles') as $role ) {37 $role_op = AMem()->options->get('adminbar/roles/'.$role, null );35 // if ( amem()->options->get('adminbar/by_roles') ) { 36 foreach ( amem()->user->get('roles') as $role ) { 37 $role_op = amem()->options->get('adminbar/roles/'.$role, null ); 38 38 if ( $role_op ) { 39 39 $bool = false; … … 48 48 } 49 49 50 AMem()->register_module('adminbar', AdminBar::getInstance());50 amem()->register_module('adminbar', AdminBar::getInstance()); -
advanced-members/trunk/core/modules/class-redirects.php
r3182890 r3186203 21 21 22 22 function __construct() { 23 if ( AMem()->options->getmodule('_use_redirects') ) {23 if ( amem()->options->getmodule('_use_redirects') ) { 24 24 // apply after core form filters 25 25 add_filter( 'amem/form/from_post', [$this, 'form_redirects'], 33 ); … … 37 37 38 38 function logout_redirects($url) { 39 if ( $opt_url = AMem()->options->get("redirect/_after_logout", $url) ) {39 if ( $opt_url = amem()->options->get("redirect/_after_logout", $url) ) { 40 40 $url = $opt_url; 41 $url = AMem()->actions->after_submit_url( $url, ['redirect_url' => AMem()->options->get("redirect/logout_redirect_url")] );41 $url = amem()->actions->after_submit_url( $url, ['redirect_url' => amem()->options->get("redirect/logout_redirect_url")] ); 42 42 } 43 if ( AMem()->options->get('roles/apply_roles_redirection') ) {43 if ( amem()->options->get('roles/apply_roles_redirection') ) { 44 44 $roles = amem_user('roles'); 45 45 if ( $rule = $this->rule_for_roles($roles, 'logout') ) { 46 $url = AMem()->actions->after_submit_url($rule['after_submit'], $rule);46 $url = amem()->actions->after_submit_url($rule['after_submit'], $rule); 47 47 } 48 48 } … … 57 57 // $redirect_url = get_post_meta($form_post->ID, "amem_form_{$form_type}_redirect_url", true); 58 58 // } else { 59 // $after_submit = AMem()->options->get("redirect/_after_{$form_type}");60 // $redirect_url = AMem()->options->get("redirect/{$form_type}_redirect_url");59 // $after_submit = amem()->options->get("redirect/_after_{$form_type}"); 60 // $redirect_url = amem()->options->get("redirect/{$form_type}_redirect_url"); 61 61 // } 62 62 63 63 $form_type = $this->tab_to_form_type($form['type'], $form); 64 64 65 $after_submit = AMem()->options->get("redirect/_after_{$form_type}", $form['data']['after_submit']);66 $redirect_url = AMem()->options->get("redirect/{$form_type}_redirect_url", $form['data']['redirect_url']);65 $after_submit = amem()->options->get("redirect/_after_{$form_type}", $form['data']['after_submit']); 66 $redirect_url = amem()->options->get("redirect/{$form_type}_redirect_url", $form['data']['redirect_url']); 67 67 68 if ( AMem()->options->get('roles/apply_roles_redirection') ) {68 if ( amem()->options->get('roles/apply_roles_redirection') ) { 69 69 if ( $rule = $this->get_rule_for_role($form_type) ) { 70 70 $after_submit = $rule['after_submit']; … … 91 91 break; 92 92 default: 93 $roles = AMem()->user->get('roles');93 $roles = amem()->user->get('roles'); 94 94 break; 95 95 } … … 113 113 114 114 foreach( (array)$roles as $role ) { 115 $after_submit = AMem()->options->get('redirect/roles/'.$role.'/_after_' . $form_type);115 $after_submit = amem()->options->get('redirect/roles/'.$role.'/_after_' . $form_type); 116 116 if ( !$after_submit ) 117 117 continue; 118 $redirect_url = AMem()->options->get('redirect/roles/' .$role .'/'. $form_type . '_redirect_url');118 $redirect_url = amem()->options->get('redirect/roles/' .$role .'/'. $form_type . '_redirect_url'); 119 119 break; 120 120 } … … 125 125 } 126 126 127 AMem()->register_module('redirects', Redirects::getInstance());127 amem()->register_module('redirects', Redirects::getInstance()); -
advanced-members/trunk/core/modules/menu/class-items.php
r3182890 r3186203 159 159 } 160 160 161 AMem()->register_addon( 'menu/items', Items::getInstance() );161 amem()->register_addon( 'menu/items', Items::getInstance() ); 162 162 163 163 if ( is_admin() ) { -
advanced-members/trunk/core/rest/class-rest-controller.php
r3182890 r3186203 94 94 } 95 95 96 $items = AMem()->rest->get_forms($args);96 $items = amem()->rest->get_forms($args); 97 97 98 98 return rest_ensure_response( $items ); … … 101 101 public function get_form( \WP_REST_Request $request ) { 102 102 $id = $request->get_param( 'id' ); 103 $item = AMem()->rest->get_form( $id );103 $item = amem()->rest->get_form( $id ); 104 104 105 105 if ( ! $item ) { -
advanced-members/trunk/languages/advanced-members.pot
r3182890 r3186203 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024-11- 06T14:49:48+09:00\n"12 "POT-Creation-Date: 2024-11-11T16:50:13+09:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.7.1\n" … … 100 100 msgstr "" 101 101 102 #: acf/fields/class-user-email.php:79 103 msgid "The email is not existing in this site. Please try a different email" 104 msgstr "" 105 102 106 #. translators: email value string 103 #: acf/fields/class-user-email.php: 82107 #: acf/fields/class-user-email.php:90 104 108 msgid "The email %s is already assigned to an existing account. Please try a different email or login to your account" 105 109 msgstr "" 106 110 107 111 #. translators: email value string 108 #: acf/fields/class-user-email.php:9 1112 #: acf/fields/class-user-email.php:99 109 113 msgid "The username %s is taken. Please try a different username" 110 114 msgstr "" 111 115 112 #: acf/fields/class-user-email.php:14 0116 #: acf/fields/class-user-email.php:148 113 117 msgid "Set as Username" 114 118 msgstr "" 115 119 116 #: acf/fields/class-user-email.php:14 1120 #: acf/fields/class-user-email.php:149 117 121 msgid "Save value as username as well. (Only works with registration forms)" 118 122 msgstr "" … … 1451 1455 msgstr "" 1452 1456 1453 #: core/forms/render.php: 751457 #: core/forms/render.php:117 1454 1458 msgid "Submit" 1455 1459 msgstr "" -
advanced-members/trunk/readme.txt
r3182890 r3186203 1 1 === Advanced Members for ACF === 2 2 Tags: acf, advanced custom fields, members, registration, account 3 Stable tag: 0.9. 33 Stable tag: 0.9.4 4 4 Requires at least: 5.8 5 5 Tested up to: 6.6.1 … … 71 71 == Changelog == 72 72 73 = 0.9. 0=73 = 0.9.3 = 74 74 - Intitial Release 75 76 = 0.9.4 = 77 - Fix: not follow redirect_to query string 78 - Fix: login button kses stripped 79 - Fix: uppercase constant names, lowercase function names 80 - New: Support email field on login form 75 81 76 82 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.