WP-Members Membership Plugin - Version 3.1.6

Version Description

  • Fixed [wpmem_field] display handling for multiple select and multiple checkbox field types.
  • Updates to always load fields from wpmem_fields() API function.
  • Updates to begin to utilize new fields settings array. Fields setting is still store in the same array format as before. However, it is loaded into the new settings format. Current object class keeps numeric keys in place for legacy purposes.
  • Updates to dropdown handling on main options tab to display proper preselected value when site is using ssl (https://) and no value is selected.
  • Added wpmem_loginout() API function, changed [wpmem_loginout] shortcode to use API function.
  • Added wpmem_array_insert() API function, allows for inserting array elements at any point in an array.
  • Added wp_destroy_current_session() to logout function.
  • Added WooCommerce support in native WP registration functions. Began adding WooCommerce classes to registration form elements.
  • Added to wpmem_user_has_role() function to check for a single role or if the user has a role that is in an array of roles.
  • Added wpmem_shortcodes_loaded, wpmem_hooks_loaded, and wpmem_dropins_loaded to fire after.
  • Added text input to set a default 'read more' link for auto excerpt.
  • Fixed issue with auto excerpt where an excerpt shorter than the excerpt setting would not display the more link.
  • Preliminary updates to include placeholder support in fields (this will be an option in a future release).
  • Localization fix of untranslated strings.
  • Wrap "Remember Me" checkbox label with label tag in login form.
  • Moved remaining initialization functions to class constructor.
  • Moved wpmem_load_shortcodes, wpmem_load_hooks, and wpmem_load_dropins to fire before.
  • reCAPTCHA version 1 is no longer supported by Google. It is now deprecated in the plugin. If you have reCAPTCHA v1 selected, it will remain so. But once this is changed to a different CAPTCHA setting or if this is a new install, reCAPTCHA version 1 will no longer be available as a selection.
  • Custom field term "Option Name" changed to "Meta Key" for clarity.
  • Marked required custom field properties as required in Add/Edit Field dialogs.
  • Changed redirect_to process to escape the url with esc_url_raw rather than esc_url, otherwise query string variables do not get handled correctly.
Download this release

Release Info

Developer cbutlerjr
Plugin Icon 128x128 WP-Members Membership Plugin
Version 3.1.6
Comparing to
See all releases

Code changes from version 3.1.5 to 3.1.6

admin/css/admin.css CHANGED
@@ -46,4 +46,8 @@
46
  #fields_postbox,
47
  #add_field_postbox {
48
  min-width:950px;
 
 
 
 
49
  }
46
  #fields_postbox,
47
  #add_field_postbox {
48
  min-width:950px;
49
+ }
50
+
51
+ .req {
52
+ color: #f00;
53
  }
admin/includes/class-wp-members-admin-api.php CHANGED
@@ -207,14 +207,14 @@ class WP_Members_Admin_API {
207
 
208
  $defaults = array(
209
  'name' => $args['name'],
210
- 'heading' => 'Custom email',
211
- 'subject_label' => 'Subject',
212
  'subject_input' => $args['name'] . '_subject',
213
- 'subject_value' => ( $settings ) ? $settings['subj'] : 'Subject',
214
- 'body_label' => 'Body',
215
  'body_input' => $args['name'] . '_body',
216
- 'body_value' => ( $settings ) ? $settings['body'] : 'Your custom email message content.',
217
- );
218
 
219
  // Merge args with settings.
220
  $args = wp_parse_args( $args, $defaults );
@@ -418,10 +418,10 @@ class WP_Members_Admin_API {
418
  $this->current_form = $current_form;
419
  global $wpmem;
420
  // Add numeric array form fields as associative
421
- foreach( $wpmem->fields as $field ) {
422
- $wpmem->fields[ $field[2] ] = $field;
423
- }
424
- $this->current_form_fields = $wpmem->fields;
425
  }
426
 
427
  } // End of WP_Members_Admin_API class.
207
 
208
  $defaults = array(
209
  'name' => $args['name'],
210
+ 'heading' => __( 'Custom email', 'wp-members' ),
211
+ 'subject_label' => __( 'Subject', 'wp-members' ),
212
  'subject_input' => $args['name'] . '_subject',
213
+ 'subject_value' => ( $settings ) ? $settings['subj'] : __( 'Subject', 'wp-members' ),
214
+ 'body_label' => __( 'Body', 'wp-members' ),
215
  'body_input' => $args['name'] . '_body',
216
+ 'body_value' => ( $settings ) ? $settings['body'] : __( 'Your custom email message content.', 'wp-members' ),
217
+ );
218
 
219
  // Merge args with settings.
220
  $args = wp_parse_args( $args, $defaults );
418
  $this->current_form = $current_form;
419
  global $wpmem;
420
  // Add numeric array form fields as associative
421
+ //foreach( $wpmem->fields as $field ) {
422
+ // $wpmem->fields[ $field[2] ] = $field;
423
+ //}
424
+ $this->current_form_fields = wpmem_fields();
425
  }
426
 
427
  } // End of WP_Members_Admin_API class.
admin/js/admin.js CHANGED
@@ -32,7 +32,7 @@
32
  $(document).ready(function() {
33
 
34
  $("#wpmem-fields").tableDnD({
35
- onDragClass: "wpmem_tbl_drag",
36
 
37
  onDrop: function(table, row) {
38
  var data = {
@@ -41,9 +41,9 @@
41
  }
42
 
43
  $.post( ajaxurl, data, function(response) {
44
- // alert(response);
45
- })
46
- }
47
  });
48
  });
49
  })(jQuery);
32
  $(document).ready(function() {
33
 
34
  $("#wpmem-fields").tableDnD({
35
+ onDragClass: "wpmem_tbl_drag",
36
 
37
  onDrop: function(table, row) {
38
  var data = {
41
  }
42
 
43
  $.post( ajaxurl, data, function(response) {
44
+ // alert(response);
45
+ })
46
+ }
47
  });
48
  });
49
  })(jQuery);
admin/tab-fields.php CHANGED
@@ -25,9 +25,9 @@
25
  */
26
  function wpmem_a_build_fields() {
27
 
28
- global $add_field_err_msg;
29
  $add_toggle = ( isset( $_GET['edit'] ) ) ? $_GET['edit'] : false;
30
- $wpmem_fields = get_option( 'wpmembers_fields' );
31
  ?>
32
  <div class="metabox-holder">
33
 
@@ -36,7 +36,9 @@ function wpmem_a_build_fields() {
36
  <?php if ( $add_toggle && ( isset( $_POST['wpmem_admin_a'] ) != 'edit_field' ) ) {
37
  wpmem_a_field_edit( 'edit', $wpmem_fields, $add_toggle );
38
  } else {
39
- if ( ! $add_field_err_msg ) { wpmem_a_field_table( $wpmem_fields ); }
 
 
40
  wpmem_a_field_edit( 'add' );
41
  } ?>
42
 
@@ -66,18 +68,18 @@ function wpmem_a_field_reorder() {
66
 
67
  $new_order = $_REQUEST['orderstring'];
68
  $new_order = explode( "&", $new_order );
69
-
70
  // Loop through $new_order to create new field array.
71
  $wpmem_old_fields = get_option( 'wpmembers_fields' );
72
  for ( $row = 0; $row < count( $new_order ); $row++ ) {
73
  if ( $row > 0 ) {
74
  $key = $new_order[ $row ];
75
  $key = substr( $key, 15 );
76
-
77
- for ( $x = 0; $x < count( $wpmem_old_fields ); $x++ ) {
78
-
79
- if ( $wpmem_old_fields[ $x ][0] == $key ) {
80
- $wpmem_new_fields[ $row - 1 ] = $wpmem_old_fields[ $x ];
81
  }
82
  }
83
  }
@@ -120,38 +122,38 @@ function wpmem_update_fields( $action ) {
120
 
121
  // Rebuild the array, don't touch user_email - it's always mandatory.
122
  $nrow = 0;
123
- for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
 
 
124
 
125
  // Check to see if the field is checked for deletion, and if not, add it to the new array.
126
- $delete_field = "del_" . $wpmem_fields[$row][2];
127
- $delete_field = ( isset( $_POST[$delete_field] ) ) ? $_POST[$delete_field] : false;
128
  if ( $delete_field != "delete" ) {
129
 
130
  for ( $i = 0; $i < 4; $i++ ) {
131
- $wpmem_newfields[$nrow][$i] = $wpmem_fields[$row][$i];
132
  }
133
 
134
  $wpmem_newfields[ $nrow ][0] = $nrow + 1;
135
 
136
- $display_field = $wpmem_fields[$row][2] . "_display";
137
- $require_field = $wpmem_fields[$row][2] . "_required";
138
- $checked_field = $wpmem_fields[$row][2] . "_checked";
139
 
140
- if ( $wpmem_fields[$row][2] != 'user_email' ){
141
- $wpmem_newfields[$nrow][4] = ( isset( $_POST[$display_field] ) ) ? $_POST[$display_field] : '';
142
- $wpmem_newfields[$nrow][5] = ( isset( $_POST[$require_field] ) ) ? $_POST[$require_field] : '';
143
  } else {
144
  $wpmem_newfields[ $nrow ][4] = 'y';
145
  $wpmem_newfields[ $nrow ][5] = 'y';
146
  }
147
-
148
- $chkreq = ( $wpmem_newfields[$nrow][4] != 'y' && $wpmem_newfields[$nrow][5] == 'y' ) ? 'err' : false;
149
 
150
- $wpmem_newfields[$nrow][6] = $wpmem_fields[$row][6];
151
- $wpmem_newfields[$nrow][7] = ( isset( $wpmem_fields[$row][7] ) ) ? $wpmem_fields[$row][7] : '';
152
- if ( $wpmem_fields[$row][3] == 'checkbox' ) {
153
- if ( isset( $_POST[$checked_field] ) && $_POST[$checked_field] == 'y' ) {
154
- $wpmem_newfields[$nrow][8] = 'y';
155
  } else {
156
  $wpmem_newfields[ $nrow ][8] = 'n';
157
  }
@@ -161,7 +163,7 @@ function wpmem_update_fields( $action ) {
161
  }
162
 
163
  }
164
-
165
  update_option( 'wpmembers_fields', $wpmem_newfields );
166
  $did_update = __( 'WP-Members fields were updated', 'wp-members' );
167
 
@@ -189,35 +191,36 @@ function wpmem_update_fields( $action ) {
189
 
190
  // Error check for reserved terms.
191
  $reserved_terms = wpmem_wp_reserved_terms();
192
- $submitted_term = $_POST['add_option'];
193
- if ( in_array( strtolower( $submitted_term ), $reserved_terms ) ) {
194
  $add_field_err_msg = sprintf( __( 'Sorry, "%s" is a <a href="https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms" target="_blank">reserved term</a>. Field was not added.', 'wp-members' ), $submitted_term );
195
  }
196
 
197
  // Error check option name for spaces and replace with underscores.
198
- $us_option = $_POST['add_option'];
199
- $us_option = preg_replace( "/ /", '_', $us_option );
200
 
201
  $arr = array();
 
 
202
 
203
  $arr[0] = ( $action == 'add_field' ) ? ( count( $wpmem_fields ) ) + 2 : false;
204
  $arr[1] = stripslashes( $_POST['add_name'] );
205
  $arr[2] = $us_option;
206
- $arr[3] = $_POST['add_type'];
207
  $arr[4] = ( isset( $_POST['add_display'] ) ) ? $_POST['add_display'] : 'n';
208
  $arr[5] = ( isset( $_POST['add_required'] ) ) ? $_POST['add_required'] : 'n';
209
  $arr[6] = ( $us_option == 'user_nicename' || $us_option == 'display_name' || $us_option == 'nickname' ) ? 'y' : 'n';
210
 
211
- if ( $_POST['add_type'] == 'checkbox' ) {
212
  $add_field_err_msg = ( ! $_POST['add_checked_value'] ) ? __( 'Checked value is required for checkboxes. Nothing was updated.', 'wp-members' ) : $add_field_err_msg;
213
  $arr[7] = ( isset( $_POST['add_checked_value'] ) ) ? $_POST['add_checked_value'] : false;
214
  $arr[8] = ( isset( $_POST['add_checked_default'] ) ) ? $_POST['add_checked_default'] : 'n';
215
  }
216
 
217
- if ( $_POST['add_type'] == 'select'
218
- || $_POST['add_type'] == 'multiselect'
219
- || $_POST['add_type'] == 'radio'
220
- || $_POST['add_type'] == 'multicheckbox'
221
  ) {
222
  // Get the values.
223
  $str = stripslashes( $_POST['add_dropdown_value'] );
@@ -230,12 +233,12 @@ function wpmem_update_fields( $action ) {
230
  $arr[7] = str_getcsv( $str, ',', '"' );
231
  }
232
  // If multiselect or multicheckbox, set delimiter.
233
- if ( 'multiselect' == $_POST['add_type'] || 'multicheckbox' == $_POST['add_type'] ) {
234
  $arr[8] = ( isset( $_POST['add_delimiter_value'] ) ) ? $_POST['add_delimiter_value'] : '|';
235
  }
236
  }
237
 
238
- if ( $_POST['add_type'] == 'file' || $_POST['add_type'] == 'image' ) {
239
  $arr[7] = stripslashes( $_POST['add_file_value'] );
240
  }
241
 
@@ -273,6 +276,9 @@ function wpmem_update_fields( $action ) {
273
 
274
  if ( WPMEM_DEBUG == true && isset( $arr ) ) { echo "<pre>"; print_r($arr); echo "</pre>"; }
275
 
 
 
 
276
  return $did_update;
277
  }
278
 
@@ -298,14 +304,13 @@ function wpmem_fields_edit_link( $field_id ) {
298
  * @param array|null $wpmem_fields the array of fields
299
  * @param string|null $field the field being edited
300
  */
301
- function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
 
 
302
 
303
  if ( $mode == 'edit' ) {
304
- for ( $row = 0; $row < count( $wpmem_fields ); $row++ ) {
305
- if ( $wpmem_fields[$row][2] == $field ) {
306
- $field_arr = $wpmem_fields[$row];
307
- }
308
- }
309
  }
310
 
311
  $form_action = ( $mode == 'edit' ) ? 'editfieldform' : 'addfieldform';
@@ -318,15 +323,15 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
318
  <?php wp_nonce_field( 'wpmem-add-fields' ); ?>
319
  <ul>
320
  <li>
321
- <label><?php _e( 'Field Label', 'wp-members' ); ?></label>
322
- <input type="text" name="add_name" value="<?php echo ( $mode == 'edit' ) ? $field_arr[1] : false; ?>" />
323
  <?php _e( 'The name of the field as it will be displayed to the user.', 'wp-members' ); ?>
324
  </li>
325
  <li>
326
- <label><?php _e( 'Option Name', 'wp-members' ); ?></label>
327
  <?php if ( $mode == 'edit' ) {
328
- echo $field_arr[2]; ?>
329
- <input type="hidden" name="add_option" value="<?php echo $field_arr[2]; ?>" />
330
  <?php } else { ?>
331
  <input type="text" name="add_option" value="" />
332
  <?php _e( 'The database meta value for the field. It must be unique and contain no spaces (underscores are ok).', 'wp-members' ); ?>
@@ -335,8 +340,8 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
335
  <li>
336
  <label><?php _e( 'Field Type', 'wp-members' ); ?></label>
337
  <?php if ( $mode == 'edit' ) {
338
- echo $field_arr[3]; ?>
339
- <input type="hidden" name="add_type" value="<?php echo $field_arr[3]; ?>" />
340
  <?php } else { ?>
341
  <select name="add_type" id="wpmem_field_type_select">
342
  <option value="text"><?php _e( 'text', 'wp-members' ); ?></option>
@@ -357,20 +362,20 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
357
  </li>
358
  <li>
359
  <label><?php _e( 'Display?', 'wp-members' ); ?></label>
360
- <input type="checkbox" name="add_display" value="y" <?php echo ( $mode == 'edit' ) ? checked( 'y', $field_arr[4] ) : false; ?> />
361
  </li>
362
  <li>
363
  <label><?php _e( 'Required?', 'wp-members' ); ?></label>
364
- <input type="checkbox" name="add_required" value="y" <?php echo ( $mode == 'edit' ) ? checked( 'y', $field_arr[5] ) : false; ?> />
365
  </li>
366
- <?php if ( $mode == 'add' || ( $mode == 'edit' && ( $field_arr[3] == 'file' || $field_arr[3] == 'image' ) ) ) { ?>
367
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_file_info">' : ''; ?>
368
  <li>
369
  <strong><?php _e( 'Additional information for field upload fields', 'wp-members' ); ?></strong>
370
  </li>
371
  <li>
372
  <label><?php _e( 'Accepted file types:', 'wp-members' ); ?></label>
373
- <input type="text" name="add_file_value" value="<?php echo ( $mode == 'edit' && $field_arr[3] == 'file' ) ? $field_arr[7] : false; ?>" />
374
  </li>
375
  <li>
376
  <label>&nbsp;</label>
@@ -378,29 +383,29 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
378
  </li>
379
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
380
  <?php } ?>
381
- <?php if ( $mode == 'add' || ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ) { ?>
382
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_checkbox_info">' : ''; ?>
383
  <li>
384
  <label><?php _e( 'Checked by default?', 'wp-members' ); ?></label>
385
- <input type="checkbox" name="add_checked_default" value="y" <?php echo ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ? checked( 'y', $field_arr[8] ) : false; ?> />
386
  </li>
387
  <li>
388
- <label><?php _e( 'Stored value if checked:', 'wp-members' ); ?></label>
389
- <input type="text" name="add_checked_value" value="<?php echo ( $mode == 'edit' && $field_arr[3] == 'checkbox' ) ? $field_arr[7] : false; ?>" class="small-text" />
390
  </li>
391
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
392
  <?php }
393
 
394
- if ( isset( $field_arr[3] ) ) {
395
- $additional_settings = ( $field_arr[3] == 'select' || $field_arr[3] == 'multiselect' || $field_arr[3] == 'multicheckbox' || $field_arr[3] == 'radio' ) ? true : false;
396
- $delimiter_settings = ( $field_arr[3] == 'multiselect' || $field_arr[3] == 'multicheckbox' ) ? true : false;
397
  }
398
  if ( $mode == 'add' || ( $mode == 'edit' && $additional_settings ) ) { ?>
399
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_dropdown_info">' : ''; ?>
400
  <?php if ( $mode == 'add' || ( $mode == 'edit' && $delimiter_settings ) ) {
401
  echo ( $mode == 'add' ) ? '<div id="wpmem_delimiter_info">' : '';
402
- if ( isset( $field_arr[8] ) && ( "|" == $field_arr[8] || "," == $field_arr[8] ) ) {
403
- $delimiter = $field_arr[8];
404
  } else {
405
  $delimiter = "|";
406
  }
@@ -415,16 +420,16 @@ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $field = null ) {
415
  <?php echo ( $mode == 'add' ) ? '</div>' : '';
416
  } ?>
417
  <li>
418
- <label style="vertical-align:top"><?php _e( 'Values (Displayed|Stored):', 'wp-members' ); ?></label>
419
  <textarea name="add_dropdown_value" rows="5" cols="40"><?php
420
  // Accomodate editing the current dropdown values or create dropdown value example.
421
  if ( $mode == 'edit' ) {
422
- for ( $row = 0; $row < count( $field_arr[7] ); $row++ ) {
423
  // If the row contains commas (i.e. 1,000-10,000), wrap in double quotes.
424
- if ( strstr( $field_arr[7][$row], ',' ) ) {
425
- echo '"' . $field_arr[7][$row]; echo ( $row == count( $field_arr[7] )- 1 ) ? '"' : "\",\n";
426
  } else {
427
- echo $field_arr[7][$row]; echo ( $row == count( $field_arr[7] )- 1 ) ? "" : ",\n";
428
  } }
429
  } else {
430
  if (version_compare(PHP_VERSION, '5.3.0') >= 0) { ?>
@@ -448,16 +453,16 @@ Last Row|last_row<?php } } ?></textarea>
448
  </li>
449
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
450
  <?php } ?>
451
- <?php if ( $mode == 'add' || ( $mode == 'edit' && $field_arr[3] == 'hidden' ) ) { ?>
452
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_hidden_info">' : ''; ?>
453
  <li>
454
- <label><?php _e( 'Value', 'wp-members' ); ?></label>
455
- <input type="text" name="add_hidden_value" value="<?php echo ( $mode == 'edit' && $field_arr[3] == 'hidden' ) ? $field_arr[7] : ''; ?>" />
456
  </li>
457
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
458
  <?php } ?>
459
  </ul><br />
460
- <?php if ( $mode == 'edit' ) { ?><input type="hidden" name="field_arr" value="<?php echo $field_arr[2]; ?>" /><?php } ?>
461
  <input type="hidden" name="wpmem_admin_a" value="<?php echo ( $mode == 'edit' ) ? 'edit_field' : 'add_field'; ?>" />
462
  <?php $text = ( $mode == 'edit' ) ? __( 'Edit Field', 'wp-members' ) : __( 'Add Field', 'wp-members' ); ?>
463
  <?php submit_button( $text ); ?>
@@ -472,9 +477,10 @@ Last Row|last_row<?php } } ?></textarea>
472
  /**
473
  * Function to display the table of fields in the field manager tab.
474
  *
475
- * @since 2.8
476
  *
477
- * @param array $wpmem_fields The array of fields
 
478
  */
479
  function wpmem_a_field_table( $wpmem_fields ) {
480
 
@@ -488,52 +494,53 @@ function wpmem_a_field_table( $wpmem_fields ) {
488
  <?php wp_nonce_field( 'wpmem-update-fields' ); ?>
489
  <table class="widefat" id="wpmem-fields">
490
  <thead><tr class="head">
491
- <th scope="col"><?php _e( 'Add/Delete', 'wp-members' ); ?></th>
492
- <th scope="col"><?php _e( 'Field Label', 'wp-members' ); ?></th>
493
- <th scope="col"><?php _e( 'Option Name', 'wp-members' ); ?></th>
494
- <th scope="col"><?php _e( 'Field Type', 'wp-members' ); ?></th>
495
- <th scope="col"><?php _e( 'Display?', 'wp-members' ); ?></th>
496
- <th scope="col"><?php _e( 'Required?', 'wp-members' ); ?></th>
497
- <th scope="col"><?php _e( 'Checked?', 'wp-members' ); ?></th>
498
- <th scope="col"><?php _e( 'Edit' ); ?></th>
499
- <th scope="col"><?php _e( 'Users Screen','wp-members' ); ?></th>
500
  </tr></thead>
501
  <?php
502
  // Get the user table fields array.
503
  $wpmem_ut_fields = get_option( 'wpmembers_utfields' );
504
  // Order, label, optionname, input type, display, required, native.
505
  $class = '';
506
- for ( $row = 0; $row < count($wpmem_fields); $row++ ) {
 
 
507
  $class = ( $class == 'alternate' ) ? '' : 'alternate'; ?>
508
- <tr class="<?php echo $class; ?>" valign="top" id="<?php echo $wpmem_fields[$row][0];?>">
509
  <td width="10%"><?php
510
- $can_delete = ( $wpmem_fields[$row][2] == 'user_nicename' || $wpmem_fields[$row][2] == 'display_name' || $wpmem_fields[$row][2] == 'nickname' ) ? 'y' : 'n';
511
- if ( ( $can_delete == 'y' ) || $wpmem_fields[$row][6] != 'y' ) { ?><input type="checkbox" name="<?php echo "del_".$wpmem_fields[$row][2]; ?>" value="delete" /> <?php _e( 'Delete', 'wp-members' ); } ?></td>
512
  <td width="15%"><?php
513
- _e( $wpmem_fields[$row][1], 'wp-members' );
514
- if ( $wpmem_fields[$row][5] == 'y' ){ ?><font color="red">*</font><?php }
515
- ?>
516
  </td>
517
- <td width="15%"><?php echo $wpmem_fields[$row][2]; ?></td>
518
- <td width="10%"><?php echo $wpmem_fields[$row][3]; ?></td>
519
- <?php if ( $wpmem_fields[$row][2]!='user_email' ) { ?>
520
- <td width="10%"><?php echo wpmem_create_formfield( $wpmem_fields[$row][2] . "_display", 'checkbox', 'y', $wpmem_fields[$row][4] ); ?></td>
521
- <td width="10%"><?php echo wpmem_create_formfield( $wpmem_fields[$row][2] . "_required",'checkbox', 'y', $wpmem_fields[$row][5] ); ?></td>
522
  <?php } else { ?>
523
  <td colspan="2" width="20%"><small><i><?php _e( '(Email cannot be removed)', 'wp-members' ); ?></i></small></td>
524
  <?php } ?>
525
- <td align="center" width="10%"><?php if ( $wpmem_fields[$row][3] == 'checkbox' ) {
526
- echo wpmem_create_formfield( $wpmem_fields[$row][2]."_checked", 'checkbox', 'y', $wpmem_fields[$row][8] ); } ?>
527
  </td>
528
- <td width="10%"><?php echo ( $wpmem_fields[$row][6] == 'y' ) ? 'native' : wpmem_fields_edit_link( $wpmem_fields[$row][2] ); ?></td>
529
 
530
  <td align="center" width="10%">
531
  <?php
532
  $wpmem_ut_fields_skip = array( 'user_email', 'confirm_email', 'password', 'confirm_password' );
533
- if ( !in_array( $wpmem_fields[$row][2], $wpmem_ut_fields_skip ) ) { ?>
534
- <input type="checkbox" name="ut_fields[<?php echo $wpmem_fields[$row][2]; ?>]"
535
- value="<?php echo $wpmem_fields[$row][1]; ?>"
536
- <?php echo ( ( $wpmem_ut_fields ) && ( in_array( $wpmem_fields[$row][1], $wpmem_ut_fields ) ) ) ? 'checked' : false; ?> />
537
  <?php } ?>
538
  </td>
539
  </tr><?php
25
  */
26
  function wpmem_a_build_fields() {
27
 
28
+ global $wpmem, $add_field_err_msg;
29
  $add_toggle = ( isset( $_GET['edit'] ) ) ? $_GET['edit'] : false;
30
+ $wpmem_fields = wpmem_fields();
31
  ?>
32
  <div class="metabox-holder">
33
 
36
  <?php if ( $add_toggle && ( isset( $_POST['wpmem_admin_a'] ) != 'edit_field' ) ) {
37
  wpmem_a_field_edit( 'edit', $wpmem_fields, $add_toggle );
38
  } else {
39
+ if ( ! $add_field_err_msg ) {
40
+ wpmem_a_field_table( $wpmem_fields );
41
+ }
42
  wpmem_a_field_edit( 'add' );
43
  } ?>
44
 
68
 
69
  $new_order = $_REQUEST['orderstring'];
70
  $new_order = explode( "&", $new_order );
71
+
72
  // Loop through $new_order to create new field array.
73
  $wpmem_old_fields = get_option( 'wpmembers_fields' );
74
  for ( $row = 0; $row < count( $new_order ); $row++ ) {
75
  if ( $row > 0 ) {
76
  $key = $new_order[ $row ];
77
  $key = substr( $key, 15 );
78
+ if ( $key ) {
79
+ for ( $x = 0; $x < count( $wpmem_old_fields ); $x++ ) {
80
+ if ( $wpmem_old_fields[ $x ][2] == $key ) {
81
+ $wpmem_new_fields[ $row - 1 ] = $wpmem_old_fields[ $x ];
82
+ }
83
  }
84
  }
85
  }
122
 
123
  // Rebuild the array, don't touch user_email - it's always mandatory.
124
  $nrow = 0;
125
+ foreach ( $wpmem_fields as $field ) {
126
+
127
+ $meta_key = $field[2];
128
 
129
  // Check to see if the field is checked for deletion, and if not, add it to the new array.
130
+ $delete_field = "del_" . $meta_key;
131
+ $delete_field = ( isset( $_POST[ $delete_field ] ) ) ? $_POST[ $delete_field ] : false;
132
  if ( $delete_field != "delete" ) {
133
 
134
  for ( $i = 0; $i < 4; $i++ ) {
135
+ $wpmem_newfields[ $nrow ][ $i ] = $field[ $i ];
136
  }
137
 
138
  $wpmem_newfields[ $nrow ][0] = $nrow + 1;
139
 
140
+ $display_field = $meta_key . "_display";
141
+ $require_field = $meta_key . "_required";
142
+ $checked_field = $meta_key . "_checked";
143
 
144
+ if ( $field[2] != 'user_email' ){
145
+ $wpmem_newfields[ $nrow ][4] = ( isset( $_POST[ $display_field ] ) ) ? 'y' : '';
146
+ $wpmem_newfields[ $nrow ][5] = ( isset( $_POST[ $require_field ] ) ) ? 'y' : '';
147
  } else {
148
  $wpmem_newfields[ $nrow ][4] = 'y';
149
  $wpmem_newfields[ $nrow ][5] = 'y';
150
  }
 
 
151
 
152
+ $wpmem_newfields[ $nrow ][6] = $field[6];
153
+ $wpmem_newfields[ $nrow ][7] = ( isset( $field[7] ) ) ? $field[7] : '';
154
+ if ( $field[3] == 'checkbox' ) {
155
+ if ( isset( $_POST[ $checked_field ] ) && $_POST[ $checked_field ] == 'y' ) {
156
+ $wpmem_newfields[ $nrow ][8] = 'y';
157
  } else {
158
  $wpmem_newfields[ $nrow ][8] = 'n';
159
  }
163
  }
164
 
165
  }
166
+
167
  update_option( 'wpmembers_fields', $wpmem_newfields );
168
  $did_update = __( 'WP-Members fields were updated', 'wp-members' );
169
 
191
 
192
  // Error check for reserved terms.
193
  $reserved_terms = wpmem_wp_reserved_terms();
194
+ $submitted_meta = $_POST['add_option'];
195
+ if ( in_array( strtolower( $submitted_meta ), $reserved_terms ) ) {
196
  $add_field_err_msg = sprintf( __( 'Sorry, "%s" is a <a href="https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms" target="_blank">reserved term</a>. Field was not added.', 'wp-members' ), $submitted_term );
197
  }
198
 
199
  // Error check option name for spaces and replace with underscores.
200
+ $us_option = preg_replace( "/ /", '_', $submitted_meta );
 
201
 
202
  $arr = array();
203
+
204
+ $type = $_POST['add_type'];
205
 
206
  $arr[0] = ( $action == 'add_field' ) ? ( count( $wpmem_fields ) ) + 2 : false;
207
  $arr[1] = stripslashes( $_POST['add_name'] );
208
  $arr[2] = $us_option;
209
+ $arr[3] = $type;
210
  $arr[4] = ( isset( $_POST['add_display'] ) ) ? $_POST['add_display'] : 'n';
211
  $arr[5] = ( isset( $_POST['add_required'] ) ) ? $_POST['add_required'] : 'n';
212
  $arr[6] = ( $us_option == 'user_nicename' || $us_option == 'display_name' || $us_option == 'nickname' ) ? 'y' : 'n';
213
 
214
+ if ( $type == 'checkbox' ) {
215
  $add_field_err_msg = ( ! $_POST['add_checked_value'] ) ? __( 'Checked value is required for checkboxes. Nothing was updated.', 'wp-members' ) : $add_field_err_msg;
216
  $arr[7] = ( isset( $_POST['add_checked_value'] ) ) ? $_POST['add_checked_value'] : false;
217
  $arr[8] = ( isset( $_POST['add_checked_default'] ) ) ? $_POST['add_checked_default'] : 'n';
218
  }
219
 
220
+ if ( $type == 'select'
221
+ || $type == 'multiselect'
222
+ || $type == 'radio'
223
+ || $type == 'multicheckbox'
224
  ) {
225
  // Get the values.
226
  $str = stripslashes( $_POST['add_dropdown_value'] );
233
  $arr[7] = str_getcsv( $str, ',', '"' );
234
  }
235
  // If multiselect or multicheckbox, set delimiter.
236
+ if ( 'multiselect' == $type || 'multicheckbox' == $type ) {
237
  $arr[8] = ( isset( $_POST['add_delimiter_value'] ) ) ? $_POST['add_delimiter_value'] : '|';
238
  }
239
  }
240
 
241
+ if ( $type == 'file' || $type == 'image' ) {
242
  $arr[7] = stripslashes( $_POST['add_file_value'] );
243
  }
244
 
276
 
277
  if ( WPMEM_DEBUG == true && isset( $arr ) ) { echo "<pre>"; print_r($arr); echo "</pre>"; }
278
 
279
+ global $wpmem;
280
+ $wpmem->load_fields();
281
+
282
  return $did_update;
283
  }
284
 
304
  * @param array|null $wpmem_fields the array of fields
305
  * @param string|null $field the field being edited
306
  */
307
+ function wpmem_a_field_edit( $mode, $wpmem_fields = null, $meta_key = null ) {
308
+
309
+ global $wpmem;
310
 
311
  if ( $mode == 'edit' ) {
312
+ $fields = wpmem_fields();
313
+ $field = $fields[ $meta_key ];
 
 
 
314
  }
315
 
316
  $form_action = ( $mode == 'edit' ) ? 'editfieldform' : 'addfieldform';
323
  <?php wp_nonce_field( 'wpmem-add-fields' ); ?>
324
  <ul>
325
  <li>
326
+ <label><?php _e( 'Field Label', 'wp-members' ); ?> <span class="req"><?php _e( '(required)', 'wp-members' ); ?></span></label>
327
+ <input type="text" name="add_name" value="<?php echo ( $mode == 'edit' ) ? $field['label'] : false; ?>" />
328
  <?php _e( 'The name of the field as it will be displayed to the user.', 'wp-members' ); ?>
329
  </li>
330
  <li>
331
+ <label><?php _e( 'Meta Key', 'wp-members' ); ?> <span class="req"><?php _e( '(required)', 'wp-members' ); ?></span></label>
332
  <?php if ( $mode == 'edit' ) {
333
+ echo $meta_key; ?>
334
+ <input type="hidden" name="add_option" value="<?php echo $meta_key; ?>" />
335
  <?php } else { ?>
336
  <input type="text" name="add_option" value="" />
337
  <?php _e( 'The database meta value for the field. It must be unique and contain no spaces (underscores are ok).', 'wp-members' ); ?>
340
  <li>
341
  <label><?php _e( 'Field Type', 'wp-members' ); ?></label>
342
  <?php if ( $mode == 'edit' ) {
343
+ echo $field['type']; ?>
344
+ <input type="hidden" name="add_type" value="<?php echo $field['type']; ?>" />
345
  <?php } else { ?>
346
  <select name="add_type" id="wpmem_field_type_select">
347
  <option value="text"><?php _e( 'text', 'wp-members' ); ?></option>
362
  </li>
363
  <li>
364
  <label><?php _e( 'Display?', 'wp-members' ); ?></label>
365
+ <input type="checkbox" name="add_display" value="y" <?php echo ( $mode == 'edit' ) ? checked( true, $field['register'] ) : false; ?> />
366
  </li>
367
  <li>
368
  <label><?php _e( 'Required?', 'wp-members' ); ?></label>
369
+ <input type="checkbox" name="add_required" value="y" <?php echo ( $mode == 'edit' ) ? checked( true, $field['required'] ) : false; ?> />
370
  </li>
371
+ <?php if ( $mode == 'add' || ( $mode == 'edit' && ( $field['type'] == 'file' || $field['type'] == 'image' ) ) ) { ?>
372
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_file_info">' : ''; ?>
373
  <li>
374
  <strong><?php _e( 'Additional information for field upload fields', 'wp-members' ); ?></strong>
375
  </li>
376
  <li>
377
  <label><?php _e( 'Accepted file types:', 'wp-members' ); ?></label>
378
+ <input type="text" name="add_file_value" value="<?php echo ( $mode == 'edit' && ( $field['type'] == 'file' || $field['type'] == 'image' ) ) ? $field['file_types'] : false; ?>" />
379
  </li>
380
  <li>
381
  <label>&nbsp;</label>
383
  </li>
384
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
385
  <?php } ?>
386
+ <?php if ( $mode == 'add' || ( $mode == 'edit' && $field['type'] == 'checkbox' ) ) { ?>
387
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_checkbox_info">' : ''; ?>
388
  <li>
389
  <label><?php _e( 'Checked by default?', 'wp-members' ); ?></label>
390
+ <input type="checkbox" name="add_checked_default" value="y" <?php echo ( $mode == 'edit' && $field['type'] == 'checkbox' ) ? checked( true, $field['checked_default'] ) : false; ?> />
391
  </li>
392
  <li>
393
+ <label><?php _e( 'Stored value if checked:', 'wp-members' ); ?> <span class="req"><?php _e( '(required)', 'wp-members' ); ?></span></label>
394
+ <input type="text" name="add_checked_value" value="<?php echo ( $mode == 'edit' && $field['type'] == 'checkbox' ) ? $field['checked_value'] : false; ?>" class="small-text" />
395
  </li>
396
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
397
  <?php }
398
 
399
+ if ( isset( $field['type'] ) ) {
400
+ $additional_settings = ( $field['type'] == 'select' || $field['type'] == 'multiselect' || $field['type'] == 'multicheckbox' || $field['type'] == 'radio' ) ? true : false;
401
+ $delimiter_settings = ( $field['type'] == 'multiselect' || $field['type'] == 'multicheckbox' ) ? true : false;
402
  }
403
  if ( $mode == 'add' || ( $mode == 'edit' && $additional_settings ) ) { ?>
404
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_dropdown_info">' : ''; ?>
405
  <?php if ( $mode == 'add' || ( $mode == 'edit' && $delimiter_settings ) ) {
406
  echo ( $mode == 'add' ) ? '<div id="wpmem_delimiter_info">' : '';
407
+ if ( isset( $field['delimiter'] ) && ( "|" == $field['delimiter'] || "," == $field['delimiter'] ) ) {
408
+ $delimiter = $field['delimiter'];
409
  } else {
410
  $delimiter = "|";
411
  }
420
  <?php echo ( $mode == 'add' ) ? '</div>' : '';
421
  } ?>
422
  <li>
423
+ <label style="vertical-align:top"><?php _e( 'Values (Displayed|Stored):', 'wp-members' ); ?> <span class="req"><?php _e( '(required)', 'wp-members' ); ?></span></label>
424
  <textarea name="add_dropdown_value" rows="5" cols="40"><?php
425
  // Accomodate editing the current dropdown values or create dropdown value example.
426
  if ( $mode == 'edit' ) {
427
+ for ( $row = 0; $row < count( $field['values'] ); $row++ ) {
428
  // If the row contains commas (i.e. 1,000-10,000), wrap in double quotes.
429
+ if ( strstr( $field['values'][ $row ], ',' ) ) {
430
+ echo '"' . $field['values'][ $row ]; echo ( $row == count( $field['values'] )- 1 ) ? '"' : "\",\n";
431
  } else {
432
+ echo $field['values'][ $row ]; echo ( $row == count( $field['values'] )- 1 ) ? "" : ",\n";
433
  } }
434
  } else {
435
  if (version_compare(PHP_VERSION, '5.3.0') >= 0) { ?>
453
  </li>
454
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
455
  <?php } ?>
456
+ <?php if ( $mode == 'add' || ( $mode == 'edit' && $field['type'] == 'hidden' ) ) { ?>
457
  <?php echo ( $mode == 'add' ) ? '<div id="wpmem_hidden_info">' : ''; ?>
458
  <li>
459
+ <label><?php _e( 'Value', 'wp-members' ); ?> <span class="req"><?php _e( '(required)', 'wp-members' ); ?></span></label>
460
+ <input type="text" name="add_hidden_value" value="<?php echo ( $mode == 'edit' && $field['type'] == 'hidden' ) ? $field['value'] : ''; ?>" />
461
  </li>
462
  <?php echo ( $mode == 'add' ) ? '</div>' : ''; ?>
463
  <?php } ?>
464
  </ul><br />
465
+ <?php if ( $mode == 'edit' ) { ?><input type="hidden" name="field_arr" value="<?php echo $meta_key; ?>" /><?php } ?>
466
  <input type="hidden" name="wpmem_admin_a" value="<?php echo ( $mode == 'edit' ) ? 'edit_field' : 'add_field'; ?>" />
467
  <?php $text = ( $mode == 'edit' ) ? __( 'Edit Field', 'wp-members' ) : __( 'Add Field', 'wp-members' ); ?>
468
  <?php submit_button( $text ); ?>
477
  /**
478
  * Function to display the table of fields in the field manager tab.
479
  *
480
+ * @since 2.8.0
481
  *
482
+ * @global object $wpmem
483
+ * @param array $wpmem_fields The array of fields.
484
  */
485
  function wpmem_a_field_table( $wpmem_fields ) {
486
 
494
  <?php wp_nonce_field( 'wpmem-update-fields' ); ?>
495
  <table class="widefat" id="wpmem-fields">
496
  <thead><tr class="head">
497
+ <th scope="col"><?php _e( 'Add/Delete', 'wp-members' ); ?></th>
498
+ <th scope="col"><?php _e( 'Field Label', 'wp-members' ); ?></th>
499
+ <th scope="col"><?php _e( 'Meta Key', 'wp-members' ); ?></th>
500
+ <th scope="col"><?php _e( 'Field Type', 'wp-members' ); ?></th>
501
+ <th scope="col"><?php _e( 'Display?', 'wp-members' ); ?></th>
502
+ <th scope="col"><?php _e( 'Required?', 'wp-members' ); ?></th>
503
+ <th scope="col"><?php _e( 'Checked?', 'wp-members' ); ?></th>
504
+ <th scope="col"><?php _e( 'Edit' ); ?></th>
505
+ <th scope="col"><?php _e( 'Users Screen', 'wp-members' ); ?></th>
506
  </tr></thead>
507
  <?php
508
  // Get the user table fields array.
509
  $wpmem_ut_fields = get_option( 'wpmembers_utfields' );
510
  // Order, label, optionname, input type, display, required, native.
511
  $class = '';
512
+ // for ( $row = 0; $row < count($wpmem_fields); $row++ ) {
513
+ $row = 0;
514
+ foreach ( $wpmem_fields as $meta_key => $field ) {
515
  $class = ( $class == 'alternate' ) ? '' : 'alternate'; ?>
516
+ <tr class="<?php echo $class; ?>" valign="top" id="<?php echo $meta_key;?>">
517
  <td width="10%"><?php
518
+ $can_delete = ( $meta_key == 'user_nicename' || $meta_key == 'display_name' || $meta_key == 'nickname' ) ? true : false;
519
+ if ( ( $can_delete ) || ! $field['native'] ) { ?><input type="checkbox" name="<?php echo "del_" . $meta_key; ?>" value="delete" /> <?php _e( 'Delete', 'wp-members' ); } ?></td>
520
  <td width="15%"><?php
521
+ _e( $field['label'], 'wp-members' );
522
+ echo ( $field['required'] ) ? '<span class="req">*</span>' : ''; ?>
 
523
  </td>
524
+ <td width="15%"><?php echo $meta_key; ?></td>
525
+ <td width="10%"><?php echo $field['type']; ?></td>
526
+ <?php if ( $meta_key != 'user_email' ) { ?>
527
+ <td width="10%"><?php echo wpmem_create_formfield( $meta_key . "_display", 'checkbox', true, $field['register'] ); ?></td>
528
+ <td width="10%"><?php echo wpmem_create_formfield( $meta_key . "_required", 'checkbox', true, $field['required'] ); ?></td>
529
  <?php } else { ?>
530
  <td colspan="2" width="20%"><small><i><?php _e( '(Email cannot be removed)', 'wp-members' ); ?></i></small></td>
531
  <?php } ?>
532
+ <td align="center" width="10%"><?php if ( $field['type'] == 'checkbox' ) {
533
+ echo wpmem_create_formfield( $meta_key . "_checked", 'checkbox', true, $field['checked_default'] ); } ?>
534
  </td>
535
+ <td width="10%"><?php echo ( $field['native'] ) ? 'native' : wpmem_fields_edit_link( $meta_key ); ?></td>
536
 
537
  <td align="center" width="10%">
538
  <?php
539
  $wpmem_ut_fields_skip = array( 'user_email', 'confirm_email', 'password', 'confirm_password' );
540
+ if ( ! in_array( $meta_key, $wpmem_ut_fields_skip ) ) { ?>
541
+ <input type="checkbox" name="ut_fields[<?php echo $meta_key; ?>]"
542
+ value="<?php echo $field['label']; ?>"
543
+ <?php echo ( ( $wpmem_ut_fields ) && ( in_array( $field['label'], $wpmem_ut_fields ) ) ) ? 'checked' : false; ?> />
544
  <?php } ?>
545
  </td>
546
  </tr><?php
admin/tab-options.php CHANGED
@@ -27,6 +27,8 @@
27
  * Builds the settings panel.
28
  *
29
  * @since 2.2.2
 
 
30
  */
31
  function wpmem_a_build_options() {
32
 
@@ -81,8 +83,8 @@ function wpmem_a_build_options() {
81
  if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) {
82
  ?>
83
  <li<?php echo ( $i == $len - 1 ) ? ' style="border-bottom:1px solid #eee;"' : ''; ?>>
84
- <label><?php echo ( $i == 0 ) ? 'Content Blocking' : '&nbsp;'; ?></label>
85
- <?php
86
  $block = ( isset( $wpmem->block[ $key ] ) ) ? $wpmem->block[ $key ] : '';
87
  $values = array(
88
  __( 'Do not block', 'wp-members' ) . '|0',
@@ -90,7 +92,7 @@ function wpmem_a_build_options() {
90
  // @todo Future development. __( 'Hide', 'wp-members' ) . '|2',
91
  );
92
  echo wpmem_create_formfield( 'wpmem_block_' . $key, 'select', $values, $block ); ?>
93
- <span><?php echo $val; ?></span>
94
  </li>
95
  <?php $i++;
96
  }
@@ -117,17 +119,20 @@ function wpmem_a_build_options() {
117
  if ( isset( $wpmem->{$item_key}[ $key ] ) && $wpmem->{$item_key}[ $key ]['enabled'] == 1 ) {
118
  $setting = 1;
119
  $ex_len = $wpmem->{$item_key}[ $key ]['length'];
 
120
  } else {
121
  $setting = 0;
122
- $ex_len = '';
123
- }
 
124
  echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;
125
- <span><?php _e( 'Number of words in excerpt:', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_len" type="text" size="5" value="<?php echo $ex_len; ?>" />
 
126
  <?php } else {
127
  $setting = ( isset( $wpmem->{$item_key}[ $key ] ) ) ? $wpmem->{$item_key}[ $key ] : 0;
128
  echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>
129
  <?php } ?>
130
- </li>
131
  <?php $i++;
132
  }
133
  }
@@ -159,23 +164,23 @@ function wpmem_a_build_options() {
159
  for ( $row = 0; $row < count( $arr ); $row++ ) { ?>
160
  <li>
161
  <label><?php echo $arr[ $row ][0]; ?></label>
162
- <?php echo wpmem_create_formfield( $arr[ $row ][1], 'checkbox', '1', $wpmem->{$arr[$row][3]} ); ?>&nbsp;&nbsp;
163
  <?php if ( $arr[$row][2] ) { ?><span class="description"><?php echo $arr[ $row ][2]; ?></span><?php } ?>
164
  </li>
165
  <?php } ?>
166
  <li>
167
  <label><?php _e( 'Attribution', 'wp-members' ); ?></label>
168
- <?php echo wpmem_create_formfield( 'attribution', 'checkbox', '1', $wpmem->attrib ); ?>&nbsp;&nbsp;
169
  <span class="description"><?php _e( 'Attribution is appreciated! Display "powered by" link on register form?', 'wp-members' ); ?></span>
170
  </li>
171
  <li>
172
  <label><?php _e( 'Enable CAPTCHA', 'wp-members' ); ?></label>
173
- <?php $captcha = array(
174
- __( 'None', 'wp-members' ) . '|0',
175
- 'reCAPTCHA|1',
176
- 'reCAPTCHA v2|3',
177
- 'Really Simple CAPTCHA|2'
178
- );
179
  echo wpmem_create_formfield( 'wpmem_settings_captcha', 'select', $captcha, $wpmem->captcha ); ?>
180
  </li>
181
  <h3><?php _e( 'Pages' ); ?></h3>
@@ -237,34 +242,34 @@ function wpmem_a_build_options() {
237
  </form>
238
  </div><!-- .inside -->
239
  </div>
240
- <?php if ( $post_types ) { ?>
241
- <div class="postbox">
242
- <h3><span><?php _e( 'Custom Post Types', 'wp-members' ); ?></span></h3>
243
- <div class="inside">
244
- <form name="updatecpts" id="updatecpts" method="post" action="<?php echo $_SERVER['REQUEST_URI']?>">
245
  <?php wp_nonce_field( 'wpmem-update-cpts' ); ?>
246
- <table class="form-table">
247
- <tr>
248
- <th scope="row"><?php _e( 'Add to WP-Members Settings', 'wp-members' ); ?></th>
249
- <td><fieldset><?php
250
  foreach ( $post_arr as $key => $val ) {
251
  if ( 'post' != $key && 'page' != $key ) {
252
  $checked = ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ? ' checked' : '';
253
- echo '<label for="' . $key . '"><input type="checkbox" name="wpmembers_handle_cpts[]" value="' . $key . '"' . $checked . ' />' . $val . '</label><br />';
254
  }
255
  }
256
  ?></fieldset>
257
- </td>
258
- </tr>
259
- <tr>
260
- <input type="hidden" name="wpmem_admin_a" value="update_cpts" />
261
- <td colspan="2"><?php submit_button( __( 'Update Settings', 'wp-members' ) ); ?></td>
262
- </tr>
263
- </table>
264
- </form>
265
- </div>
266
- </div>
267
- <?php } ?>
268
  </div><!-- #post-body-content -->
269
  </div><!-- #post-body -->
270
  </div><!-- .metabox-holder -->
@@ -280,16 +285,16 @@ function wpmem_a_build_options() {
280
  * @return string The updated message.
281
  */
282
  function wpmem_update_cpts() {
283
-
284
  // Check nonce.
285
  check_admin_referer( 'wpmem-update-cpts' );
286
-
287
  // Get the main settings array as it stands.
288
  $wpmem_newsettings = get_option( 'wpmembers_settings' );
289
-
290
  // Assemble CPT settings.
291
  $cpts = array();
292
-
293
  $post_arr = array();
294
  $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );
295
  if ( $post_types ) {
@@ -298,7 +303,7 @@ function wpmem_update_cpts() {
298
  $post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name;
299
  }
300
  }
301
-
302
  $post_vals = ( isset( $_POST['wpmembers_handle_cpts'] ) ) ? $_POST['wpmembers_handle_cpts'] : false;
303
  if ( $post_vals ) {
304
  foreach ( $post_vals as $val ) {
@@ -308,7 +313,7 @@ function wpmem_update_cpts() {
308
  $cpts = array();
309
  }
310
  $wpmem_newsettings['post_types'] = $cpts;
311
-
312
  // Update settings, remove or add CPTs.
313
  $chk_settings = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
314
  foreach ( $chk_settings as $chk ) {
@@ -337,9 +342,9 @@ function wpmem_update_cpts() {
337
  }
338
  }
339
  }
340
-
341
  wpmem_admin_new_settings( $wpmem_newsettings );
342
-
343
  return __( 'Custom Post Type settings were updated', 'wp-members' );
344
  }
345
 
@@ -353,9 +358,8 @@ function wpmem_update_cpts() {
353
  * @return string The options updated message.
354
  */
355
  function wpmem_update_options() {
356
-
357
  global $wpmem;
358
-
359
  // Check nonce.
360
  check_admin_referer( 'wpmem-update-settings' );
361
 
@@ -414,17 +418,17 @@ function wpmem_update_options() {
414
  $post_arr[] = $key;
415
  }
416
  }
417
-
418
  // Leave form tag settings alone.
419
  if ( isset( $wpmem->form_tags ) ) {
420
  $wpmem_newsettings['form_tags'] = $wpmem->form_tags;
421
  }
422
-
423
  // Leave email settings alone.
424
  if ( isset( $wpmem->email ) ) {
425
  $wpmem_newsettings['email'] = $wpmem->email;
426
  }
427
-
428
  // Get settings for blocking, excerpts, show login, and show registration for posts, pages, and custom post types.
429
  $option_group_array = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
430
  foreach ( $option_group_array as $option_group_item ) {
@@ -433,8 +437,9 @@ function wpmem_update_options() {
433
  $post_var = 'wpmem_' . $option_group_item . '_' . $post_type;
434
  if ( $option_group_item == 'autoex' ) {
435
  // Auto excerpt is an array.
436
- $arr[ $post_type ]['enabled'] = ( isset( $_POST[ $post_var ] ) ) ? $_POST[ $post_var ] : 0;
437
- $arr[ $post_type ]['length'] = ( isset( $_POST[ $post_var ] ) ) ? ( ( $_POST[ $post_var . '_len' ] == '' ) ? 0 : $_POST[ $post_var . '_len' ] ) : '';
 
438
  } else {
439
  // All other settings are 0|1.
440
  $arr[ $post_type ] = ( isset( $_POST[ $post_var ] ) ) ? $_POST[ $post_var ] : 0;
@@ -472,10 +477,10 @@ function wpmem_update_options() {
472
  * @return $settings
473
  */
474
  function wpmem_admin_new_settings( $new ) {
475
-
476
  // Update saved settings.
477
  update_option( 'wpmembers_settings', $new );
478
-
479
  // Update the current WP_Members object with the new settings.
480
  global $wpmem;
481
  foreach ( $new as $key => $val ) {
@@ -538,18 +543,19 @@ function wpmem_admin_style_list( $style ) {
538
  * Create a dropdown selection of pages.
539
  *
540
  * @since 2.8.1
 
541
  *
542
  * @param string $val
543
  */
544
  function wpmem_admin_page_list( $val, $show_custom_url = true ) {
545
 
546
- $selected = ( $val == 'http://' ) ? 'select a page' : false;
547
  $pages = get_pages();
548
 
549
- echo '<option value=""'; echo ( $selected == 'select a page' ) ? ' selected' : ''; echo '>'; echo esc_attr( __( 'Select a page' ) ); echo '</option>';
550
 
551
  foreach ( $pages as $page ) {
552
- $selected = ( get_page_link( $page->ID ) == $val ) ? true : $selected; echo "VAL: " . $val . ' PAGE LINK: ' . get_page_link( $page->ID );
553
  $option = '<option value="' . $page->ID . '"' . selected( get_page_link( $page->ID ), $val, 'select' ) . '>';
554
  $option .= $page->post_title;
555
  $option .= '</option>';
27
  * Builds the settings panel.
28
  *
29
  * @since 2.2.2
30
+ *
31
+ * @global object $wpmem The WP_Members Object.
32
  */
33
  function wpmem_a_build_options() {
34
 
83
  if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) {
84
  ?>
85
  <li<?php echo ( $i == $len - 1 ) ? ' style="border-bottom:1px solid #eee;"' : ''; ?>>
86
+ <label><?php echo ( $i == 0 ) ? __( 'Content Blocking', 'wp-members' ) : '&nbsp;'; ?></label>
87
+ <?php
88
  $block = ( isset( $wpmem->block[ $key ] ) ) ? $wpmem->block[ $key ] : '';
89
  $values = array(
90
  __( 'Do not block', 'wp-members' ) . '|0',
92
  // @todo Future development. __( 'Hide', 'wp-members' ) . '|2',
93
  );
94
  echo wpmem_create_formfield( 'wpmem_block_' . $key, 'select', $values, $block ); ?>
95
+ <span><?php echo $val; ?></span><?php // @todo - this needs to be translatable. ?>
96
  </li>
97
  <?php $i++;
98
  }
119
  if ( isset( $wpmem->{$item_key}[ $key ] ) && $wpmem->{$item_key}[ $key ]['enabled'] == 1 ) {
120
  $setting = 1;
121
  $ex_len = $wpmem->{$item_key}[ $key ]['length'];
122
+ $ex_text = ( isset( $wpmem->{$item_key}[ $key ]['text'] ) ) ? $wpmem->{$item_key}[ $key ]['text'] : '';
123
  } else {
124
  $setting = 0;
125
+ $ex_len = '';
126
+ $ex_text = '';
127
+ }
128
  echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;
129
+ <span><?php _e( 'Number of words in excerpt:', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_len" type="text" size="5" value="<?php echo $ex_len; ?>" />&nbsp;&nbsp;&nbsp;&nbsp;
130
+ <span><?php _e( 'Custom read more link (optional):', 'wp-members' ); ?> </span><input name="wpmem_autoex_<?php echo $key; ?>_text" type="text" size="5" value="<?php echo $ex_text; ?>" />
131
  <?php } else {
132
  $setting = ( isset( $wpmem->{$item_key}[ $key ] ) ) ? $wpmem->{$item_key}[ $key ] : 0;
133
  echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?> <span><?php echo $val; ?></span>
134
  <?php } ?>
135
+ </li>
136
  <?php $i++;
137
  }
138
  }
164
  for ( $row = 0; $row < count( $arr ); $row++ ) { ?>
165
  <li>
166
  <label><?php echo $arr[ $row ][0]; ?></label>
167
+ <?php echo wpmem_create_formfield( $arr[ $row ][1], 'checkbox', '1', $wpmem->{$arr[$row][3]} ); ?>&nbsp;&nbsp;
168
  <?php if ( $arr[$row][2] ) { ?><span class="description"><?php echo $arr[ $row ][2]; ?></span><?php } ?>
169
  </li>
170
  <?php } ?>
171
  <li>
172
  <label><?php _e( 'Attribution', 'wp-members' ); ?></label>
173
+ <?php echo wpmem_create_formfield( 'attribution', 'checkbox', '1', $wpmem->attrib ); ?>&nbsp;&nbsp;
174
  <span class="description"><?php _e( 'Attribution is appreciated! Display "powered by" link on register form?', 'wp-members' ); ?></span>
175
  </li>
176
  <li>
177
  <label><?php _e( 'Enable CAPTCHA', 'wp-members' ); ?></label>
178
+ <?php $captcha = array( __( 'None', 'wp-members' ) . '|0' );
179
+ if ( 1 == $wpmem->captcha ) {
180
+ $captcha[] = 'reCAPTCHA v1 (deprecated)|1';
181
+ }
182
+ $captcha[] = __( 'reCAPTCHA', 'wp-members' ) . '|3';
183
+ $captcha[] = __( 'Really Simple CAPTCHA', 'wp-members' ) . '|2';
184
  echo wpmem_create_formfield( 'wpmem_settings_captcha', 'select', $captcha, $wpmem->captcha ); ?>
185
  </li>
186
  <h3><?php _e( 'Pages' ); ?></h3>
242
  </form>
243
  </div><!-- .inside -->
244
  </div>
245
+ <?php if ( $post_types ) { ?>
246
+ <div class="postbox">
247
+ <h3><span><?php _e( 'Custom Post Types', 'wp-members' ); ?></span></h3>
248
+ <div class="inside">
249
+ <form name="updatecpts" id="updatecpts" method="post" action="<?php echo $_SERVER['REQUEST_URI']?>">
250
  <?php wp_nonce_field( 'wpmem-update-cpts' ); ?>
251
+ <table class="form-table">
252
+ <tr>
253
+ <th scope="row"><?php _e( 'Add to WP-Members Settings', 'wp-members' ); ?></th>
254
+ <td><fieldset><?php
255
  foreach ( $post_arr as $key => $val ) {
256
  if ( 'post' != $key && 'page' != $key ) {
257
  $checked = ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ? ' checked' : '';
258
+ echo '<label for="' . $key . '"><input type="checkbox" name="wpmembers_handle_cpts[]" value="' . $key . '"' . $checked . ' />' . $val . '</label><br />';
259
  }
260
  }
261
  ?></fieldset>
262
+ </td>
263
+ </tr>
264
+ <tr>
265
+ <input type="hidden" name="wpmem_admin_a" value="update_cpts" />
266
+ <td colspan="2"><?php submit_button( __( 'Update Settings', 'wp-members' ) ); ?></td>
267
+ </tr>
268
+ </table>
269
+ </form>
270
+ </div>
271
+ </div>
272
+ <?php } ?>
273
  </div><!-- #post-body-content -->
274
  </div><!-- #post-body -->
275
  </div><!-- .metabox-holder -->
285
  * @return string The updated message.
286
  */
287
  function wpmem_update_cpts() {
288
+
289
  // Check nonce.
290
  check_admin_referer( 'wpmem-update-cpts' );
291
+
292
  // Get the main settings array as it stands.
293
  $wpmem_newsettings = get_option( 'wpmembers_settings' );
294
+
295
  // Assemble CPT settings.
296
  $cpts = array();
297
+
298
  $post_arr = array();
299
  $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );
300
  if ( $post_types ) {
303
  $post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name;
304
  }
305
  }
306
+
307
  $post_vals = ( isset( $_POST['wpmembers_handle_cpts'] ) ) ? $_POST['wpmembers_handle_cpts'] : false;
308
  if ( $post_vals ) {
309
  foreach ( $post_vals as $val ) {
313
  $cpts = array();
314
  }
315
  $wpmem_newsettings['post_types'] = $cpts;
316
+
317
  // Update settings, remove or add CPTs.
318
  $chk_settings = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
319
  foreach ( $chk_settings as $chk ) {
342
  }
343
  }
344
  }
345
+
346
  wpmem_admin_new_settings( $wpmem_newsettings );
347
+
348
  return __( 'Custom Post Type settings were updated', 'wp-members' );
349
  }
350
 
358
  * @return string The options updated message.
359
  */
360
  function wpmem_update_options() {
 
361
  global $wpmem;
362
+
363
  // Check nonce.
364
  check_admin_referer( 'wpmem-update-settings' );
365
 
418
  $post_arr[] = $key;
419
  }
420
  }
421
+
422
  // Leave form tag settings alone.
423
  if ( isset( $wpmem->form_tags ) ) {
424
  $wpmem_newsettings['form_tags'] = $wpmem->form_tags;
425
  }
426
+
427
  // Leave email settings alone.
428
  if ( isset( $wpmem->email ) ) {
429
  $wpmem_newsettings['email'] = $wpmem->email;
430
  }
431
+
432
  // Get settings for blocking, excerpts, show login, and show registration for posts, pages, and custom post types.
433
  $option_group_array = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' );
434
  foreach ( $option_group_array as $option_group_item ) {
437
  $post_var = 'wpmem_' . $option_group_item . '_' . $post_type;
438
  if ( $option_group_item == 'autoex' ) {
439
  // Auto excerpt is an array.
440
+ $arr[ $post_type ]['enabled'] = ( isset( $_POST[ $post_var ] ) ) ? $_POST[ $post_var ] : 0;
441
+ $arr[ $post_type ]['length'] = ( isset( $_POST[ $post_var . '_len' ] ) ) ? ( ( $_POST[ $post_var . '_len' ] == '' ) ? 0 : $_POST[ $post_var . '_len' ] ) : '';
442
+ $arr[ $post_type ]['text'] = ( isset( $_POST[ $post_var . '_text' ] ) ) ? $_POST[ $post_var . '_text' ] : '';
443
  } else {
444
  // All other settings are 0|1.
445
  $arr[ $post_type ] = ( isset( $_POST[ $post_var ] ) ) ? $_POST[ $post_var ] : 0;
477
  * @return $settings
478
  */
479
  function wpmem_admin_new_settings( $new ) {
480
+
481
  // Update saved settings.
482
  update_option( 'wpmembers_settings', $new );
483
+
484
  // Update the current WP_Members object with the new settings.
485
  global $wpmem;
486
  foreach ( $new as $key => $val ) {
543
  * Create a dropdown selection of pages.
544
  *
545
  * @since 2.8.1
546
+ * @todo Consider wp_dropdown_pages. Can be retrieved as HTML (echo=false) and str_replaced to add custom values.
547
  *
548
  * @param string $val
549
  */
550
  function wpmem_admin_page_list( $val, $show_custom_url = true ) {
551
 
552
+ $selected = ( $val == 'http://' || $val == 'https://' ) ? 'select a page' : false;
553
  $pages = get_pages();
554
 
555
+ echo '<option value=""'; echo ( $selected == 'select a page' ) ? ' selected' : ''; echo '>'; echo esc_attr( __( 'Select a page', 'wp-members' ) ); echo '</option>';
556
 
557
  foreach ( $pages as $page ) {
558
+ $selected = ( get_page_link( $page->ID ) == $val ) ? true : $selected; //echo "VAL: " . $val . ' PAGE LINK: ' . get_page_link( $page->ID );
559
  $option = '<option value="' . $page->ID . '"' . selected( get_page_link( $page->ID ), $val, 'select' ) . '>';
560
  $option .= $page->post_title;
561
  $option .= '</option>';
admin/user-export.php CHANGED
@@ -33,7 +33,7 @@ function wpmem_export_users( $args, $users = null ) {
33
  $defaults = array(
34
  'export' => 'all',
35
  'filename' => 'wp-members-user-export-' . $today . '.csv',
36
- 'export_fields' => $wpmem->fields, //array(),
37
  'exclude_fields' => array( 'password', 'confirm_password', 'confirm_email' ),
38
  );
39
 
@@ -63,9 +63,9 @@ function wpmem_export_users( $args, $users = null ) {
63
  // Do the header row.
64
  $hrow = "User ID,Username,";
65
 
66
- foreach ( $args['export_fields'] as $meta ) {
67
- if ( ! in_array( $meta[2], $args['exclude_fields'] ) ) {
68
- $hrow.= $meta[1] . ",";
69
  }
70
  }
71
 
@@ -94,13 +94,13 @@ function wpmem_export_users( $args, $users = null ) {
94
  $data .= '"' . $user_info->ID . '","' . $user_info->user_login . '",';
95
 
96
  $wp_user_fields = array( 'user_email', 'user_nicename', 'user_url', 'display_name' );
97
- foreach ( $args['export_fields'] as $meta ) {
98
- if ( ! in_array( $meta[2], $args['exclude_fields'] ) ) {
99
  // @todo Research using fputcsv to escape fields for export.
100
- if ( in_array( $meta[2], $wp_user_fields ) ){
101
- $data .= '"' . $user_info->{$meta[2]} . '",';
102
  } else {
103
- $data .= '"' . get_user_meta( $user, $meta[2], true ) . '",';
104
  }
105
  }
106
  }
33
  $defaults = array(
34
  'export' => 'all',
35
  'filename' => 'wp-members-user-export-' . $today . '.csv',
36
+ 'export_fields' => wpmem_fields(), //array(),
37
  'exclude_fields' => array( 'password', 'confirm_password', 'confirm_email' ),
38
  );
39
 
63
  // Do the header row.
64
  $hrow = "User ID,Username,";
65
 
66
+ foreach ( $args['export_fields'] as $meta => $field ) {
67
+ if ( ! in_array( $meta, $args['exclude_fields'] ) ) {
68
+ $hrow.= $field['label'] . ",";
69
  }
70
  }
71
 
94
  $data .= '"' . $user_info->ID . '","' . $user_info->user_login . '",';
95
 
96
  $wp_user_fields = array( 'user_email', 'user_nicename', 'user_url', 'display_name' );
97
+ foreach ( $args['export_fields'] as $meta => $field ) {
98
+ if ( ! in_array( $meta, $args['exclude_fields'] ) ) {
99
  // @todo Research using fputcsv to escape fields for export.
100
+ if ( in_array( $meta, $wp_user_fields ) ){
101
+ $data .= '"' . $user_info->{$meta} . '",';
102
  } else {
103
+ $data .= '"' . get_user_meta( $user, $meta, true ) . '",';
104
  }
105
  }
106
  }
admin/user-profile.php CHANGED
@@ -53,7 +53,7 @@ function wpmem_admin_fields() {
53
  <table class="form-table">
54
  <?php
55
  // Get fields.
56
- $wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' );
57
  // Get excluded meta.
58
  $exclude = wpmem_get_excluded_meta( 'admin-profile' );
59
 
@@ -69,33 +69,33 @@ function wpmem_admin_fields() {
69
 
70
  // Assemble form rows array.
71
  $rows = array();
72
- foreach ( $wpmem_fields as $meta ) {
73
 
74
  $valtochk = ''; $values = '';
75
 
76
  // Determine which fields to show in the additional fields area.
77
- $show = ( $meta[6] == 'n' && ! in_array( $meta[2], $exclude ) ) ? true : false;
78
- $show = ( $meta[1] == 'TOS' && $meta[4] != 'y' ) ? null : $show;
79
 
80
  if ( $show ) {
81
 
82
- $val = get_user_meta( $user_id, $meta[2], true );
83
- $val = ( $meta[3] == 'multiselect' || $meta[3] == 'multicheckbox' ) ? $val : htmlspecialchars( $val );
84
- if ( $meta[3] == 'checkbox' ) {
85
  $valtochk = $val;
86
- $val = $meta[7];
87
  }
88
 
89
- if ( 'multicheckbox' == $meta[3] || 'select' == $meta[3] || 'multiselect' == $meta[3] || 'radio' == $meta[3] ) {
90
- $values = $meta[7];
91
  $valtochk = $val;
92
  }
93
 
94
  // Is this an image or a file?
95
- if ( 'file' == $meta[3] || 'image' == $meta[3] ) {
96
  $attachment_url = wp_get_attachment_url( $val );
97
  $empty_file = '<span class="description">' . __( 'None' ) . '</span>';
98
- if ( 'file' == $meta[3] ) {
99
  $input = ( $attachment_url ) ? '<a href="' . $attachment_url . '">' . $attachment_url . '</a>' : $empty_file;
100
  } else {
101
  $input = ( $attachment_url ) ? '<img src="' . $attachment_url . '">' : $empty_file;
@@ -104,29 +104,27 @@ function wpmem_admin_fields() {
104
  //$show_field.= ' <span class="description">' . __( 'Update this file:' ) . '</span><br />';
105
  //$show_field.= wpmem_create_formfield( $meta[2] . '_update_file', $meta[3], $val, $valtochk );
106
  } else {
107
- if ( 'select' == $meta[3] || 'radio' == $meta[3] ) {
108
- $input = wpmem_create_formfield( $meta[2], $meta[3], $values, $valtochk );
109
- } elseif( 'multicheckbox' == $meta[3] || 'multiselect' == $meta[3] ) {
110
- $delimiter = ( isset( $meta[8] ) ) ? $meta[8] : '|';
111
- $input = $wpmem->forms->create_form_field( array( 'name'=>$meta[2], 'type'=>$meta[3], 'value'=>$values, 'compare'=>$valtochk, 'delimiter'=>$delimiter ) );
112
  } else {
113
- $meta[3] = ( 'hidden' == $meta[3] ) ? 'text' : $meta[3];
114
- $input = wpmem_create_formfield( $meta[2], $meta[3], $val, $valtochk );
115
  }
116
  }
117
 
118
  // Is the field required?
119
- $req = ( $meta[5] == 'y' ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
120
- $label = '<label>' . __( $meta[1], 'wp-members' ) . $req . '</label>';
121
 
122
  // Build the form rows for filtering.
123
- $rows[ $meta[2] ] = array(
124
- 'order' => $meta[0],
125
- 'meta' => $meta[2],
126
- 'type' => $meta[3],
127
  'value' => $val,
128
  'values' => $values,
129
- 'label_text' => __( $meta[1], 'wp-members' ),
130
  'row_before' => '',
131
  'label' => $label,
132
  'field_before' => '',
@@ -141,8 +139,23 @@ function wpmem_admin_fields() {
141
  * Filter for rows
142
  *
143
  * @since 3.1.0
 
144
  *
145
- * @param array $rows
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  * @param string $toggle
147
  */
148
  $rows = apply_filters( 'wpmem_register_form_rows_admin', $rows, 'adminprofile' );
@@ -192,7 +205,7 @@ function wpmem_admin_update() {
192
  global $wpmem;
193
 
194
  $user_id = $_REQUEST['user_id'];
195
- $wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' );
196
 
197
  /**
198
  * Fires before the user profile is updated.
@@ -206,22 +219,21 @@ function wpmem_admin_update() {
206
 
207
  $fields = array();
208
  $chk_pass = false;
209
- foreach ( $wpmem_fields as $meta ) {
210
- if ( $meta[6] == "n"
211
- && $meta[3] != 'password'
212
- && $meta[3] != 'checkbox'
213
- && $meta[3] != 'multiselect'
214
- && $meta[3] != 'multicheckbox'
215
- && $meta[3] != 'file'
216
- && $meta[3] != 'image' ) {
217
- ( isset( $_POST[ $meta[2] ] ) ) ? $fields[ $meta[2] ] = $_POST[ $meta[2] ] : false;
218
- } elseif ( $meta[2] == 'password' && $meta[4] == 'y' ) {
219
  $chk_pass = true;
220
- } elseif ( $meta[3] == 'checkbox' ) {
221
- $fields[ $meta[2] ] = ( isset( $_POST[ $meta[2] ] ) ) ? $_POST[ $meta[2] ] : '';
222
- } elseif ( $meta[3] == 'multiselect' || $meta[3] == 'multicheckbox' ) {
223
- $delimiter = ( isset( $meta[8] ) ) ? $meta[8] : '|';
224
- $fields[ $meta[2] ] = ( isset( $_POST[ $meta[2] ] ) ) ? implode( $delimiter, $_POST[ $meta[2] ] ) : '';
225
  }
226
  }
227
 
53
  <table class="form-table">
54
  <?php
55
  // Get fields.
56
+ $wpmem_fields = wpmem_fields();
57
  // Get excluded meta.
58
  $exclude = wpmem_get_excluded_meta( 'admin-profile' );
59
 
69
 
70
  // Assemble form rows array.
71
  $rows = array();
72
+ foreach ( $wpmem_fields as $meta => $field ) {
73
 
74
  $valtochk = ''; $values = '';
75
 
76
  // Determine which fields to show in the additional fields area.
77
+ $show = ( ! $field['native'] && ! in_array( $meta, $exclude ) ) ? true : false;
78
+ $show = ( $field['label'] == 'TOS' && $field['register'] ) ? null : $show;
79
 
80
  if ( $show ) {
81
 
82
+ $val = get_user_meta( $user_id, $meta, true );
83
+ $val = ( $field['type'] == 'multiselect' || $field['type'] == 'multicheckbox' ) ? $val : htmlspecialchars( $val );
84
+ if ( $field['type'] == 'checkbox' ) {
85
  $valtochk = $val;
86
+ $val = $field['checked_value'];
87
  }
88
 
89
+ if ( 'multicheckbox' == $field['type'] || 'select' == $field['type'] || 'multiselect' == $field['type'] || 'radio' == $field['type'] ) {
90
+ $values = $field['values'];
91
  $valtochk = $val;
92
  }
93
 
94
  // Is this an image or a file?
95
+ if ( 'file' == $field['type'] || 'image' == $field['type'] ) {
96
  $attachment_url = wp_get_attachment_url( $val );
97
  $empty_file = '<span class="description">' . __( 'None' ) . '</span>';
98
+ if ( 'file' == $field['type'] ) {
99
  $input = ( $attachment_url ) ? '<a href="' . $attachment_url . '">' . $attachment_url . '</a>' : $empty_file;
100
  } else {
101
  $input = ( $attachment_url ) ? '<img src="' . $attachment_url . '">' : $empty_file;
104
  //$show_field.= ' <span class="description">' . __( 'Update this file:' ) . '</span><br />';
105
  //$show_field.= wpmem_create_formfield( $meta[2] . '_update_file', $meta[3], $val, $valtochk );
106
  } else {
107
+ if ( 'select' == $field['type'] || 'radio' == $field['type'] ) {
108
+ $input = wpmem_create_formfield( $meta, $field['type'], $values, $valtochk );
109
+ } elseif( 'multicheckbox' == $field['type'] || 'multiselect' == $field['type'] ) {
110
+ $input = $wpmem->forms->create_form_field( array( 'name'=>$meta, 'type'=>$field['type'], 'value'=>$values, 'compare'=>$valtochk, 'delimiter'=>$field['delimiter'] ) );
 
111
  } else {
112
+ $field['type'] = ( 'hidden' == $field['type'] ) ? 'text' : $field['type'];
113
+ $input = wpmem_create_formfield( $meta, $field['type'], $val, $valtochk );
114
  }
115
  }
116
 
117
  // Is the field required?
118
+ $req = ( $field['required'] ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
119
+ $label = '<label>' . __( $field['label'], 'wp-members' ) . $req . '</label>';
120
 
121
  // Build the form rows for filtering.
122
+ $rows[ $meta ] = array(
123
+ 'meta' => $meta,
124
+ 'type' => $field['type'],
 
125
  'value' => $val,
126
  'values' => $values,
127
+ 'label_text' => __( $field['label'], 'wp-members' ),
128
  'row_before' => '',
129
  'label' => $label,
130
  'field_before' => '',
139
  * Filter for rows
140
  *
141
  * @since 3.1.0
142
+ * @since 3.1.6 Deprecated $order.
143
  *
144
+ * @param array $rows {
145
+ * An array of the profile rows.
146
+ *
147
+ * @type string $meta The meta key.
148
+ * @type string $type The field type.
149
+ * @type string $value Value if set.
150
+ * @type string $values Possible values (select, multiselect, multicheckbox, radio).
151
+ * @type string $label_text Raw label text (no HTML).
152
+ * @type string $row_before HTML before the row.
153
+ * @type string $label HTML label.
154
+ * @type string $field_before HTML before the field input tag.
155
+ * @type string $field HTML for field input.
156
+ * @type string $field_after HTML after the field.
157
+ * @type string $row_after HTML after the row.
158
+ * }
159
  * @param string $toggle
160
  */
161
  $rows = apply_filters( 'wpmem_register_form_rows_admin', $rows, 'adminprofile' );
205
  global $wpmem;
206
 
207
  $user_id = $_REQUEST['user_id'];
208
+ $wpmem_fields = wpmem_fields();
209
 
210
  /**
211
  * Fires before the user profile is updated.
219
 
220
  $fields = array();
221
  $chk_pass = false;
222
+ foreach ( $wpmem_fields as $meta => $field ) {
223
+ if ( ! $field['native']
224
+ && $field['type'] != 'password'
225
+ && $field['type'] != 'checkbox'
226
+ && $field['type'] != 'multiselect'
227
+ && $field['type'] != 'multicheckbox'
228
+ && $field['type'] != 'file'
229
+ && $field['type'] != 'image' ) {
230
+ ( isset( $_POST[ $meta ] ) ) ? $fields[ $meta ] = $_POST[ $meta ] : false;
231
+ } elseif ( $meta == 'password' && $field['register'] ) {
232
  $chk_pass = true;
233
+ } elseif ( $field['type'] == 'checkbox' ) {
234
+ $fields[ $meta ] = ( isset( $_POST[ $meta ] ) ) ? $_POST[ $meta ] : '';
235
+ } elseif ( $field['type'] == 'multiselect' || $field['type'] == 'multicheckbox' ) {
236
+ $fields[ $meta ] = ( isset( $_POST[ $meta ] ) ) ? implode( $field['delimiter'], $_POST[ $meta ] ) : '';
 
237
  }
238
  }
239
 
admin/users.php CHANGED
@@ -87,7 +87,7 @@ function wpmem_insert_activate_link( $actions, $user_object ) {
87
  if ( $var != 1 ) {
88
  $url = add_query_arg( array( 'action' => 'activate-single', 'user' => $user_object->ID ), "users.php" );
89
  $url = wp_nonce_url( $url, 'activate-user' );
90
- $actions['activate'] = '<a href="' . $url . '">Activate</a>';
91
  }
92
  }
93
  return $actions;
@@ -118,9 +118,9 @@ function wpmem_users_page_load() {
118
  if ( $action == 'activate' || 'activate-single' ) {
119
  // Find out if we need to set passwords.
120
  $chk_pass = false;
121
- $wpmem_fields = get_option( 'wpmembers_fields' );
122
  foreach ( $wpmem_fields as $field ) {
123
- if ( $field[2] == 'password' && $field[4] == 'y' ) {
124
  $chk_pass = true;
125
  break;
126
  }
@@ -330,8 +330,13 @@ function wpmem_users_views( $views ) {
330
  }
331
 
332
  if ( $echolink ) {
333
- $views[$lcas] = "<a href=\"$link\" $curr>$arr[$row] <span class=\"count\"></span></a>";
334
- $views[$lcas].= ( isset( $user_counts[ $lcas ] ) ) ? ' (' . $user_counts[ $lcas ] . ')' : '';
 
 
 
 
 
335
  }
336
  }
337
 
@@ -432,6 +437,7 @@ function wpmem_add_user_column_content( $value, $column_name, $user_id ) {
432
  * user profile update.
433
  *
434
  * @since 2.4
 
435
  *
436
  * @param int $user_id
437
  * @param bool $chk_pass
@@ -463,7 +469,6 @@ function wpmem_a_activate_user( $user_id, $chk_pass = false ) {
463
  }
464
 
465
  // Generate and send user approved email to user.
466
- require_once( WPMEM_PATH . '/inc/email.php' );
467
  wpmem_inc_regemail( $user_id, $new_pass, 2 );
468
 
469
  // Set the active flag in usermeta.
87
  if ( $var != 1 ) {
88
  $url = add_query_arg( array( 'action' => 'activate-single', 'user' => $user_object->ID ), "users.php" );
89
  $url = wp_nonce_url( $url, 'activate-user' );
90
+ $actions['activate'] = '<a href="' . $url . '">' . __( 'Activate', 'wp-members' ) . '</a>';
91
  }
92
  }
93
  return $actions;
118
  if ( $action == 'activate' || 'activate-single' ) {
119
  // Find out if we need to set passwords.
120
  $chk_pass = false;
121
+ $wpmem_fields = wpmem_fields();
122
  foreach ( $wpmem_fields as $field ) {
123
+ if ( $field['type'] == 'password' && $field['register'] ) {
124
  $chk_pass = true;
125
  break;
126
  }
330
  }
331
 
332
  if ( $echolink ) {
333
+ $views[$lcas] = sprintf(
334
+ '<a href="%s" %s>%s <span class="count">(%d)</span></a>',
335
+ $link,
336
+ $curr,
337
+ $arr[$row],
338
+ isset( $user_counts[ $lcas ] ) ? $user_counts[ $lcas ] : ''
339
+ );
340
  }
341
  }
342
 
437
  * user profile update.
438
  *
439
  * @since 2.4
440
+ * @since 3.1.6 Dependencies now loaded by object.
441
  *
442
  * @param int $user_id
443
  * @param bool $chk_pass
469
  }
470
 
471
  // Generate and send user approved email to user.
 
472
  wpmem_inc_regemail( $user_id, $new_pass, 2 );
473
 
474
  // Set the active flag in usermeta.
changelog.txt CHANGED
@@ -1,4 +1,18 @@
1
- = 3.1.4 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  * Change to the way the PayPal extension is integrated with the main plugin. This allows for some necessary filename changes in the extension.
4
  * Added checks for PayPal extension function calls within the main plugin to avoid possible errors if it is deactivated.
1
+ = 3.1.5 =
2
+
3
+ * Addressed some security issues to prevent XSS vulnerabilities.
4
+ * Updated [wpmem_show_count] shortcode to include count of total blog users and users by role. See: http://rkt.bz/xC
5
+ * Updated [wpmem_field] shortcode to accept [wpmem_field meta_key] instead of [wpmem_field field="meta_key"] (although the latter will still work). See http://rkt.bz/ae
6
+ * Updated [wpmem_loginout] shortcode with some improvements to function code and link text attributes. See: http://rkt.bz/29
7
+ * Updated auto excerpt for improved functionality, uses wp_trim_words(), deprecated add_ellipsis, strip_tags, close_tags, parse_shortcodes, strip_shortcodes for filter (these were never documented so it is unlikely that anyone uses them).
8
+ * Updated hidden field type, now allows adding hidden fields to the registration form.
9
+ * Compartmentalized installation of initial settings.
10
+ * Field loader now validates settings, if none exist due to install error it will run the default fields install.
11
+ * Removed dialog setting downgrade on deactivation. Need to re-evaluate necessity of downgrading.
12
+ * Fixed issue with slash handling in Emails tab.
13
+ * Updated [wp-members] deprecated shortcode notice to include post/page information on where the shortcode is being used.
14
+
15
+ = 3.1.4 =
16
 
17
  * Change to the way the PayPal extension is integrated with the main plugin. This allows for some necessary filename changes in the extension.
18
  * Added checks for PayPal extension function calls within the main plugin to avoid possible errors if it is deactivated.
css/generic-rigid.css CHANGED
@@ -184,6 +184,10 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
184
  height: 176px;
185
  padding: 16px 0 2px;
186
  }
 
 
 
 
187
  #wpmem_reg input[type="checkbox"] {
188
  margin-top:18px;
189
  }
184
  height: 176px;
185
  padding: 16px 0 2px;
186
  }
187
+ #wpmem_login label[for="rememberme"] {
188
+ float: none;
189
+ display: initial;
190
+ }
191
  #wpmem_reg input[type="checkbox"] {
192
  margin-top:18px;
193
  }
css/wp-members-2011.css CHANGED
@@ -154,6 +154,14 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
154
  height: 200px;
155
  margin-bottom: 5px;
156
  }
 
 
 
 
 
 
 
 
157
 
158
  #wpmem_reg .form, #wpmem_login .form {
159
  margin:0;
@@ -214,7 +222,8 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
214
  box-shadow: inset 0 1px 3px rgba(204,204,204,0.95);
215
  color: #888;
216
  padding: 10px;
217
- font: 15px; "Helvetica Neue", Arial, sans serif;
 
218
  font-weight: 300;
219
  line-height: 1.625;
220
  }
154
  height: 200px;
155
  margin-bottom: 5px;
156
  }
157
+ #wpmem_login label[for="rememberme"] {
158
+ float: none;
159
+ display: initial;
160
+ background-color: initial;
161
+ padding: initial;
162
+ font-size: initial;
163
+ border: initial;
164
+ }
165
 
166
  #wpmem_reg .form, #wpmem_login .form {
167
  margin:0;
222
  box-shadow: inset 0 1px 3px rgba(204,204,204,0.95);
223
  color: #888;
224
  padding: 10px;
225
+ font-size: 15px;
226
+ font-family: "Helvetica Neue", Arial, sans serif;
227
  font-weight: 300;
228
  line-height: 1.625;
229
  }
css/wp-members-2012.css CHANGED
@@ -141,6 +141,13 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
141
  #wpmem_reg label.select {
142
  padding: 18px 0;
143
  }
 
 
 
 
 
 
 
144
  #wpmem_reg .form, #wpmem_login .form {
145
  margin:0;
146
  padding:0;
141
  #wpmem_reg label.select {
142
  padding: 18px 0;
143
  }
144
+ #wpmem_login label[for="rememberme"] {
145
+ float: none;
146
+ display: initial;
147
+ background-color: initial;
148
+ padding: initial;
149
+ font-size: initial;
150
+ }
151
  #wpmem_reg .form, #wpmem_login .form {
152
  margin:0;
153
  padding:0;
css/wp-members-2013.css CHANGED
@@ -96,6 +96,10 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
96
  #wpmem_reg label.textarea {
97
  height: 190px;
98
  }
 
 
 
 
99
  #wpmem_reg .form, #wpmem_login .form {
100
  margin:0;
101
  padding:0;
96
  #wpmem_reg label.textarea {
97
  height: 190px;
98
  }
99
+ #wpmem_login label[for="rememberme"] {
100
+ float: none;
101
+ display: initial;
102
+ }
103
  #wpmem_reg .form, #wpmem_login .form {
104
  margin:0;
105
  padding:0;
css/wp-members-2014-no-float.css CHANGED
@@ -1,254 +1,254 @@
1
- /**
2
- * WP-Members Styles CSS
3
- *
4
- * CSS for the WP-Members plugin using Twenty Fourteen Theme, no float
5
- *
6
- * This file is part of the WP-Members plugin by Chad Butler
7
- * You can find out more about this plugin at http://rocketgeek.com
8
- * Copyright (c) 2006-2015 Chad Butler
9
- * WP-Members(tm) is a trademark of butlerblog.com
10
- *
11
- * @package WordPress
12
- * @subpackage WP-Members
13
- * @author Chad Butler
14
- * @copyright 2006-2015
15
- */
16
-
17
- /*
18
- This stylesheet is designed to integrate WP-Members with the Twenty Fourteen theme.
19
- There are quite a few examples in here of what you can do to style the forms.
20
- You can build off of this or start from scratch and set your own
21
- custom css for the plugin (set the location in the admin panel).
22
-
23
- See http://rocketgeek.com/tips-and-tricks/setting-up-a-custom-wp-members-stylesheet/
24
- for information on how to set up the plugin with a custom stylesheet.
25
-
26
- For information how to load custom stylesheets with wp_enqueue_style,
27
- see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
28
- */
29
-
30
-
31
- /* Error and Dialog Messages */
32
-
33
- #wpmem_msg, .wpmem_msg {
34
- background: #F9F9F9;
35
- border:1px solid lightGrey;
36
- border-radius: 3px;
37
- padding: 20px 0 0 0;
38
- }
39
- #wpmem_msg {
40
- width: 100%;
41
- }
42
- .wpmem_msg {
43
- width: 74%;
44
- }
45
-
46
-
47
- /* Sidebar Login Widget */
48
-
49
- #wp-members {
50
- width: 100%;
51
- }
52
- #wp-members fieldset {
53
- border:none;
54
- padding:0px
55
- }
56
- #wp-members input {
57
- font-family: inherit;
58
- }
59
- #wp-members input[type="text"],
60
- #wp-members input[type="password"]{
61
- margin: 0 0 4px 0;
62
- width: 92%;
63
- }
64
- #wp-members input[type="submit"] {
65
- padding: 5px 6px 4px;
66
- margin: 0 4px 0 0;
67
- }
68
- #wp-members .button_div {
69
- margin-top:4px;
70
- }
71
- #wp-members .err {
72
- width:100%;
73
- padding: 5px;
74
- font-family: inherit;
75
- border: 1px solid #ccc;
76
- border-radius: 3px;
77
- }
78
-
79
-
80
- /* Login Form and Registration Form */
81
-
82
- #wpmem_reg fieldset,
83
- #wpmem_login fieldset {
84
- border: none;
85
- padding: 0;
86
- margin: 40px 0;
87
- }
88
- #wpmem_reg legend,
89
- #wpmem_login legend {
90
- font-size: 24px;
91
- line-height: 1;
92
- font-weight: 700;
93
- margin-bottom: 10px;
94
- }
95
- #wpmem_reg .form,
96
- #wpmem_login .form {
97
- margin:0;
98
- padding:0;
99
- }
100
- #wpmem_reg .clear,
101
- #wpmem_login .clear {
102
- clear:both;
103
- }
104
- #wpmem_reg .holder,
105
- #wpmem_login .holder {
106
- background-color:#fff;
107
- }
108
- #wpmem_login .div_text,
109
- #wpmem_reg .div_text,
110
- #wpmem_reg .div_textarea,
111
- #wpmem_reg .div_select,
112
- #wpmem_reg .div_checkbox,
113
- #wpmem_reg .div_multicheckbox,
114
- #wpmem_reg .div_multiselect,
115
- #wpmem_reg .div_radio,
116
- #wpmem_reg .div_image,
117
- #wpmem_reg .div_file,
118
- #wpmem_reg .div_url{
119
- width:74%;
120
- margin:0 0 14px 0;
121
- }
122
- #wpmem_login input[type="checkbox"] {
123
- margin: 12px 2px;
124
- }
125
- #wpmem_reg .div_textarea textarea,
126
- #wpmem_reg .textbox,
127
- #wpmem_reg .username,
128
- #wpmem_reg .password,
129
- #wpmem_login .textbox,
130
- #wpmem_login .username,
131
- #wpmem_login .password {
132
- width:100%;
133
- }
134
- #wpmem_reg .dropdown,
135
- #wpmem_reg select,
136
- #wpmem_reg input[type="file"] {
137
- width:100%;
138
- padding: 8px 10px 7px;
139
- border: 1px solid rgba(0, 0, 0, 0.1);
140
- border-radius: 2px;
141
- color: rgb(43, 43, 43);
142
- margin: 5px 0;
143
- }
144
- #wpmem_reg .dropdown:focus {
145
- border: 1px solid rgba(0, 0, 0, 0.3);
146
- outline: 0;
147
- }
148
- #wpmem_reg .textbox:focus, #wpmem_reg .textbox:hover, #wpmem_login .textbox:focus, #wpmem_login .textbox:hover,
149
- #wpmem_reg .username:focus, #wpmem_reg .username:hover, #wpmem_login .username:focus, #wpmem_login .username:hover,
150
- #wpmem_reg .password:focus, #wpmem_reg .password:hover, #wpmem_login .password:focus, #wpmem_login .password:hover {
151
- background-color:inherit;
152
- }
153
- #wpmem_reg textarea {
154
- height:185px;
155
- }
156
- #wpmem_reg .req {
157
- color: #bd3500;
158
- font-size: 22px;
159
- line-height: 50%;
160
- }
161
-
162
- #wpmem_reg .req-text {
163
- margin: 20px 0px 0px 5px;
164
- }
165
-
166
- #wpmem_reg .noinput {
167
- width:94%;
168
- padding: 8px 10px 7px;
169
- border: 1px solid rgba(0, 0, 0, 0.1);
170
- border-radius: 2px;
171
- color: rgb(43, 43, 43);
172
- margin: 5px 0;
173
- }
174
-
175
- #wpmem_reg .captcha {
176
- width: 74%;
177
- margin: 5px 0px;
178
- }
179
- #wpmem_reg .captcha table{
180
- line-height: 0px;
181
- }
182
- #wpmem_login .link-text {
183
- width: 74%;
184
- text-align:right;
185
- }
186
-
187
- #tos {
188
- margin-right:5px;
189
- }
190
-
191
-
192
- /* Buttons */
193
-
194
- #wpmem_reg .button_div,
195
- #wpmem_login .button_div {
196
- width:74%;
197
- height:35px;
198
- padding: 6px 0;
199
- text-align: right;
200
- }
201
-
202
-
203
- /** for smaller screens */
204
-
205
- @media screen and (max-width: 1079px) {
206
- #wp-members .button_div {
207
- text-align:center;
208
- }
209
- #wp-members input[type="submit"] {
210
- width: 92%;
211
- margin: 0 10px 6px 0;
212
- }
213
- }
214
-
215
- @media screen and (max-width: 1007px) {
216
- #wp-members {
217
- width: 179px;
218
- }
219
- #wp-members .button_div {
220
- text-align: inherit;
221
- }
222
- #wp-members input[type="submit"] {
223
- width: inherit;
224
- margin: 0 4px 0 0;
225
- }
226
- }
227
-
228
- @media screen and (max-width: 720px) {
229
- #wpmem_reg label.text, #wpmem_reg label.checkbox,
230
- #wpmem_reg label.textarea , #wpmem_reg label.select,
231
- #wpmem_login label, #wpmem_reg .div_text, #wpmem_reg .div_textarea,
232
- #wpmem_reg .div_select, #wpmem_login .div_text,
233
- #wpmem_reg .div_checkbox, #wpmem_reg .button_div, #wpmem_login .button_div {
234
- float: none;
235
- }
236
-
237
- #wpmem_reg label.text, #wpmem_reg label.checkbox,
238
- #wpmem_reg label.textarea , #wpmem_reg label.select,
239
- #wpmem_login label {
240
- width: 90%;
241
- padding: 5px 0 0 0;
242
- }
243
- #wpmem_reg label.textarea {
244
- height: 26px;
245
- }
246
- #wpmem_reg .div_text, #wpmem_reg .div_textarea,
247
- #wpmem_reg .div_select, #wpmem_login .div_text,
248
- #wpmem_reg .div_checkbox {
249
- width: 98%;
250
- }
251
- #wpmem_msg, .wpmem_msg {
252
- width: 100%;
253
- }
254
  }
1
+ /**
2
+ * WP-Members Styles CSS
3
+ *
4
+ * CSS for the WP-Members plugin using Twenty Fourteen Theme, no float
5
+ *
6
+ * This file is part of the WP-Members plugin by Chad Butler
7
+ * You can find out more about this plugin at http://rocketgeek.com
8
+ * Copyright (c) 2006-2015 Chad Butler
9
+ * WP-Members(tm) is a trademark of butlerblog.com
10
+ *
11
+ * @package WordPress
12
+ * @subpackage WP-Members
13
+ * @author Chad Butler
14
+ * @copyright 2006-2015
15
+ */
16
+
17
+ /*
18
+ This stylesheet is designed to integrate WP-Members with the Twenty Fourteen theme.
19
+ There are quite a few examples in here of what you can do to style the forms.
20
+ You can build off of this or start from scratch and set your own
21
+ custom css for the plugin (set the location in the admin panel).
22
+
23
+ See http://rocketgeek.com/tips-and-tricks/setting-up-a-custom-wp-members-stylesheet/
24
+ for information on how to set up the plugin with a custom stylesheet.
25
+
26
+ For information how to load custom stylesheets with wp_enqueue_style,
27
+ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
28
+ */
29
+
30
+
31
+ /* Error and Dialog Messages */
32
+
33
+ #wpmem_msg, .wpmem_msg {
34
+ background: #F9F9F9;
35
+ border:1px solid lightGrey;
36
+ border-radius: 3px;
37
+ padding: 20px 0 0 0;
38
+ }
39
+ #wpmem_msg {
40
+ width: 100%;
41
+ }
42
+ .wpmem_msg {
43
+ width: 74%;
44
+ }
45
+
46
+
47
+ /* Sidebar Login Widget */
48
+
49
+ #wp-members {
50
+ width: 100%;
51
+ }
52
+ #wp-members fieldset {
53
+ border:none;
54
+ padding:0px
55
+ }
56
+ #wp-members input {
57
+ font-family: inherit;
58
+ }
59
+ #wp-members input[type="text"],
60
+ #wp-members input[type="password"]{
61
+ margin: 0 0 4px 0;
62
+ width: 92%;
63
+ }
64
+ #wp-members input[type="submit"] {
65
+ padding: 5px 6px 4px;
66
+ margin: 0 4px 0 0;
67
+ }
68
+ #wp-members .button_div {
69
+ margin-top:4px;
70
+ }
71
+ #wp-members .err {
72
+ width:100%;
73
+ padding: 5px;
74
+ font-family: inherit;
75
+ border: 1px solid #ccc;
76
+ border-radius: 3px;
77
+ }
78
+
79
+
80
+ /* Login Form and Registration Form */
81
+
82
+ #wpmem_reg fieldset,
83
+ #wpmem_login fieldset {
84
+ border: none;
85
+ padding: 0;
86
+ margin: 40px 0;
87
+ }
88
+ #wpmem_reg legend,
89
+ #wpmem_login legend {
90
+ font-size: 24px;
91
+ line-height: 1;
92
+ font-weight: 700;
93
+ margin-bottom: 10px;
94
+ }
95
+ #wpmem_reg .form,
96
+ #wpmem_login .form {
97
+ margin:0;
98
+ padding:0;
99
+ }
100
+ #wpmem_reg .clear,
101
+ #wpmem_login .clear {
102
+ clear:both;
103
+ }
104
+ #wpmem_reg .holder,
105
+ #wpmem_login .holder {
106
+ background-color:#fff;
107
+ }
108
+ #wpmem_login .div_text,
109
+ #wpmem_reg .div_text,
110
+ #wpmem_reg .div_textarea,
111
+ #wpmem_reg .div_select,
112
+ #wpmem_reg .div_checkbox,
113
+ #wpmem_reg .div_multicheckbox,
114
+ #wpmem_reg .div_multiselect,
115
+ #wpmem_reg .div_radio,
116
+ #wpmem_reg .div_image,
117
+ #wpmem_reg .div_file,
118
+ #wpmem_reg .div_url{
119
+ width:74%;
120
+ margin:0 0 14px 0;
121
+ }
122
+ #wpmem_login input[type="checkbox"] {
123
+ margin: 12px 2px;
124
+ }
125
+ #wpmem_reg .div_textarea textarea,
126
+ #wpmem_reg .textbox,
127
+ #wpmem_reg .username,
128
+ #wpmem_reg .password,
129
+ #wpmem_login .textbox,
130
+ #wpmem_login .username,
131
+ #wpmem_login .password {
132
+ width:100%;
133
+ }
134
+ #wpmem_reg .dropdown,
135
+ #wpmem_reg select,
136
+ #wpmem_reg input[type="file"] {
137
+ width:100%;
138
+ padding: 8px 10px 7px;
139
+ border: 1px solid rgba(0, 0, 0, 0.1);
140
+ border-radius: 2px;
141
+ color: rgb(43, 43, 43);
142
+ margin: 5px 0;
143
+ }
144
+ #wpmem_reg .dropdown:focus {
145
+ border: 1px solid rgba(0, 0, 0, 0.3);
146
+ outline: 0;
147
+ }
148
+ #wpmem_reg .textbox:focus, #wpmem_reg .textbox:hover, #wpmem_login .textbox:focus, #wpmem_login .textbox:hover,
149
+ #wpmem_reg .username:focus, #wpmem_reg .username:hover, #wpmem_login .username:focus, #wpmem_login .username:hover,
150
+ #wpmem_reg .password:focus, #wpmem_reg .password:hover, #wpmem_login .password:focus, #wpmem_login .password:hover {
151
+ background-color:inherit;
152
+ }
153
+ #wpmem_reg textarea {
154
+ height:185px;
155
+ }
156
+ #wpmem_reg .req {
157
+ color: #bd3500;
158
+ font-size: 22px;
159
+ line-height: 50%;
160
+ }
161
+
162
+ #wpmem_reg .req-text {
163
+ margin: 20px 0px 0px 5px;
164
+ }
165
+
166
+ #wpmem_reg .noinput {
167
+ width:94%;
168
+ padding: 8px 10px 7px;
169
+ border: 1px solid rgba(0, 0, 0, 0.1);
170
+ border-radius: 2px;
171
+ color: rgb(43, 43, 43);
172
+ margin: 5px 0;
173
+ }
174
+
175
+ #wpmem_reg .captcha {
176
+ width: 74%;
177
+ margin: 5px 0px;
178
+ }
179
+ #wpmem_reg .captcha table{
180
+ line-height: 0px;
181
+ }
182
+ #wpmem_login .link-text {
183
+ width: 74%;
184
+ text-align:right;
185
+ }
186
+
187
+ #tos {
188
+ margin-right:5px;
189
+ }
190
+
191
+
192
+ /* Buttons */
193
+
194
+ #wpmem_reg .button_div,
195
+ #wpmem_login .button_div {
196
+ width:74%;
197
+ height:35px;
198
+ padding: 6px 0;
199
+ text-align: right;
200
+ }
201
+
202
+
203
+ /** for smaller screens */
204
+
205
+ @media screen and (max-width: 1079px) {
206
+ #wp-members .button_div {
207
+ text-align:center;
208
+ }
209
+ #wp-members input[type="submit"] {
210
+ width: 92%;
211
+ margin: 0 10px 6px 0;
212
+ }
213
+ }
214
+
215
+ @media screen and (max-width: 1007px) {
216
+ #wp-members {
217
+ width: 179px;
218
+ }
219
+ #wp-members .button_div {
220
+ text-align: inherit;
221
+ }
222
+ #wp-members input[type="submit"] {
223
+ width: inherit;
224
+ margin: 0 4px 0 0;
225
+ }
226
+ }
227
+
228
+ @media screen and (max-width: 720px) {
229
+ #wpmem_reg label.text, #wpmem_reg label.checkbox,
230
+ #wpmem_reg label.textarea , #wpmem_reg label.select,
231
+ #wpmem_login label, #wpmem_reg .div_text, #wpmem_reg .div_textarea,
232
+ #wpmem_reg .div_select, #wpmem_login .div_text,
233
+ #wpmem_reg .div_checkbox, #wpmem_reg .button_div, #wpmem_login .button_div {
234
+ float: none;
235
+ }
236
+
237
+ #wpmem_reg label.text, #wpmem_reg label.checkbox,
238
+ #wpmem_reg label.textarea , #wpmem_reg label.select,
239
+ #wpmem_login label {
240
+ width: 90%;
241
+ padding: 5px 0 0 0;
242
+ }
243
+ #wpmem_reg label.textarea {
244
+ height: 26px;
245
+ }
246
+ #wpmem_reg .div_text, #wpmem_reg .div_textarea,
247
+ #wpmem_reg .div_select, #wpmem_login .div_text,
248
+ #wpmem_reg .div_checkbox {
249
+ width: 98%;
250
+ }
251
+ #wpmem_msg, .wpmem_msg {
252
+ width: 100%;
253
+ }
254
  }
css/wp-members-2014.css CHANGED
@@ -104,6 +104,10 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
104
  height: 176px;
105
  padding: 9px 0;
106
  }
 
 
 
 
107
  #wpmem_reg .form, #wpmem_login .form {
108
  margin:0;
109
  padding:0;
104
  height: 176px;
105
  padding: 9px 0;
106
  }
107
+ #wpmem_login label[for="rememberme"] {
108
+ display: initial;
109
+ float: none;
110
+ }
111
  #wpmem_reg .form, #wpmem_login .form {
112
  margin:0;
113
  padding:0;
css/wp-members-2015-no-float.css CHANGED
@@ -1,250 +1,254 @@
1
- /**
2
- * WP-Members Styles CSS
3
- *
4
- * CSS for the WP-Members plugin - Twenty Fifteen Theme, No Float
5
- *
6
- * This file is part of the WP-Members plugin by Chad Butler
7
- * You can find out more about this plugin at http://rocketgeek.com
8
- * Copyright (c) 2006-2015 Chad Butler
9
- * WP-Members(tm) is a trademark of butlerblog.com
10
- *
11
- * @package WordPress
12
- * @subpackage WP-Members
13
- * @author Chad Butler
14
- * @copyright 2006-2015
15
- */
16
-
17
- /*
18
- This stylesheet is designed to integrate WP-Members floated form elements
19
- as simply as possible with most themes. There are quite a few examples
20
- in here of what you can do to style the forms. You can build off of this
21
- or start from scratch and set your own custom css for the plugin
22
- (set the location in the admin panel).
23
-
24
- See http://rocketgeek.com/tips-and-tricks/setting-up-a-custom-wp-members-stylesheet/
25
- for information on how to set up the plugin with a custom stylesheet.
26
-
27
- For information how to load custom stylesheets with wp_enqueue_style,
28
- see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
29
- */
30
-
31
-
32
- /* Error and Dialog Messages */
33
-
34
- #wpmem_msg, .wpmem_msg {
35
- background: #F7F7F7;
36
- border: 1px solid rgba(51, 51, 51, 0.3);
37
- padding: 0;
38
- }
39
- #wpmem_msg h2 {
40
- margin: 0;
41
- padding: 30px;
42
- }
43
- #wpmem_msg {
44
- width: 100%;
45
- }
46
- .wpmem_msg {
47
- margin: 0;
48
- padding: 32px 26px 4px;
49
- }
50
-
51
-
52
- /* Sidebar Login Widget */
53
-
54
- #wp-members {
55
- width: 100%;
56
- }
57
- #wp-members fieldset {
58
- border: none;
59
- padding: 10px 0 0 0;
60
- }
61
- #wp-members input {
62
- font-family: inherit;
63
- }
64
- #wp-members input[type="text"],
65
- #wp-members input[type="password"]{
66
- margin: 0 0 8px 0;
67
- }
68
- #wp-members input[type="submit"] {
69
- padding: 5px 10px;
70
- margin: 0 6px 0 0;
71
- }
72
- #wp-members .button_div {
73
- margin-top: 8px;
74
- }
75
- #wp-members .err {
76
- width:100%;
77
- padding: 5px;
78
- font-family: inherit;
79
- background: #F7F7F7;
80
- border: 1px solid rgba(51, 51, 51, 0.3);
81
- }
82
-
83
-
84
- /* Login Form and Registration Form */
85
-
86
- #wpmem_reg label,
87
- #wpmem_login label {
88
- font-size: 1.6rem;
89
- color: #707070;
90
- color: rgba(51, 51, 51, 0.7);
91
- font-family: "Noto Sans", sans-serif;
92
- font-weight: 700;
93
- display: block;
94
- letter-spacing: 0.04em;
95
- line-height: 1.5;
96
- text-transform: uppercase;
97
- margin-bottom: 6px;
98
- }
99
-
100
- #wpmem_reg select,
101
- #wpmem_reg input[type="file"] {
102
- width:100%;
103
- padding: 8px 10px 7px;
104
- border: 1px solid rgba(0, 0, 0, 0.1);
105
- margin: 5px 0;
106
- }
107
-
108
- #wpmem_reg fieldset,
109
- #wpmem_login fieldset {
110
- border: none;
111
- padding: 0;
112
- margin: 40px 0;
113
- }
114
- #wpmem_reg legend,
115
- #wpmem_login legend {
116
- font-weight: 700;
117
- margin-bottom: 25px;
118
- font-size: 27px;
119
- font-size: 2.7rem;
120
- line-height: 1.1852;
121
- }
122
- #wpmem_reg .form,
123
- #wpmem_login .form {
124
- margin:0;
125
- padding:0;
126
- }
127
- #wpmem_reg .clear,
128
- #wpmem_login .clear {
129
- clear:both;
130
- }
131
- #wpmem_reg .holder,
132
- #wpmem_login .holder {
133
- background-color:#fff;
134
- }
135
- #wpmem_login .div_text,
136
- #wpmem_reg .div_text,
137
- #wpmem_reg .div_textarea,
138
- #wpmem_reg .div_select,
139
- #wpmem_reg .div_checkbox,
140
- #wpmem_reg .div_multicheckbox,
141
- #wpmem_reg .div_multiselect,
142
- #wpmem_reg .div_radio,
143
- #wpmem_reg .div_url,
144
- #wpmem_reg .div_image,
145
- #wpmem_reg .div_file {
146
- width:74%;
147
- margin:0 0 14px 0;
148
- }
149
- #wpmem_login input[type="checkbox"] {
150
- margin: 12px 2px;
151
- }
152
- #wpmem_reg .div_textarea textarea,
153
- #wpmem_reg .textbox,
154
- #wpmem_reg .username,
155
- #wpmem_reg .password,
156
- #wpmem_reg input[type="file"],
157
- #wpmem_login .textbox,
158
- #wpmem_login .username,
159
- #wpmem_login .password {
160
- width:100%;
161
- }
162
-
163
-
164
- #wpmem_reg textarea {
165
- height:185px;
166
- }
167
- #wpmem_reg .req {
168
- color: #bd3500;
169
- font-size: 22px;
170
- line-height: 50%;
171
- }
172
-
173
- #wpmem_reg .req-text {
174
- margin: 20px 0px 0px 5px;
175
- }
176
-
177
- #wpmem_reg .noinput {
178
- width:100%;
179
- padding: 8px 10px 7px;
180
- border: 1px solid rgba(0, 0, 0, 0.1);
181
- border-radius: 2px;
182
- color: rgb(43, 43, 43);
183
- margin: 5px 0;
184
- }
185
-
186
- #wpmem_reg .captcha {
187
- width: 74%;
188
- margin: 5px 0px;
189
- }
190
- #wpmem_reg .captcha table{
191
- line-height: 0px;
192
- }
193
- #wpmem_login .link-text {
194
- width: 74%;
195
- margin: 4px 0;
196
- text-align: right;
197
- }
198
-
199
- #tos {
200
- margin-right:5px;
201
- }
202
-
203
-
204
- /* Buttons */
205
-
206
- #wpmem_reg .button_div,
207
- #wpmem_login .button_div {
208
- width:74%;
209
- height: 62px;
210
- padding: 6px 0;
211
- text-align: right;
212
- }
213
-
214
-
215
- /** for smaller screens */
216
-
217
- @media screen and (max-width: 720px) {
218
- #wpmem_reg label.text, #wpmem_reg label.checkbox,
219
- #wpmem_reg label.textarea , #wpmem_reg label.select,
220
- #wpmem_login label, #wpmem_reg .div_text, #wpmem_reg .div_textarea,
221
- #wpmem_reg .div_select, #wpmem_login .div_text,
222
- #wpmem_reg .div_checkbox, #wpmem_reg .button_div, #wpmem_login .button_div {
223
- float: none;
224
- }
225
-
226
- #wpmem_reg label.text, #wpmem_reg label.checkbox,
227
- #wpmem_reg label.textarea , #wpmem_reg label.select,
228
- #wpmem_login label {
229
- width: 90%;
230
- padding: 5px 0 0 0;
231
- }
232
- #wpmem_reg label.textarea {
233
- height: 26px;
234
- }
235
- #wpmem_reg .div_text, #wpmem_reg .div_textarea,
236
- #wpmem_reg .div_select, #wpmem_login .div_text,
237
- #wpmem_reg .div_checkbox {
238
- width: 98%;
239
- font-size: 80%;
240
- }
241
- #wpmem_msg, .wpmem_msg {
242
- width: 100%;
243
- }
244
-
245
- #wpmem_reg .button_div,
246
- #wpmem_login .button_div,
247
- #wpmem_login .link-text {
248
- width:98%;
249
- }
 
 
 
 
250
  }
1
+ /**
2
+ * WP-Members Styles CSS
3
+ *
4
+ * CSS for the WP-Members plugin - Twenty Fifteen Theme, No Float
5
+ *
6
+ * This file is part of the WP-Members plugin by Chad Butler
7
+ * You can find out more about this plugin at http://rocketgeek.com
8
+ * Copyright (c) 2006-2015 Chad Butler
9
+ * WP-Members(tm) is a trademark of butlerblog.com
10
+ *
11
+ * @package WordPress
12
+ * @subpackage WP-Members
13
+ * @author Chad Butler
14
+ * @copyright 2006-2015
15
+ */
16
+
17
+ /*
18
+ This stylesheet is designed to integrate WP-Members floated form elements
19
+ as simply as possible with most themes. There are quite a few examples
20
+ in here of what you can do to style the forms. You can build off of this
21
+ or start from scratch and set your own custom css for the plugin
22
+ (set the location in the admin panel).
23
+
24
+ See http://rocketgeek.com/tips-and-tricks/setting-up-a-custom-wp-members-stylesheet/
25
+ for information on how to set up the plugin with a custom stylesheet.
26
+
27
+ For information how to load custom stylesheets with wp_enqueue_style,
28
+ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
29
+ */
30
+
31
+
32
+ /* Error and Dialog Messages */
33
+
34
+ #wpmem_msg, .wpmem_msg {
35
+ background: #F7F7F7;
36
+ border: 1px solid rgba(51, 51, 51, 0.3);
37
+ padding: 0;
38
+ }
39
+ #wpmem_msg h2 {
40
+ margin: 0;
41
+ padding: 30px;
42
+ }
43
+ #wpmem_msg {
44
+ width: 100%;
45
+ }
46
+ .wpmem_msg {
47
+ margin: 0;
48
+ padding: 32px 26px 4px;
49
+ }
50
+
51
+
52
+ /* Sidebar Login Widget */
53
+
54
+ #wp-members {
55
+ width: 100%;
56
+ }
57
+ #wp-members fieldset {
58
+ border: none;
59
+ padding: 10px 0 0 0;
60
+ }
61
+ #wp-members input {
62
+ font-family: inherit;
63
+ }
64
+ #wp-members input[type="text"],
65
+ #wp-members input[type="password"]{
66
+ margin: 0 0 8px 0;
67
+ }
68
+ #wp-members input[type="submit"] {
69
+ padding: 5px 10px;
70
+ margin: 0 6px 0 0;
71
+ }
72
+ #wp-members .button_div {
73
+ margin-top: 8px;
74
+ }
75
+ #wp-members .err {
76
+ width:100%;
77
+ padding: 5px;
78
+ font-family: inherit;
79
+ background: #F7F7F7;
80
+ border: 1px solid rgba(51, 51, 51, 0.3);
81
+ }
82
+
83
+
84
+ /* Login Form and Registration Form */
85
+
86
+ #wpmem_reg label,
87
+ #wpmem_login label {
88
+ font-size: 1.6rem;
89
+ color: #707070;
90
+ color: rgba(51, 51, 51, 0.7);
91
+ font-family: "Noto Sans", sans-serif;
92
+ font-weight: 700;
93
+ display: block;
94
+ letter-spacing: 0.04em;
95
+ line-height: 1.5;
96
+ text-transform: uppercase;
97
+ margin-bottom: 6px;
98
+ }
99
+ #wpmem_login label[for="rememberme"] {
100
+ float: none;
101
+ display: initial;
102
+ }
103
+
104
+ #wpmem_reg select,
105
+ #wpmem_reg input[type="file"] {
106
+ width:100%;
107
+ padding: 8px 10px 7px;
108
+ border: 1px solid rgba(0, 0, 0, 0.1);
109
+ margin: 5px 0;
110
+ }
111
+
112
+ #wpmem_reg fieldset,
113
+ #wpmem_login fieldset {
114
+ border: none;
115
+ padding: 0;
116
+ margin: 40px 0;
117
+ }
118
+ #wpmem_reg legend,
119
+ #wpmem_login legend {
120
+ font-weight: 700;
121
+ margin-bottom: 25px;
122
+ font-size: 27px;
123
+ font-size: 2.7rem;
124
+ line-height: 1.1852;
125
+ }
126
+ #wpmem_reg .form,
127
+ #wpmem_login .form {
128
+ margin:0;
129
+ padding:0;
130
+ }
131
+ #wpmem_reg .clear,
132
+ #wpmem_login .clear {
133
+ clear:both;
134
+ }
135
+ #wpmem_reg .holder,
136
+ #wpmem_login .holder {
137
+ background-color:#fff;
138
+ }
139
+ #wpmem_login .div_text,
140
+ #wpmem_reg .div_text,
141
+ #wpmem_reg .div_textarea,
142
+ #wpmem_reg .div_select,
143
+ #wpmem_reg .div_checkbox,
144
+ #wpmem_reg .div_multicheckbox,
145
+ #wpmem_reg .div_multiselect,
146
+ #wpmem_reg .div_radio,
147
+ #wpmem_reg .div_url,
148
+ #wpmem_reg .div_image,
149
+ #wpmem_reg .div_file {
150
+ width:74%;
151
+ margin:0 0 14px 0;
152
+ }
153
+ #wpmem_login input[type="checkbox"] {
154
+ margin: 12px 2px;
155
+ }
156
+ #wpmem_reg .div_textarea textarea,
157
+ #wpmem_reg .textbox,
158
+ #wpmem_reg .username,
159
+ #wpmem_reg .password,
160
+ #wpmem_reg input[type="file"],
161
+ #wpmem_login .textbox,
162
+ #wpmem_login .username,
163
+ #wpmem_login .password {
164
+ width:100%;
165
+ }
166
+
167
+
168
+ #wpmem_reg textarea {
169
+ height:185px;
170
+ }
171
+ #wpmem_reg .req {
172
+ color: #bd3500;
173
+ font-size: 22px;
174
+ line-height: 50%;
175
+ }
176
+
177
+ #wpmem_reg .req-text {
178
+ margin: 20px 0px 0px 5px;
179
+ }
180
+
181
+ #wpmem_reg .noinput {
182
+ width:100%;
183
+ padding: 8px 10px 7px;
184
+ border: 1px solid rgba(0, 0, 0, 0.1);
185
+ border-radius: 2px;
186
+ color: rgb(43, 43, 43);
187
+ margin: 5px 0;
188
+ }
189
+
190
+ #wpmem_reg .captcha {
191
+ width: 74%;
192
+ margin: 5px 0px;
193
+ }
194
+ #wpmem_reg .captcha table{
195
+ line-height: 0px;
196
+ }
197
+ #wpmem_login .link-text {
198
+ width: 74%;
199
+ margin: 4px 0;
200
+ text-align: right;
201
+ }
202
+
203
+ #tos {
204
+ margin-right:5px;
205
+ }
206
+
207
+
208
+ /* Buttons */
209
+
210
+ #wpmem_reg .button_div,
211
+ #wpmem_login .button_div {
212
+ width:74%;
213
+ height: 62px;
214
+ padding: 6px 0;
215
+ text-align: right;
216
+ }
217
+
218
+
219
+ /** for smaller screens */
220
+
221
+ @media screen and (max-width: 720px) {
222
+ #wpmem_reg label.text, #wpmem_reg label.checkbox,
223
+ #wpmem_reg label.textarea , #wpmem_reg label.select,
224
+ #wpmem_login label, #wpmem_reg .div_text, #wpmem_reg .div_textarea,
225
+ #wpmem_reg .div_select, #wpmem_login .div_text,
226
+ #wpmem_reg .div_checkbox, #wpmem_reg .button_div, #wpmem_login .button_div {
227
+ float: none;
228
+ }
229
+
230
+ #wpmem_reg label.text, #wpmem_reg label.checkbox,
231
+ #wpmem_reg label.textarea , #wpmem_reg label.select,
232
+ #wpmem_login label {
233
+ width: 90%;
234
+ padding: 5px 0 0 0;
235
+ }
236
+ #wpmem_reg label.textarea {
237
+ height: 26px;
238
+ }
239
+ #wpmem_reg .div_text, #wpmem_reg .div_textarea,
240
+ #wpmem_reg .div_select, #wpmem_login .div_text,
241
+ #wpmem_reg .div_checkbox {
242
+ width: 98%;
243
+ font-size: 80%;
244
+ }
245
+ #wpmem_msg, .wpmem_msg {
246
+ width: 100%;
247
+ }
248
+
249
+ #wpmem_reg .button_div,
250
+ #wpmem_login .button_div,
251
+ #wpmem_login .link-text {
252
+ width:98%;
253
+ }
254
  }
css/wp-members-2015.css CHANGED
@@ -127,6 +127,10 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
127
  #wpmem_reg label.textarea {
128
  height: 185px;
129
  }
 
 
 
 
130
  #wpmem_reg .form, #wpmem_login .form {
131
  margin:0;
132
  padding:0;
127
  #wpmem_reg label.textarea {
128
  height: 185px;
129
  }
130
+ #wpmem_login label[for="rememberme"] {
131
+ float: none;
132
+ display: initial;
133
+ }
134
  #wpmem_reg .form, #wpmem_login .form {
135
  margin:0;
136
  padding:0;
css/wp-members-2016-no-float.css CHANGED
@@ -1,288 +1,292 @@
1
- /**
2
- * WP-Members Styles CSS
3
- *
4
- * CSS for the WP-Members plugin using Twenty Sixteen Theme, no float
5
- *
6
- * This file is part of the WP-Members plugin by Chad Butler
7
- * You can find out more about this plugin at http://rocketgeek.com
8
- * Copyright (c) 2006-2015 Chad Butler
9
- * WP-Members(tm) is a trademark of butlerblog.com
10
- *
11
- * @package WordPress
12
- * @subpackage WP-Members
13
- * @author Chad Butler
14
- * @copyright 2006-2015
15
- */
16
-
17
- /*
18
- This stylesheet is designed to integrate WP-Members with the Twenty Fourteen theme.
19
- There are quite a few examples in here of what you can do to style the forms.
20
- You can build off of this or start from scratch and set your own
21
- custom css for the plugin (set the location in the admin panel).
22
-
23
- See http://rocketgeek.com/tips-and-tricks/setting-up-a-custom-wp-members-stylesheet/
24
- for information on how to set up the plugin with a custom stylesheet.
25
-
26
- For information how to load custom stylesheets with wp_enqueue_style,
27
- see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
28
- */
29
-
30
-
31
- /* Error and Dialog Messages */
32
-
33
- #wpmem_msg, .wpmem_msg {
34
- background: #F9F9F9;
35
- border:1px solid lightGrey;
36
- border-radius: 3px;
37
- padding: 20px 0 0 0;
38
- }
39
- #wpmem_msg {
40
- width: 100%;
41
- }
42
- #wpmem_msg h2 {
43
- font-family: Montserrat, "Helvetica Neue", sans-serif;
44
- }
45
- .wpmem_msg {
46
- width: 74%;
47
- }
48
- .wpmem_msg p {
49
- margin: 0 0 1.3em;
50
- }
51
-
52
- /* Sidebar Login Widget */
53
-
54
- #wp-members {
55
- width: 100%;
56
- }
57
- #wp-members fieldset {
58
- border:none;
59
- padding:0px
60
- }
61
- #wp-members label {
62
- font-family: Montserrat, "Helvetica Neue", sans-serif;
63
- color: #686868;
64
- display: block;
65
- font-size: 13px;
66
- font-size: 0.8125rem;
67
- letter-spacing: 0.076923077em;
68
- line-height: 1.6153846154;
69
- margin-bottom: 0.5384615385em;
70
- text-transform: uppercase;
71
- }
72
- #wp-members input {
73
- font-family: Merriweather, Georgia, serif;
74
- }
75
- #wp-members input[type="text"],
76
- #wp-members input[type="password"]{
77
- margin: 0 0 4px 0;
78
- width: 92%;
79
- }
80
- #wp-members input[type="submit"] {
81
- font-family: Montserrat, "Helvetica Neue", sans-serif;
82
- padding: 10px 10px 8px;
83
- margin: 0 4px 0 0;
84
- }
85
- #wp-members .button_div {
86
- margin-top:4px;
87
- }
88
- #wp-members .err {
89
- width:92%;
90
- padding: 5px;
91
- font-family: inherit;
92
- border: 1px solid #ccc;
93
- border-radius: 3px;
94
- }
95
-
96
-
97
- /* Login Form and Registration Form */
98
-
99
- #wpmem_reg fieldset,
100
- #wpmem_login fieldset {
101
- border: none;
102
- padding: 0;
103
- margin: 40px 0;
104
- }
105
- #wpmem_reg legend,
106
- #wpmem_login legend {
107
- border-top: 4px solid #1a1a1a;
108
- font-family: Montserrat, "Helvetica Neue", sans-serif;
109
- font-size: 23px;
110
- font-size: 1.4375rem;
111
- font-weight: 700;
112
- line-height: 1.3125;
113
- padding-top: 1.217391304em;
114
- padding-bottom: 1.75em;
115
- box-sizing: inherit;
116
- width: 100%;
117
- }
118
- #wpmem_reg label,
119
- #wpmem_login label {
120
- color: #686868;
121
- display: block;
122
- font-family: Montserrat, "Helvetica Neue", sans-serif;
123
- font-size: 13px;
124
- font-size: 0.8125rem;
125
- letter-spacing: 0.076923077em;
126
- line-height: 1.6153846154;
127
- margin-bottom: 0.5384615385em;
128
- text-transform: uppercase;
129
- }
130
- #wpmem_reg .form,
131
- #wpmem_login .form {
132
- margin:0;
133
- padding:0;
134
- }
135
- #wpmem_reg .clear,
136
- #wpmem_login .clear {
137
- clear:both;
138
- }
139
- #wpmem_reg .holder,
140
- #wpmem_login .holder {
141
- background-color:#fff;
142
- }
143
- #wpmem_login .div_text,
144
- #wpmem_reg .div_text,
145
- #wpmem_reg .div_textarea,
146
- #wpmem_reg .div_select,
147
- #wpmem_reg .div_checkbox,
148
- #wpmem_reg .div_multicheckbox,
149
- #wpmem_reg .div_multiselect,
150
- #wpmem_reg .div_radio,
151
- #wpmem_reg .div_url,
152
- #wpmem_reg .div_file,
153
- #wpmem_reg .div_image {
154
- width:74%;
155
- margin:0 0 14px 0;
156
- }
157
- #wpmem_login input[type="checkbox"] {
158
- margin: 12px 2px;
159
- }
160
- #wpmem_reg .div_textarea textarea,
161
- #wpmem_reg .textbox,
162
- #wpmem_reg .username,
163
- #wpmem_reg .password,
164
- #wpmem_login .textbox,
165
- #wpmem_login .username,
166
- #wpmem_login .password{
167
- width:100%;
168
- }
169
- #wpmem_reg .dropdown,
170
- #wpmem_reg select,
171
- #wpmem_reg input[type="file"] {
172
- width:100%;
173
- padding: 8px 10px 7px;
174
- border: 1px solid rgba(0, 0, 0, 0.1);
175
- border-radius: 2px;
176
- color: rgb(43, 43, 43);
177
- margin: 5px 0;
178
- }
179
- #wpmem_reg .dropdown:focus {
180
- border: 1px solid rgba(0, 0, 0, 0.3);
181
- outline: 0;
182
- }
183
- #wpmem_reg .textbox:focus, #wpmem_reg .textbox:hover, #wpmem_login .textbox:focus, #wpmem_login .textbox:hover,
184
- #wpmem_reg .username:focus, #wpmem_reg .username:hover, #wpmem_login .username:focus, #wpmem_login .username:hover,
185
- #wpmem_reg .password:focus, #wpmem_reg .password:hover, #wpmem_login .password:focus, #wpmem_login .password:hover {
186
- background-color:inherit;
187
- }
188
- #wpmem_reg textarea {
189
- height:185px;
190
- }
191
- #wpmem_reg .req {
192
- color: #bd3500;
193
- font-size: 22px;
194
- line-height: 50%;
195
- }
196
-
197
- #wpmem_reg .req-text {
198
- margin: 20px 0px 0px 5px;
199
- }
200
-
201
- #wpmem_reg .noinput {
202
- width:100%;
203
- padding: 8px 10px 7px;
204
- border: 1px solid rgba(0, 0, 0, 0.1);
205
- border-radius: 2px;
206
- color: rgb(43, 43, 43);
207
- margin: 5px 0;
208
- }
209
-
210
- #wpmem_reg .captcha {
211
- width: 74%;
212
- margin: 5px 0px;
213
- }
214
- #wpmem_reg .captcha table{
215
- line-height: 0px;
216
- }
217
- #wpmem_login .link-text {
218
- width: 74%;
219
- text-align:right;
220
- }
221
-
222
- #tos {
223
- margin-right:5px;
224
- }
225
-
226
-
227
- /* Buttons */
228
-
229
- #wpmem_reg .button_div, #wpmem_login .button_div {
230
- width:74%;
231
- height:55px;
232
- padding: 6px 0;
233
- text-align: right;
234
- }
235
-
236
-
237
- /** for smaller screens */
238
-
239
- @media screen and (max-width: 1079px) {
240
- #wp-members .button_div {
241
- text-align:center;
242
- }
243
- #wp-members input[type="submit"] {
244
- width: 92%;
245
- margin: 0 10px 6px 0;
246
- }
247
- }
248
-
249
- @media screen and (max-width: 1007px) {
250
- #wp-members {
251
- width: 179px;
252
- }
253
- #wp-members .button_div {
254
- text-align: inherit;
255
- }
256
- #wp-members input[type="submit"] {
257
- width: inherit;
258
- margin: 0 4px 0 0;
259
- }
260
- }
261
-
262
- @media screen and (max-width: 720px) {
263
- #wpmem_reg label.text, #wpmem_reg label.checkbox,
264
- #wpmem_reg label.textarea , #wpmem_reg label.select,
265
- #wpmem_login label, #wpmem_reg .div_text, #wpmem_reg .div_textarea,
266
- #wpmem_reg .div_select, #wpmem_login .div_text,
267
- #wpmem_reg .div_checkbox, #wpmem_reg .button_div, #wpmem_login .button_div {
268
- float: none;
269
- }
270
-
271
- #wpmem_reg label.text, #wpmem_reg label.checkbox,
272
- #wpmem_reg label.textarea , #wpmem_reg label.select,
273
- #wpmem_login label {
274
- width: 90%;
275
- padding: 5px 0 0 0;
276
- }
277
- #wpmem_reg label.textarea {
278
- height: 26px;
279
- }
280
- #wpmem_reg .div_text, #wpmem_reg .div_textarea,
281
- #wpmem_reg .div_select, #wpmem_login .div_text,
282
- #wpmem_reg .div_checkbox {
283
- width: 98%;
284
- }
285
- #wpmem_msg, .wpmem_msg {
286
- width: 100%;
287
- }
 
 
 
 
288
  }
1
+ /**
2
+ * WP-Members Styles CSS
3
+ *
4
+ * CSS for the WP-Members plugin using Twenty Sixteen Theme, no float
5
+ *
6
+ * This file is part of the WP-Members plugin by Chad Butler
7
+ * You can find out more about this plugin at http://rocketgeek.com
8
+ * Copyright (c) 2006-2015 Chad Butler
9
+ * WP-Members(tm) is a trademark of butlerblog.com
10
+ *
11
+ * @package WordPress
12
+ * @subpackage WP-Members
13
+ * @author Chad Butler
14
+ * @copyright 2006-2015
15
+ */
16
+
17
+ /*
18
+ This stylesheet is designed to integrate WP-Members with the Twenty Fourteen theme.
19
+ There are quite a few examples in here of what you can do to style the forms.
20
+ You can build off of this or start from scratch and set your own
21
+ custom css for the plugin (set the location in the admin panel).
22
+
23
+ See http://rocketgeek.com/tips-and-tricks/setting-up-a-custom-wp-members-stylesheet/
24
+ for information on how to set up the plugin with a custom stylesheet.
25
+
26
+ For information how to load custom stylesheets with wp_enqueue_style,
27
+ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
28
+ */
29
+
30
+
31
+ /* Error and Dialog Messages */
32
+
33
+ #wpmem_msg, .wpmem_msg {
34
+ background: #F9F9F9;
35
+ border:1px solid lightGrey;
36
+ border-radius: 3px;
37
+ padding: 20px 0 0 0;
38
+ }
39
+ #wpmem_msg {
40
+ width: 100%;
41
+ }
42
+ #wpmem_msg h2 {
43
+ font-family: Montserrat, "Helvetica Neue", sans-serif;
44
+ }
45
+ .wpmem_msg {
46
+ width: 74%;
47
+ }
48
+ .wpmem_msg p {
49
+ margin: 0 0 1.3em;
50
+ }
51
+
52
+ /* Sidebar Login Widget */
53
+
54
+ #wp-members {
55
+ width: 100%;
56
+ }
57
+ #wp-members fieldset {
58
+ border:none;
59
+ padding:0px
60
+ }
61
+ #wp-members label {
62
+ font-family: Montserrat, "Helvetica Neue", sans-serif;
63
+ color: #686868;
64
+ display: block;
65
+ font-size: 13px;
66
+ font-size: 0.8125rem;
67
+ letter-spacing: 0.076923077em;
68
+ line-height: 1.6153846154;
69
+ margin-bottom: 0.5384615385em;
70
+ text-transform: uppercase;
71
+ }
72
+ #wp-members input {
73
+ font-family: Merriweather, Georgia, serif;
74
+ }
75
+ #wp-members input[type="text"],
76
+ #wp-members input[type="password"]{
77
+ margin: 0 0 4px 0;
78
+ width: 92%;
79
+ }
80
+ #wp-members input[type="submit"] {
81
+ font-family: Montserrat, "Helvetica Neue", sans-serif;
82
+ padding: 10px 10px 8px;
83
+ margin: 0 4px 0 0;
84
+ }
85
+ #wp-members .button_div {
86
+ margin-top:4px;
87
+ }
88
+ #wp-members .err {
89
+ width:92%;
90
+ padding: 5px;
91
+ font-family: inherit;
92
+ border: 1px solid #ccc;
93
+ border-radius: 3px;
94
+ }
95
+
96
+
97
+ /* Login Form and Registration Form */
98
+
99
+ #wpmem_reg fieldset,
100
+ #wpmem_login fieldset {
101
+ border: none;
102
+ padding: 0;
103
+ margin: 40px 0;
104
+ }
105
+ #wpmem_reg legend,
106
+ #wpmem_login legend {
107
+ border-top: 4px solid #1a1a1a;
108
+ font-family: Montserrat, "Helvetica Neue", sans-serif;
109
+ font-size: 23px;
110
+ font-size: 1.4375rem;
111
+ font-weight: 700;
112
+ line-height: 1.3125;
113
+ padding-top: 1.217391304em;
114
+ padding-bottom: 1.75em;
115
+ box-sizing: inherit;
116
+ width: 100%;
117
+ }
118
+ #wpmem_reg label,
119
+ #wpmem_login label {
120
+ color: #686868;
121
+ display: block;
122
+ font-family: Montserrat, "Helvetica Neue", sans-serif;
123
+ font-size: 13px;
124
+ font-size: 0.8125rem;
125
+ letter-spacing: 0.076923077em;
126
+ line-height: 1.6153846154;
127
+ margin-bottom: 0.5384615385em;
128
+ text-transform: uppercase;
129
+ }
130
+ #wpmem_login label[for="rememberme"] {
131
+ display: initial;
132
+ }
133
+
134
+ #wpmem_reg .form,
135
+ #wpmem_login .form {
136
+ margin:0;
137
+ padding:0;
138
+ }
139
+ #wpmem_reg .clear,
140
+ #wpmem_login .clear {
141
+ clear:both;
142
+ }
143
+ #wpmem_reg .holder,
144
+ #wpmem_login .holder {
145
+ background-color:#fff;
146
+ }
147
+ #wpmem_login .div_text,
148
+ #wpmem_reg .div_text,
149
+ #wpmem_reg .div_textarea,
150
+ #wpmem_reg .div_select,
151
+ #wpmem_reg .div_checkbox,
152
+ #wpmem_reg .div_multicheckbox,
153
+ #wpmem_reg .div_multiselect,
154
+ #wpmem_reg .div_radio,
155
+ #wpmem_reg .div_url,
156
+ #wpmem_reg .div_file,
157
+ #wpmem_reg .div_image {
158
+ width:74%;
159
+ margin:0 0 14px 0;
160
+ }
161
+ #wpmem_login input[type="checkbox"] {
162
+ margin: 12px 2px;
163
+ }
164
+ #wpmem_reg .div_textarea textarea,
165
+ #wpmem_reg .textbox,
166
+ #wpmem_reg .username,
167
+ #wpmem_reg .password,
168
+ #wpmem_login .textbox,
169
+ #wpmem_login .username,
170
+ #wpmem_login .password{
171
+ width:100%;
172
+ }
173
+ #wpmem_reg .dropdown,
174
+ #wpmem_reg select,
175
+ #wpmem_reg input[type="file"] {
176
+ width:100%;
177
+ padding: 8px 10px 7px;
178
+ border: 1px solid rgba(0, 0, 0, 0.1);
179
+ border-radius: 2px;
180
+ color: rgb(43, 43, 43);
181
+ margin: 5px 0;
182
+ }
183
+ #wpmem_reg .dropdown:focus {
184
+ border: 1px solid rgba(0, 0, 0, 0.3);
185
+ outline: 0;
186
+ }
187
+ #wpmem_reg .textbox:focus, #wpmem_reg .textbox:hover, #wpmem_login .textbox:focus, #wpmem_login .textbox:hover,
188
+ #wpmem_reg .username:focus, #wpmem_reg .username:hover, #wpmem_login .username:focus, #wpmem_login .username:hover,
189
+ #wpmem_reg .password:focus, #wpmem_reg .password:hover, #wpmem_login .password:focus, #wpmem_login .password:hover {
190
+ background-color:inherit;
191
+ }
192
+ #wpmem_reg textarea {
193
+ height:185px;
194
+ }
195
+ #wpmem_reg .req {
196
+ color: #bd3500;
197
+ font-size: 22px;
198
+ line-height: 50%;
199
+ }
200
+
201
+ #wpmem_reg .req-text {
202
+ margin: 20px 0px 0px 5px;
203
+ }
204
+
205
+ #wpmem_reg .noinput {
206
+ width:100%;
207
+ padding: 8px 10px 7px;
208
+ border: 1px solid rgba(0, 0, 0, 0.1);
209
+ border-radius: 2px;
210
+ color: rgb(43, 43, 43);
211
+ margin: 5px 0;
212
+ }
213
+
214
+ #wpmem_reg .captcha {
215
+ width: 74%;
216
+ margin: 5px 0px;
217
+ }
218
+ #wpmem_reg .captcha table{
219
+ line-height: 0px;
220
+ }
221
+ #wpmem_login .link-text {
222
+ width: 74%;
223
+ text-align:right;
224
+ }
225
+
226
+ #tos {
227
+ margin-right:5px;
228
+ }
229
+
230
+
231
+ /* Buttons */
232
+
233
+ #wpmem_reg .button_div, #wpmem_login .button_div {
234
+ width:74%;
235
+ height:55px;
236
+ padding: 6px 0;
237
+ text-align: right;
238
+ }
239
+
240
+
241
+ /** for smaller screens */
242
+
243
+ @media screen and (max-width: 1079px) {
244
+ #wp-members .button_div {
245
+ text-align:center;
246
+ }
247
+ #wp-members input[type="submit"] {
248
+ width: 92%;
249
+ margin: 0 10px 6px 0;
250
+ }
251
+ }
252
+
253
+ @media screen and (max-width: 1007px) {
254
+ #wp-members {
255
+ width: 179px;
256
+ }
257
+ #wp-members .button_div {
258
+ text-align: inherit;
259
+ }
260
+ #wp-members input[type="submit"] {
261
+ width: inherit;
262
+ margin: 0 4px 0 0;
263
+ }
264
+ }
265
+
266
+ @media screen and (max-width: 720px) {
267
+ #wpmem_reg label.text, #wpmem_reg label.checkbox,
268
+ #wpmem_reg label.textarea , #wpmem_reg label.select,
269
+ #wpmem_login label, #wpmem_reg .div_text, #wpmem_reg .div_textarea,
270
+ #wpmem_reg .div_select, #wpmem_login .div_text,
271
+ #wpmem_reg .div_checkbox, #wpmem_reg .button_div, #wpmem_login .button_div {
272
+ float: none;
273
+ }
274
+
275
+ #wpmem_reg label.text, #wpmem_reg label.checkbox,
276
+ #wpmem_reg label.textarea , #wpmem_reg label.select,
277
+ #wpmem_login label {
278
+ width: 90%;
279
+ padding: 5px 0 0 0;
280
+ }
281
+ #wpmem_reg label.textarea {
282
+ height: 26px;
283
+ }
284
+ #wpmem_reg .div_text, #wpmem_reg .div_textarea,
285
+ #wpmem_reg .div_select, #wpmem_login .div_text,
286
+ #wpmem_reg .div_checkbox {
287
+ width: 98%;
288
+ }
289
+ #wpmem_msg, .wpmem_msg {
290
+ width: 100%;
291
+ }
292
  }
css/wp-members.css CHANGED
@@ -115,6 +115,13 @@ see http://rocketgeek.com/tips-and-tricks/load-a-custom-stylesheet/
115
  #wpmem_reg label.textarea {
116
  height:197px;
117
  }
 
 
 
 
 
 
 
118
  #wpmem_reg .form, #wpmem_login .form {
119
  margin:0;
120
  padding:0;
115
  #wpmem_reg label.textarea {
116
  height:197px;
117
  }
118
+ #wpmem_login label[for="rememberme"] {
119
+ float: none;
120
+ display: initial;
121
+ background-color: initial;
122
+ padding: initial;
123
+ font-size: initial;
124
+ }
125
  #wpmem_reg .form, #wpmem_login .form {
126
  margin:0;
127
  padding:0;
inc/api.php CHANGED
@@ -25,11 +25,13 @@
25
  * - wpmem_user_has_role
26
  * - wpmem_create_membership_number
27
  * - wpmem_login_status
 
28
  * - wpmem_is_reg_page
29
  * - wpmem_load_dropins
 
 
30
  */
31
 
32
-
33
  /**
34
  * Redirects a user to defined login page with return redirect.
35
  *
@@ -51,7 +53,6 @@ function wpmem_redirect_to_login( $redirect_to = false ) {
51
  return;
52
  }
53
 
54
-
55
  /**
56
  * Checks if content is blocked (replaces wpmem_block()).
57
  *
@@ -65,7 +66,6 @@ function wpmem_is_blocked() {
65
  return $wpmem->is_blocked();
66
  }
67
 
68
-
69
  /**
70
  * Wrapper to get the login page location.
71
  *
@@ -86,44 +86,47 @@ function wpmem_login_url( $redirect_to = false ) {
86
  return $url;
87
  }
88
 
89
-
90
  /**
91
  * Wrapper to get the register page location.
92
  *
93
  * @since 3.1.1
94
  *
95
- * @global object $wpmem
96
- * @return string The register page url.
97
  */
98
  function wpmem_register_url() {
99
  global $wpmem;
100
  return $wpmem->user_pages['register'];
101
  }
102
 
103
-
104
  /**
105
  * Wrapper to get the profile page location.
106
  *
107
  * @since 3.1.1
108
  * @since 3.1.2 Added $a parameter.
109
  *
110
- * @global object $wpmem
111
- * @param string $a Action (optional).
112
- * @return string The profile page url.
113
  */
114
  function wpmem_profile_url( $a = false ) {
115
  global $wpmem;
116
  return ( $a ) ? add_query_arg( 'a', $a, $wpmem->user_pages['profile'] ) : $wpmem->user_pages['profile'];
117
  }
118
 
119
-
120
  /**
121
  * Returns an array of user pages.
122
  *
123
  * @since 3.1.2
124
  * @since 3.1.3 Added array keys.
125
  *
126
- * @return array $pages
 
 
 
 
 
 
127
  */
128
  function wpmem_user_pages() {
129
  $pages = array(
@@ -134,7 +137,6 @@ function wpmem_user_pages() {
134
  return $pages;
135
  }
136
 
137
-
138
  /**
139
  * Returns the current full url.
140
  *
@@ -150,29 +152,35 @@ function wpmem_current_url( $slash = true ) {
150
  return ( $slash ) ? trailingslashit( $url ) : $url;
151
  }
152
 
153
-
154
  /**
155
  * Wrapper for $wpmem->create_form_field().
156
  *
157
  * @since 3.1.2
158
  *
159
- * @param array $args
160
- * @return string
 
 
 
 
 
 
 
 
161
  */
162
  function wpmem_form_field( $args ) {
163
  global $wpmem;
164
  return $wpmem->forms->create_form_field( $args );
165
  }
166
 
167
-
168
  /**
169
  * Wrapper to get form fields.
170
  *
171
  * @since 3.1.1
172
  * @since 3.1.5 Checks if fields array is set or empty before returning.
173
  *
174
- * @global object $wpmem
175
- * @param string $form The form being generated.
176
  * @return array $fields The form fields.
177
  */
178
  function wpmem_fields( $form = 'default' ) {
@@ -183,14 +191,13 @@ function wpmem_fields( $form = 'default' ) {
183
  return $wpmem->fields;
184
  }
185
 
186
-
187
  /**
188
  * Wrapper to return a string from the get_text function.
189
  *
190
  * @since 3.1.1
191
  * @since 3.1.2 Added $echo argument.
192
  *
193
- * @global object $wpmem The WP_Members object class.
194
  * @param string $str The string to retrieve.
195
  * @param bool $echo Print the string (default: false).
196
  * @return string $str The localized string.
@@ -204,7 +211,6 @@ function wpmem_gettext( $str, $echo = false ) {
204
  }
205
  }
206
 
207
-
208
  /**
209
  * Wrapper to use custom dialog.
210
  *
@@ -220,7 +226,6 @@ function wpmem_use_custom_dialog( $defaults, $tag, $dialogs ) {
220
  return $defaults;
221
  }
222
 
223
-
224
  /**
225
  * Checks if user has a particular role.
226
  *
@@ -231,11 +236,12 @@ function wpmem_use_custom_dialog( $defaults, $tag, $dialogs ) {
231
  * is passed).
232
  *
233
  * @since 3.1.1
 
234
  *
235
- * @global object $current_user Current user object.
236
- * @param string $role Slug of the role being checked.
237
- * @param int $user_id ID of the user being checked (optional).
238
- * @return boolean $has_role True if user has the role, otherwise false.
239
  */
240
  function wpmem_user_has_role( $role, $user_id = false ) {
241
  global $current_user, $wpmem;
@@ -246,16 +252,29 @@ function wpmem_user_has_role( $role, $user_id = false ) {
246
  if ( is_user_logged_in() && ! $user_id ) {
247
  $user = ( isset( $current_user ) ) ? $current_user : wp_get_current_user();
248
  }
249
- return ( in_array( $role, $user->roles ) ) ? true : $has_role;
 
 
 
 
 
 
 
 
250
  }
251
 
252
-
253
  /**
254
  * Creates a membership number.
255
  *
256
  * @since 3.1.1
257
  *
258
- * @param array $args
 
 
 
 
 
 
259
  * @return string $membersip_number
260
  */
261
  function wpmem_create_membership_number( $args ) {
@@ -263,23 +282,18 @@ function wpmem_create_membership_number( $args ) {
263
  return $wpmem->api->generate_membership_number( $args );
264
  }
265
 
266
-
267
  /**
268
  * Returns or displays the user's login status.
269
  *
270
  * @since 2.0.0
271
  * @since 3.1.2 Moved to api.php, no longer pluggable.
 
272
  *
273
  * @param boolean $echo Determines whether function should print result or not (default: true).
274
  * @return string $status The user status string produced by wpmem_inc_memberlinks().
275
  */
276
  function wpmem_login_status( $echo = true ) {
277
 
278
- /**
279
- * Load the dialogs functions.
280
- */
281
- require_once( WPMEM_PATH . 'inc/dialogs.php' );
282
-
283
  if ( is_user_logged_in() ) {
284
  $status = wpmem_inc_memberlinks( 'status' );
285
  if ( $echo ) {
@@ -289,6 +303,29 @@ function wpmem_login_status( $echo = true ) {
289
  }
290
  }
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  /**
294
  * Compares wpmem_reg_page value with the register page URL.
@@ -310,15 +347,74 @@ function wpmem_is_reg_page( $check ) {
310
  return ( $check_page == $reg_page ) ? true : false;
311
  }
312
 
313
-
314
  /**
315
  * Wrapper for load_dropins()
316
  *
317
  * @since 3.1.4
 
 
318
  */
319
  function wpmem_load_dropins() {
320
  global $wpmem;
321
  $wpmem->load_dropins();
322
  }
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  // End of file.
25
  * - wpmem_user_has_role
26
  * - wpmem_create_membership_number
27
  * - wpmem_login_status
28
+ * - wpmem_get
29
  * - wpmem_is_reg_page
30
  * - wpmem_load_dropins
31
+ * - wpmem_loginout
32
+ * - wpmem_array_insert
33
  */
34
 
 
35
  /**
36
  * Redirects a user to defined login page with return redirect.
37
  *
53
  return;
54
  }
55
 
 
56
  /**
57
  * Checks if content is blocked (replaces wpmem_block()).
58
  *
66
  return $wpmem->is_blocked();
67
  }
68
 
 
69
  /**
70
  * Wrapper to get the login page location.
71
  *
86
  return $url;
87
  }
88
 
 
89
  /**
90
  * Wrapper to get the register page location.
91
  *
92
  * @since 3.1.1
93
  *
94
+ * @global object $wpmem The WP_Members object.
95
+ * @return string The register page url.
96
  */
97
  function wpmem_register_url() {
98
  global $wpmem;
99
  return $wpmem->user_pages['register'];
100
  }
101
 
 
102
  /**
103
  * Wrapper to get the profile page location.
104
  *
105
  * @since 3.1.1
106
  * @since 3.1.2 Added $a parameter.
107
  *
108
+ * @global object $wpmem The WP_Members object.
109
+ * @param string $a Action (optional).
110
+ * @return string The profile page url.
111
  */
112
  function wpmem_profile_url( $a = false ) {
113
  global $wpmem;
114
  return ( $a ) ? add_query_arg( 'a', $a, $wpmem->user_pages['profile'] ) : $wpmem->user_pages['profile'];
115
  }
116
 
 
117
  /**
118
  * Returns an array of user pages.
119
  *
120
  * @since 3.1.2
121
  * @since 3.1.3 Added array keys.
122
  *
123
+ * @return array $pages {
124
+ * The URLs of login, register, and user profile pages.
125
+ *
126
+ * @type string $login
127
+ * @type string $register
128
+ * @type string $profile
129
+ * }
130
  */
131
  function wpmem_user_pages() {
132
  $pages = array(
137
  return $pages;
138
  }
139
 
 
140
  /**
141
  * Returns the current full url.
142
  *
152
  return ( $slash ) ? trailingslashit( $url ) : $url;
153
  }
154
 
 
155
  /**
156
  * Wrapper for $wpmem->create_form_field().
157
  *
158
  * @since 3.1.2
159
  *
160
+ * @param array $args {
161
+ * @type string $name (required) The field meta key.
162
+ * @type string $type (required) The field HTML type (url, email, image, file, checkbox, text, textarea, password, hidden, select, multiselect, multicheckbox, radio).
163
+ * @type string $value (required) The field's value (can be a null value).
164
+ * @type string $compare (required) Compare value.
165
+ * @type string $class (optional) Class identifier for the field.
166
+ * @type boolean $required (optional) If a value is required default: true).
167
+ * @type string $delimiter (optional) The field delimiter (pipe or comma, default: | ).
168
+ * }
169
+ * @return string The HTML of the form field.
170
  */
171
  function wpmem_form_field( $args ) {
172
  global $wpmem;
173
  return $wpmem->forms->create_form_field( $args );
174
  }
175
 
 
176
  /**
177
  * Wrapper to get form fields.
178
  *
179
  * @since 3.1.1
180
  * @since 3.1.5 Checks if fields array is set or empty before returning.
181
  *
182
+ * @global object $wpmem The WP_Members object.
183
+ * @param string $form The form being generated.
184
  * @return array $fields The form fields.
185
  */
186
  function wpmem_fields( $form = 'default' ) {
191
  return $wpmem->fields;
192
  }
193
 
 
194
  /**
195
  * Wrapper to return a string from the get_text function.
196
  *
197
  * @since 3.1.1
198
  * @since 3.1.2 Added $echo argument.
199
  *
200
+ * @global object $wpmem The WP_Members object.
201
  * @param string $str The string to retrieve.
202
  * @param bool $echo Print the string (default: false).
203
  * @return string $str The localized string.
211
  }
212
  }
213
 
 
214
  /**
215
  * Wrapper to use custom dialog.
216
  *
226
  return $defaults;
227
  }
228
 
 
229
  /**
230
  * Checks if user has a particular role.
231
  *
236
  * is passed).
237
  *
238
  * @since 3.1.1
239
+ * @since 3.1.6 Include accepting an array of roles to check.
240
  *
241
+ * @global object $current_user Current user object.
242
+ * @param string|array $role Slug or array of slugs of the role being checked.
243
+ * @param int $user_id ID of the user being checked (optional).
244
+ * @return boolean $has_role True if user has the role, otherwise false.
245
  */
246
  function wpmem_user_has_role( $role, $user_id = false ) {
247
  global $current_user, $wpmem;
252
  if ( is_user_logged_in() && ! $user_id ) {
253
  $user = ( isset( $current_user ) ) ? $current_user : wp_get_current_user();
254
  }
255
+ if ( is_array( $role ) ) {
256
+ foreach ( $role as $r ) {
257
+ if ( in_array( $r, $user->roles ) ) {
258
+ return true;
259
+ }
260
+ }
261
+ } else {
262
+ return ( in_array( $role, $user->roles ) ) ? true : $has_role;
263
+ }
264
  }
265
 
 
266
  /**
267
  * Creates a membership number.
268
  *
269
  * @since 3.1.1
270
  *
271
+ * @param array $args {
272
+ * @type string $option
273
+ * @type string $meta_key
274
+ * @type int $start (optional, default 0)
275
+ * @type int $increment (optional, default 1)
276
+ * @type int $lead
277
+ * }
278
  * @return string $membersip_number
279
  */
280
  function wpmem_create_membership_number( $args ) {
282
  return $wpmem->api->generate_membership_number( $args );
283
  }
284
 
 
285
  /**
286
  * Returns or displays the user's login status.
287
  *
288
  * @since 2.0.0
289
  * @since 3.1.2 Moved to api.php, no longer pluggable.
290
+ * @since 3.1.6 Dependencies now loaded by object.
291
  *
292
  * @param boolean $echo Determines whether function should print result or not (default: true).
293
  * @return string $status The user status string produced by wpmem_inc_memberlinks().
294
  */
295
  function wpmem_login_status( $echo = true ) {
296
 
 
 
 
 
 
297
  if ( is_user_logged_in() ) {
298
  $status = wpmem_inc_memberlinks( 'status' );
299
  if ( $echo ) {
303
  }
304
  }
305
 
306
+ /**
307
+ * Utility function to validate $_POST, $_GET, and $_REQUEST.
308
+ *
309
+ * @since 3.1.3
310
+ *
311
+ * @param string $tag The form field or query string.
312
+ * @param string $default The default value (optional).
313
+ * @param string $type post|get|request (optional).
314
+ * @return string
315
+ */
316
+ function wpmem_get( $tag, $default = '', $type = 'post' ) {
317
+ switch ( $type ) {
318
+ case 'post':
319
+ return ( isset( $_POST[ $tag ] ) ) ? $_POST[ $tag ] : $default;
320
+ break;
321
+ case 'get':
322
+ return ( isset( $_GET[ $tag ] ) ) ? $_GET[ $tag ] : $default;
323
+ break;
324
+ case 'request':
325
+ return ( isset( $_REQUEST[ $tag ] ) ) ? $_REQUEST[ $tag ] : $default;
326
+ break;
327
+ }
328
+ }
329
 
330
  /**
331
  * Compares wpmem_reg_page value with the register page URL.
347
  return ( $check_page == $reg_page ) ? true : false;
348
  }
349
 
 
350
  /**
351
  * Wrapper for load_dropins()
352
  *
353
  * @since 3.1.4
354
+ *
355
+ * @global object $wpmem The WP_Members object.
356
  */
357
  function wpmem_load_dropins() {
358
  global $wpmem;
359
  $wpmem->load_dropins();
360
  }
361
 
362
+ /**
363
+ * Creates a login/logout link.
364
+ *
365
+ * @since 3.1.6
366
+ *
367
+ * @param array $args {
368
+ * Array of arguments to customize output.
369
+ *
370
+ * @type string $login_redirect_to The url to redirect to after login (optional).
371
+ * @type string $logout_redirect_to The url to redirect to after logout (optional).
372
+ * @type string $login_text Text for the login link (optional).
373
+ * @type string $logout_text Text for the logout link (optional).
374
+ * }
375
+ * @param boolean $echo (default: false)
376
+ * @return string $link
377
+ */
378
+ function wpmem_loginout( $args = array(), $echo = false ) {
379
+ $defaults = array(
380
+ 'login_redirect_to' => ( isset( $args['login_redirect_to'] ) ) ? $args['login_redirect_to'] : wpmem_current_url(),
381
+ 'logout_redirect_to' => ( isset( $args['logout_redirect_to'] ) ) ? $args['logout_redirect_to'] : wpmem_current_url(), // @todo - This is not currently active.
382
+ 'login_text' => ( isset( $args['login_text'] ) ) ? $args['login_text'] : __( 'log in', 'wp-members' ),
383
+ 'logout_text' => ( isset( $args['logout_text'] ) ) ? $args['logout_text'] : __( 'log out', 'wp-members' ),
384
+ );
385
+ $args = wp_parse_args( $args, $defaults );
386
+ $redirect = ( is_user_logged_in() ) ? $args['logout_redirect_to'] : $args['login_redirect_to'];
387
+ $text = ( is_user_logged_in() ) ? $args['logout_text'] : $args['login_text'];
388
+ if ( is_user_logged_in() ) {
389
+ /** This filter is defined in /inc/dialogs.php */
390
+ $link = apply_filters( 'wpmem_logout_link', add_query_arg( 'a', 'logout' ) );
391
+ } else {
392
+ $link = wpmem_login_url( $redirect );
393
+ }
394
+ $link = sprintf( '<a href="%s">%s</a>', $link, $text );
395
+ return $link;
396
+ }
397
+
398
+ /**
399
+ * Inserts array items at a specific point in an array.
400
+ *
401
+ * @since 3.1.6
402
+ *
403
+ * @param array $array Original array.
404
+ * @param array $new Array of new items to insert into $array.
405
+ * @param string $key Array key to insert new items before or after.
406
+ * @param string $loc Location to insert relative to $key (before|after) default:after.
407
+ * @return array Original array with new items inserted.
408
+ */
409
+ function wpmem_array_insert( array $array, array $new, $key, $loc = 'after' ) {
410
+ $keys = array_keys( $array );
411
+ if ( 'before' == $loc ) {
412
+ $pos = (int) array_search( $key, $keys );
413
+ } else {
414
+ $index = array_search( $key, $keys );
415
+ $pos = ( false === $index ) ? count( $array ) : $index + 1;
416
+ }
417
+ return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) );
418
+ }
419
+
420
  // End of file.
inc/class-wp-members-api.php CHANGED
@@ -28,7 +28,7 @@ class WP_Members_API {
28
  function get_field_keys_by_meta() {
29
  global $wpmem;
30
  $field_keys = array();
31
- foreach ( $wpmem->fields as $key => $field ) {
32
  $field_keys[ $field[2] ] = $key;
33
  }
34
  return $field_keys;
@@ -50,8 +50,9 @@ class WP_Members_API {
50
  function get_select_display_values( $meta_key ) {
51
  global $wpmem;
52
  $keys = $this->get_field_keys_by_meta();
53
- $raw = $wpmem->fields[ $keys[ $meta_key ] ][7];
54
- $delimiter = ( isset( $wpmem->fields[ $keys[ $meta_key ][8] ] ) ) ? $wpmem->fields[ $keys[ $meta_key ][8] ] : '|';
 
55
  $display_values = array();
56
  foreach ( $raw as $value ) {
57
  $pieces = explode( $delimiter, trim( $value ) );
28
  function get_field_keys_by_meta() {
29
  global $wpmem;
30
  $field_keys = array();
31
+ foreach ( wpmem_fields() as $key => $field ) {
32
  $field_keys[ $field[2] ] = $key;
33
  }
34
  return $field_keys;
50
  function get_select_display_values( $meta_key ) {
51
  global $wpmem;
52
  $keys = $this->get_field_keys_by_meta();
53
+ $fields = wpmem_fields();
54
+ $raw = $fields[ $keys[ $meta_key ] ][7];
55
+ $delimiter = ( isset( $fields[ $keys[ $meta_key ][8] ] ) ) ? $fields[ $keys[ $meta_key ][8] ] : '|';
56
  $display_values = array();
57
  foreach ( $raw as $value ) {
58
  $pieces = explode( $delimiter, trim( $value ) );
inc/class-wp-members-forms.php CHANGED
@@ -26,28 +26,31 @@ class WP_Members_Forms {
26
  *
27
  * @since 3.1.0
28
  * @since 3.1.1 Added $delimiter.
29
- * @since 3.1.2 Changed $valtochk to $compare
 
30
  *
31
  * @param array $args {
32
- * @type string $name
33
- * @type string $type
34
- * @type string $value
35
- * @type string $compare
36
- * @type string $class
37
- * @type string $required
38
- * @type string $delimiter
 
39
  * }
40
  * @return string $str The field returned as a string.
41
  */
42
  function create_form_field( $args ) {
43
 
44
- $name = $args['name'];
45
- $type = $args['type'];
46
- $value = maybe_unserialize( $args['value'] );
47
- $compare = $args['compare'];
48
- $class = ( isset( $args['class'] ) ) ? $args['class'] : 'textbox';
49
- $required = ( isset( $args['required'] ) ) ? $args['required'] : false;
50
- $delimiter = ( isset( $args['delimiter'] ) ) ? $args['delimiter'] : '|';
 
51
 
52
  switch ( $type ) {
53
 
@@ -55,7 +58,8 @@ class WP_Members_Forms {
55
  case "email":
56
  $class = ( $class == 'textbox' ) ? "textbox" : $class;
57
  $value = ( 'url' == $type ) ? esc_url( $value ) : esc_attr( wp_unslash( $value ) );
58
- $str = "<input name=\"$name\" type=\"$type\" id=\"$name\" value=\"$value\" class=\"$class\"" . ( ( $required ) ? " required " : "" ) . " />";
 
59
  break;
60
 
61
  case "image":
@@ -71,7 +75,8 @@ class WP_Members_Forms {
71
 
72
  case "text":
73
  $value = stripslashes( esc_attr( $value ) );
74
- $str = "<input name=\"$name\" type=\"$type\" id=\"$name\" value=\"$value\" class=\"$class\"" . ( ( $required ) ? " required " : "" ) . " />";
 
75
  break;
76
 
77
  case "textarea":
26
  *
27
  * @since 3.1.0
28
  * @since 3.1.1 Added $delimiter.
29
+ * @since 3.1.2 Changed $valtochk to $compare.
30
+ * @since 3.1.6 Added $placeholder.
31
  *
32
  * @param array $args {
33
+ * @type string $name
34
+ * @type string $type
35
+ * @type string $value
36
+ * @type string $compare
37
+ * @type string $class
38
+ * @type boolean $required
39
+ * @type string $delimiter
40
+ * @type string $placeholder
41
  * }
42
  * @return string $str The field returned as a string.
43
  */
44
  function create_form_field( $args ) {
45
 
46
+ $name = $args['name'];
47
+ $type = $args['type'];
48
+ $value = maybe_unserialize( $args['value'] );
49
+ $compare = ( isset( $args['compare'] ) ) ? $args['compare'] : '';
50
+ $class = ( isset( $args['class'] ) ) ? $args['class'] : 'textbox';
51
+ $required = ( isset( $args['required'] ) ) ? $args['required'] : false;
52
+ $delimiter = ( isset( $args['delimiter'] ) ) ? $args['delimiter'] : '|';
53
+ $placeholder = ( isset( $args['placeholder'] ) ) ? $args['placeholder'] : false;
54
 
55
  switch ( $type ) {
56
 
58
  case "email":
59
  $class = ( $class == 'textbox' ) ? "textbox" : $class;
60
  $value = ( 'url' == $type ) ? esc_url( $value ) : esc_attr( wp_unslash( $value ) );
61
+ $placeholder = ( $placeholder ) ? ' placeholder="' . $placeholder . '"' : '';
62
+ $str = "<input name=\"$name\" type=\"$type\" id=\"$name\" value=\"$value\" class=\"$class\"" . ( ( $required ) ? " required " : "" ) . "$placeholder />";
63
  break;
64
 
65
  case "image":
75
 
76
  case "text":
77
  $value = stripslashes( esc_attr( $value ) );
78
+ $placeholder = ( $placeholder ) ? ' placeholder="' . $placeholder . '"' : '';
79
+ $str = "<input name=\"$name\" type=\"$type\" id=\"$name\" value=\"$value\" class=\"$class\"" . ( ( $required ) ? " required " : "" ) . "$placeholder />";
80
  break;
81
 
82
  case "textarea":
inc/class-wp-members.php CHANGED
@@ -32,8 +32,11 @@ class WP_Members {
32
  * Plugin initialization function.
33
  *
34
  * @since 3.0.0
 
35
  */
36
  function __construct() {
 
 
37
 
38
  /**
39
  * Filter the options before they are loaded into constants.
@@ -52,7 +55,7 @@ class WP_Members {
52
  */
53
  require_once( WPMEM_PATH . 'wp-members-install.php' );
54
  // Update settings.
55
- $settings = apply_filters( 'wpmem_settings', wpmem_upgrade_settings() );
56
  }
57
 
58
  // Assemble settings.
@@ -66,13 +69,37 @@ class WP_Members {
66
  $this->cssurl = ( isset( $this->style ) && $this->style == 'use_custom' ) ? $this->cssurl : $this->style;
67
 
68
  // Load forms.
69
- require_once( WPMEM_PATH . 'inc/class-wp-members-forms.php' );
70
  $this->forms = new WP_Members_Forms;
71
 
72
  // Load api.
73
- require_once( WPMEM_PATH . 'inc/class-wp-members-api.php' );
74
  $this->api = new WP_Members_API;
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
  /**
@@ -82,15 +109,17 @@ class WP_Members {
82
  * @since 3.0.7 Added wpmem_show_count.
83
  * @since 3.1.0 Added wpmem_profile.
84
  * @since 3.1.1 Added wpmem_loginout.
 
85
  */
86
  function load_shortcodes() {
87
 
88
  /**
89
- * Load the shortcode functions.
90
  *
91
  * @since 3.0.0
 
92
  */
93
- require_once( WPMEM_PATH . 'inc/shortcodes.php' );
94
 
95
  add_shortcode( 'wp-members', 'wpmem_shortcode' );
96
  add_shortcode( 'wpmem_field', 'wpmem_sc_fields' );
@@ -104,11 +133,12 @@ class WP_Members {
104
  add_shortcode( 'wpmem_tos', 'wpmem_sc_tos' );
105
 
106
  /**
107
- * Fires after shortcodes load (for adding additional custom shortcodes).
108
- *
109
  * @since 3.0.0
 
110
  */
111
- do_action( 'wpmem_load_shortcodes' );
112
  }
113
 
114
  /**
@@ -117,6 +147,14 @@ class WP_Members {
117
  * @since 3.0.0
118
  */
119
  function load_hooks() {
 
 
 
 
 
 
 
 
120
 
121
  // Add actions.
122
  add_action( 'template_redirect', array( $this, 'get_action' ) );
@@ -140,11 +178,12 @@ class WP_Members {
140
  }
141
 
142
  /**
143
- * Fires after action and filter hooks load (for adding/removing hooks).
144
  *
145
  * @since 3.0.0
 
146
  */
147
- do_action( 'wpmem_load_hooks' );
148
  }
149
 
150
  /**
@@ -156,6 +195,14 @@ class WP_Members {
156
  */
157
  function load_dropins() {
158
 
 
 
 
 
 
 
 
 
159
  /**
160
  * Filters the drop-in file folder.
161
  *
@@ -171,11 +218,12 @@ class WP_Members {
171
  }
172
 
173
  /**
174
- * Fires after dropins load (for adding additional drop-ins).
175
  *
176
  * @since 3.0.0
 
177
  */
178
- do_action( 'wpmem_load_dropins' );
179
  }
180
 
181
  /**
@@ -201,6 +249,40 @@ class WP_Members {
201
 
202
  define( 'WPMEM_CSSURL', $this->cssurl );
203
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
 
205
  /**
206
  * Gets the requested action.
32
  * Plugin initialization function.
33
  *
34
  * @since 3.0.0
35
+ * @since 3.1.6 Dependencies now loaded by object.
36
  */
37
  function __construct() {
38
+
39
+ $this->load_dependencies();
40
 
41
  /**
42
  * Filter the options before they are loaded into constants.
55
  */
56
  require_once( WPMEM_PATH . 'wp-members-install.php' );
57
  // Update settings.
58
+ $settings = apply_filters( 'wpmem_settings', wpmem_do_install() );
59
  }
60
 
61
  // Assemble settings.
69
  $this->cssurl = ( isset( $this->style ) && $this->style == 'use_custom' ) ? $this->cssurl : $this->style;
70
 
71
  // Load forms.
 
72
  $this->forms = new WP_Members_Forms;
73
 
74
  // Load api.
 
75
  $this->api = new WP_Members_API;
76
 
77
+ /**
78
+ * Fires after main settings are loaded.
79
+ *
80
+ * @since 3.0
81
+ * @todo Consider deprecating this action. It is undocumented (and unlikely used by users),
82
+ * With the move of the remaining initial loading to the constructor, the object is
83
+ * no longer available to this action, and moving it doesn't make much sense since
84
+ * wpmem_after_init would come right after it.
85
+ */
86
+ do_action( 'wpmem_settings_loaded' );
87
+
88
+ // Preload the expiration module, if available.
89
+ $exp_active = ( function_exists( 'wpmem_exp_init' ) || function_exists( 'wpmem_set_exp' ) ) ? true : false;
90
+ define( 'WPMEM_EXP_MODULE', $exp_active );
91
+
92
+ // Load actions and filters.
93
+ $this->load_hooks();
94
+
95
+ // Load shortcodes.
96
+ $this->load_shortcodes();
97
+
98
+ // Load fields.
99
+ //$this->load_fields();
100
+
101
+ // Load contants.
102
+ $this->load_constants();
103
  }
104
 
105
  /**
109
  * @since 3.0.7 Added wpmem_show_count.
110
  * @since 3.1.0 Added wpmem_profile.
111
  * @since 3.1.1 Added wpmem_loginout.
112
+ * @since 3.1.6 Dependencies now loaded by object.
113
  */
114
  function load_shortcodes() {
115
 
116
  /**
117
+ * Fires before shortcodes load.
118
  *
119
  * @since 3.0.0
120
+ * @since 3.1.6 Fires before shortcodes load.
121
  */
122
+ do_action( 'wpmem_load_shortcodes' );
123
 
124
  add_shortcode( 'wp-members', 'wpmem_shortcode' );
125
  add_shortcode( 'wpmem_field', 'wpmem_sc_fields' );
133
  add_shortcode( 'wpmem_tos', 'wpmem_sc_tos' );
134
 
135
  /**
136
+ * Fires after shortcodes load.
137
+ *
138
  * @since 3.0.0
139
+ * @since 3.1.6 Was wpmem_load_shortcodes, now wpmem_shortcodes_loaded.
140
  */
141
+ do_action( 'wpmem_shortcodes_loaded' );
142
  }
143
 
144
  /**
147
  * @since 3.0.0
148
  */
149
  function load_hooks() {
150
+
151
+ /**
152
+ * Fires before action and filter hooks load.
153
+ *
154
+ * @since 3.0.0
155
+ * @since 3.1.6 Fires before hooks load.
156
+ */
157
+ do_action( 'wpmem_load_hooks' );
158
 
159
  // Add actions.
160
  add_action( 'template_redirect', array( $this, 'get_action' ) );
178
  }
179
 
180
  /**
181
+ * Fires after action and filter hooks load.
182
  *
183
  * @since 3.0.0
184
+ * @since 3.1.6 Was wpmem_load_hooks, now wpmem_hooks_loaded.
185
  */
186
+ do_action( 'wpmem_hooks_loaded' );
187
  }
188
 
189
  /**
195
  */
196
  function load_dropins() {
197
 
198
+ /**
199
+ * Fires before dropins load (for adding additional drop-ins).
200
+ *
201
+ * @since 3.0.0
202
+ * @since 3.1.6 Fires before dropins.
203
+ */
204
+ do_action( 'wpmem_load_dropins' );
205
+
206
  /**
207
  * Filters the drop-in file folder.
208
  *
218
  }
219
 
220
  /**
221
+ * Fires before dropins load (for adding additional drop-ins).
222
  *
223
  * @since 3.0.0
224
+ * @since 3.1.6 Was wpmem_load_dropins, now wpmem_dropins_loaded.
225
  */
226
+ do_action( 'wpmem_dropins_loaded' );
227
  }
228
 
229
  /**
249
 
250
  define( 'WPMEM_CSSURL', $this->cssurl );
251
  }
252
+
253
+ /**
254
+ * Load dependent files.
255
+ *
256
+ * @since 3.1.6
257
+ */
258
+ function load_dependencies() {
259
+
260
+ /**
261
+ * Filter the location and name of the pluggable file.
262
+ *
263
+ * @since 2.9.0
264
+ * @since 3.1.6 Moved in load order to come before dependencies.
265
+ *
266
+ * @param string The path to WP-Members plugin functions file.
267
+ */
268
+ $wpmem_pluggable = apply_filters( 'wpmem_plugins_file', WP_PLUGIN_DIR . '/wp-members-pluggable.php' );
269
+
270
+ // Preload any custom functions, if available.
271
+ if ( file_exists( $wpmem_pluggable ) ) {
272
+ include( $wpmem_pluggable );
273
+ }
274
+
275
+ require_once( WPMEM_PATH . 'inc/class-wp-members-api.php' );
276
+ require_once( WPMEM_PATH . 'inc/class-wp-members-forms.php' );
277
+ require_once( WPMEM_PATH . 'inc/class-wp-members-widget.php' );
278
+ require_once( WPMEM_PATH . 'inc/core.php' );
279
+ require_once( WPMEM_PATH . 'inc/api.php' );
280
+ require_once( WPMEM_PATH . 'inc/utilities.php' );
281
+ require_once( WPMEM_PATH . 'inc/dialogs.php' );
282
+ require_once( WPMEM_PATH . 'inc/sidebar.php' );
283
+ require_once( WPMEM_PATH . 'inc/shortcodes.php' );
284
+ require_once( WPMEM_PATH . 'inc/email.php' );
285
+ }
286
 
287
  /**
288
  * Gets the requested action.
inc/core.php CHANGED
@@ -16,13 +16,6 @@
16
  */
17
 
18
 
19
- /**
20
- * Load utility functions.
21
- */
22
- require_once( WPMEM_PATH . 'inc/api.php' );
23
- require_once( WPMEM_PATH . 'inc/utilities.php' );
24
-
25
-
26
  /**
27
  * The Main Action Function.
28
  *
@@ -154,9 +147,9 @@ function wpmem_login() {
154
 
155
  // Determine where to put the user after login.
156
  if ( isset( $_POST['redirect_to'] ) ) {
157
- $redirect_to = esc_url( trim( $_POST['redirect_to'] ) );
158
  } else {
159
- $redirect_to = esc_url( $_SERVER['REQUEST_URI'] . ( ( isset( $_SERVER['QUERY_STRING'] ) ) ? $_SERVER['QUERY_STRING'] : '' ) );
160
  }
161
 
162
  /**
@@ -193,6 +186,7 @@ if ( ! function_exists( 'wpmem_logout' ) ):
193
  * Logs the user out then redirects.
194
  *
195
  * @since 2.0.0
 
196
  *
197
  * @param string $redirect_to The URL to redirect to at logout.
198
  */
@@ -210,13 +204,12 @@ function wpmem_logout( $redirect_to = null ) {
210
  */
211
  $redirect_to = apply_filters( 'wpmem_logout_redirect', $redirect_to );
212
 
 
213
  wp_clear_auth_cookie();
214
 
215
  /** This action is defined in /wp-includes/pluggable.php. */
216
  do_action( 'wp_logout' );
217
 
218
- nocache_headers();
219
-
220
  wp_redirect( $redirect_to );
221
  exit();
222
  }
@@ -249,19 +242,9 @@ if ( ! function_exists( 'widget_wpmemwidget_init' ) ):
249
  * Initializes the WP-Members widget.
250
  *
251
  * @since 2.0.0
 
252
  */
253
  function widget_wpmemwidget_init() {
254
-
255
- /**
256
- * Load the WP-Members widget class.
257
- */
258
- require_once( WPMEM_PATH . 'inc/class-wp-members-widget.php' );
259
-
260
- /**
261
- * Load the sidebar functions.
262
- */
263
- require_once( WPMEM_PATH . 'inc/sidebar.php' );
264
-
265
  // Register the WP-Members widget.
266
  register_widget( 'widget_wpmemwidget' );
267
  }
@@ -476,17 +459,16 @@ function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
476
  // Get any meta fields that should be excluded.
477
  $exclude = wpmem_get_excluded_meta( 'register' );
478
 
479
- foreach ( $wpmem->fields as $field ) {
480
  $is_error = false;
481
- $meta_key = $field[2];
482
- if ( $field[5] == 'y' && $meta_key != 'user_email' && ! in_array( $meta_key, $exclude ) ) {
483
- if ( ( $field[3] == 'checkbox' || $field[3] == 'multicheckbox' || $field[3] == 'multiselect' || $field[3] == 'radio' ) && ( ! isset( $_POST[ $meta_key ] ) ) ) {
484
  $is_error = true;
485
  }
486
- if ( ( $field[3] != 'checkbox' && $field[3] != 'multicheckbox' && $field[3] != 'multiselect' && $field[3] != 'radio' ) && ( ! $_POST[ $meta_key ] ) ) {
487
  $is_error = true;
488
  }
489
- if ( $is_error ) { $errors->add( 'wpmem_error', sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $field[1], 'wp-members' ) ) ); }
490
  }
491
  }
492
 
@@ -508,25 +490,25 @@ function wpmem_wp_reg_validate( $errors, $sanitized_user_login, $user_email ) {
508
  function wpmem_wp_reg_finalize( $user_id ) {
509
 
510
  global $wpmem;
511
- $native_reg = ( isset( $_POST['wp-submit'] ) && $_POST['wp-submit'] == esc_attr( __( 'Register' ) ) ) ? true : false;
512
- $add_new = ( isset( $_POST['action'] ) && $_POST['action'] == 'createuser' ) ? true : false;
513
- if ( $native_reg || $add_new ) {
 
514
  // Get any excluded meta fields.
515
  $exclude = wpmem_get_excluded_meta( 'register' );
516
- foreach ( $wpmem->fields as $meta ) {
517
- if ( isset( $_POST[ $meta[2] ] ) && ! in_array( $meta[2], $exclude ) && 'file' != $meta[3] && 'image' != $meta[3] ) {
518
- if ( 'multiselect' == $meta[3] || 'multicheckbox' == $meta[3] ) {
519
- $delimiter = ( isset( $meta[8] ) ) ? $meta[8] : '|';
520
- $data = implode( $delimiter, $_POST[ $meta[2] ] );
521
  } else {
522
- $data = $_POST[ $meta[2] ];
523
  }
524
- update_user_meta( $user_id, $meta[2], sanitize_text_field( $data ) );
525
  }
526
  }
527
 
528
  // If moderated registration and activate is checked, set active flags.
529
- if ( is_admin() && $add_new && 1 == $wpmem->mod_reg && isset( $_POST['activate_user'] ) ) {
530
  update_user_meta( $user_id, 'active', 1 );
531
  wpmem_set_user_status( $user_id, 0 );
532
  }
@@ -599,6 +581,7 @@ function wpmem_securify_comments_array( $comments , $post_id ) {
599
  * Handles retrieving a forgotten username.
600
  *
601
  * @since 3.0.8
 
602
  *
603
  * @return string $regchk The regchk value.
604
  */
@@ -610,11 +593,6 @@ function wpmem_retrieve_username() {
610
  $user = ( isset( $_POST['user_email'] ) ) ? get_user_by( 'email', $email ) : false;
611
 
612
  if ( $user ) {
613
-
614
- /**
615
- * Load the email functions.
616
- */
617
- require_once( WPMEM_PATH . 'inc/email.php' );
618
 
619
  // Send it in an email.
620
  wpmem_inc_regemail( $user->ID, '', 4 );
16
  */
17
 
18
 
 
 
 
 
 
 
 
19
  /**
20
  * The Main Action Function.
21
  *
147
 
148
  // Determine where to put the user after login.
149
  if ( isset( $_POST['redirect_to'] ) ) {
150
+ $redirect_to = esc_url_raw( trim( $_POST['redirect_to'] ) );
151
  } else {
152
+ $redirect_to = esc_url_raw( $_SERVER['REQUEST_URI'] . ( ( isset( $_SERVER['QUERY_STRING'] ) ) ? $_SERVER['QUERY_STRING'] : '' ) );
153
  }
154
 
155
  /**
186
  * Logs the user out then redirects.
187
  *
188
  * @since 2.0.0
189
+ * @since 3.1.6 Added wp_destroy_current_session(), removed nocache_headers().
190
  *
191
  * @param string $redirect_to The URL to redirect to at logout.
192
  */
204
  */
205
  $redirect_to = apply_filters( 'wpmem_logout_redirect', $redirect_to );
206
 
207
+ wp_destroy_current_session();
208
  wp_clear_auth_cookie();
209
 
210
  /** This action is defined in /wp-includes/pluggable.php. */
211
  do_action( 'wp_logout' );
212
 
 
 
213
  wp_redirect( $redirect_to );
214
  exit();
215
  }
242
  * Initializes the WP-Members widget.
243
  *
244
  * @since 2.0.0
245
+ * @since 3.1.6 Dependencies now loaded by object.
246
  */
247
  function widget_wpmemwidget_init() {
 
 
 
 
 
 
 
 
 
 
 
248
  // Register the WP-Members widget.
249
  register_widget( 'widget_wpmemwidget' );
250
  }
459
  // Get any meta fields that should be excluded.
460
  $exclude = wpmem_get_excluded_meta( 'register' );
461
 
462
+ foreach ( wpmem_fields() as $meta_key => $field ) {
463
  $is_error = false;
464
+ if ( $field['required'] && $meta_key != 'user_email' && ! in_array( $meta_key, $exclude ) ) {
465
+ if ( ( $field['type'] == 'checkbox' || $field['type'] == 'multicheckbox' || $field['type'] == 'multiselect' || $field['type'] == 'radio' ) && ( ! isset( $_POST[ $meta_key ] ) ) ) {
 
466
  $is_error = true;
467
  }
468
+ if ( ( $field['type'] != 'checkbox' && $field['type'] != 'multicheckbox' && $field['type'] != 'multiselect' && $field['type'] != 'radio' ) && ( ! $_POST[ $meta_key ] ) ) {
469
  $is_error = true;
470
  }
471
+ if ( $is_error ) { $errors->add( 'wpmem_error', sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $field['label'], 'wp-members' ) ) ); }
472
  }
473
  }
474
 
490
  function wpmem_wp_reg_finalize( $user_id ) {
491
 
492
  global $wpmem;
493
+ $is_native = ( isset( $_POST['wp-submit'] ) && $_POST['wp-submit'] == esc_attr( __( 'Register' ) ) ) ? true : false;
494
+ $is_add_new = ( isset( $_POST['action'] ) && $_POST['action'] == 'createuser' ) ? true : false;
495
+ $is_woo = ( isset( $_POST['woocommerce_checkout_place_order'] ) || isset( $_POST['woocommerce-register-nonce'] ) ) ? true : false;
496
+ if ( $is_native || $is_add_new || $is_woo ) {
497
  // Get any excluded meta fields.
498
  $exclude = wpmem_get_excluded_meta( 'register' );
499
+ foreach ( wpmem_fields() as $meta_key => $field ) {
500
+ if ( isset( $_POST[ $meta_key ] ) && ! in_array( $meta_key, $exclude ) && 'file' != $field['type'] && 'image' != $field['type'] ) {
501
+ if ( 'multiselect' == $field['type'] || 'multicheckbox' == $field['type'] ) {
502
+ $data = implode( $field['delimiter'], $_POST[ $meta_key ] );
 
503
  } else {
504
+ $data = $_POST[ $meta_key ];
505
  }
506
+ update_user_meta( $user_id, $meta_key, sanitize_text_field( $data ) );
507
  }
508
  }
509
 
510
  // If moderated registration and activate is checked, set active flags.
511
+ if ( is_admin() && $is_add_new && 1 == $wpmem->mod_reg && isset( $_POST['activate_user'] ) ) {
512
  update_user_meta( $user_id, 'active', 1 );
513
  wpmem_set_user_status( $user_id, 0 );
514
  }
581
  * Handles retrieving a forgotten username.
582
  *
583
  * @since 3.0.8
584
+ * @since 3.1.6 Dependencies now loaded by object.
585
  *
586
  * @return string $regchk The regchk value.
587
  */
593
  $user = ( isset( $_POST['user_email'] ) ) ? get_user_by( 'email', $email ) : false;
594
 
595
  if ( $user ) {
 
 
 
 
 
596
 
597
  // Send it in an email.
598
  wpmem_inc_regemail( $user->ID, '', 4 );
inc/dialogs.php CHANGED
@@ -318,7 +318,17 @@ function wpmem_inc_memberlinks( $page = 'member' ) {
318
  *
319
  * @since 2.9.9
320
  *
321
- * @param array $args.
 
 
 
 
 
 
 
 
 
 
322
  */
323
  $args = apply_filters( "wpmem_{$page}_links_args", $args );
324
 
@@ -354,7 +364,17 @@ function wpmem_inc_memberlinks( $page = 'member' ) {
354
  *
355
  * @since 2.9.9
356
  *
357
- * @param array $args.
 
 
 
 
 
 
 
 
 
 
358
  */
359
  $args = apply_filters( 'wpmem_status_msg_args', $args );
360
 
318
  *
319
  * @since 2.9.9
320
  *
321
+ * @param array $args {
322
+ * The components of the links.
323
+ *
324
+ * @type string $wrapper_before The wrapper opening tag (default: <p>).
325
+ * @type string $wrapper_after The wrapper closing tag (default: </p>).
326
+ * @type string $user_login
327
+ * @type string $welcome
328
+ * @type string $logout_text
329
+ * @type string $logout_link
330
+ * @type string $separator
331
+ * }
332
  */
333
  $args = apply_filters( "wpmem_{$page}_links_args", $args );
334
 
364
  *
365
  * @since 2.9.9
366
  *
367
+ * @param array $args {
368
+ * The components of the links.
369
+ *
370
+ * @type string $wrapper_before The wrapper opening tag (default: <p>).
371
+ * @type string $wrapper_after The wrapper closing tag (default: </p>).
372
+ * @type string $user_login
373
+ * @type string $welcome
374
+ * @type string $logout_text
375
+ * @type string $logout_link
376
+ * @type string $separator
377
+ * }
378
  */
379
  $args = apply_filters( 'wpmem_status_msg_args', $args );
380
 
inc/email.php CHANGED
@@ -46,6 +46,9 @@ function wpmem_inc_regemail( $user_id, $password, $toggle, $wpmem_fields = null,
46
 
47
  global $wpmem;
48
 
 
 
 
49
  /*
50
  * Determine which email is being sent.
51
  *
@@ -123,11 +126,6 @@ function wpmem_inc_regemail( $user_id, $password, $toggle, $wpmem_fields = null,
123
  */
124
  $arr['headers'] = apply_filters( 'wpmem_email_headers', $default_header, $arr['toggle'] );
125
 
126
- // Handle backward compatibility for customizations that may call the email function directly.
127
- if ( ! $wpmem_fields ) {
128
- $wpmem_fields = $wpmem->fields;
129
- }
130
-
131
  /**
132
  * Filter the email.
133
  *
@@ -242,9 +240,8 @@ function wpmem_inc_regemail( $user_id, $password, $toggle, $wpmem_fields = null,
242
  );
243
 
244
  // Add custom field shortcodes.
245
- foreach ( $wpmem_fields as $field ) {
246
- $meta_key = $field[2];
247
- $val = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
248
  $shortcodes[ $meta_key ] = $val;
249
  }
250
 
@@ -300,13 +297,16 @@ if ( ! function_exists( 'wpmem_notify_admin' ) ):
300
  * @global object $wpmem The WP_Members object.
301
  * @global string $wpmem_mail_from The email from address.
302
  * @global string $wpmem_mail_from_name The email from name.
303
- * @param int $user_ID The User's ID.
304
  * @param array $wpmem_fields Array of the WP-Members fields (defaults to null).
305
- * @param array $fields Array of the registration data (defaults to null).
306
  */
307
- function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
308
 
309
  global $wpmem;
 
 
 
310
 
311
  // WP default user fields.
312
  $wp_user_fields = array(
@@ -344,21 +344,20 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
344
 
345
  // Builds an array of the user data fields.
346
  $field_arr = array();
347
- foreach ( $wpmem_fields as $field ) {
348
- if ( $field[4] == 'y' ) {
349
- $meta_key = $field[2];
350
  if ( ! in_array( $meta_key, wpmem_get_excluded_meta( 'email' ) ) ) {
351
- if ( ( $meta_key != 'user_email' ) && ( $meta_key != 'password' ) ) {
352
- if ( $meta_key == 'user_url' ) {
353
  $val = esc_url( $user->user_url );
354
  } elseif ( in_array( $meta_key, $wp_user_fields ) ) {
355
  $val = esc_html( $user->{$meta_key} );
356
- } elseif ( 'file' == $field[3] || 'image' == $field[3] ) {
357
  $val = wp_get_attachment_url( get_user_meta( $user_id, $meta_key, true ) );
358
  } else {
359
  $val = ( is_array( $field_data ) ) ? esc_html( $field_data[ $meta_key ] ) : esc_html( get_user_meta( $user_id, $meta_key, true ) );
360
  }
361
- $field_arr[ $field[1] ] = $val;
362
  }
363
  }
364
  }
@@ -373,7 +372,7 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
373
 
374
  // Handle backward compatibility for customizations that may call the email function directly.
375
  if ( ! $wpmem_fields ) {
376
- $wpmem_fields = $wpmem->fields;
377
  }
378
 
379
  /**
@@ -431,10 +430,9 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
431
  );
432
 
433
  // Add custom field shortcodes.
434
- foreach ( $wpmem_fields as $field ) {
435
- $meta_key = $field[2];
436
- $val = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
437
- $shortcodes[ $key ] = $val;
438
  }
439
 
440
  /**
@@ -457,10 +455,9 @@ function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {
457
  }
458
 
459
  // Create the custom field shortcodes.
460
- foreach ( $wpmem_fields as $field ) {
461
- $meta_key = $field[2];
462
  $shortcd[] = '[' . $meta_key . ']';
463
- $replace[] = ( is_array( $field_data ) && 'y' == $field[4] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
464
  }
465
 
466
  // Get the subject, body, and footer shortcodes.
46
 
47
  global $wpmem;
48
 
49
+ // Handle backward compatibility for customizations that may call the email function directly.
50
+ $wpmem_fields = wpmem_fields();
51
+
52
  /*
53
  * Determine which email is being sent.
54
  *
126
  */
127
  $arr['headers'] = apply_filters( 'wpmem_email_headers', $default_header, $arr['toggle'] );
128
 
 
 
 
 
 
129
  /**
130
  * Filter the email.
131
  *
240
  );
241
 
242
  // Add custom field shortcodes.
243
+ foreach ( $wpmem_fields as $meta_key => $field ) {
244
+ $val = ( is_array( $field_data ) && $field['register'] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
 
245
  $shortcodes[ $meta_key ] = $val;
246
  }
247
 
297
  * @global object $wpmem The WP_Members object.
298
  * @global string $wpmem_mail_from The email from address.
299
  * @global string $wpmem_mail_from_name The email from name.
300
+ * @param int $user_id The User's ID.
301
  * @param array $wpmem_fields Array of the WP-Members fields (defaults to null).
302
+ * @param array $field_data Array of the registration data (defaults to null).
303
  */
304
+ function wpmem_notify_admin( $user_id, $wpmem_fields = null, $field_data = null ) {
305
 
306
  global $wpmem;
307
+
308
+ // Handle backward compatibility for customizations that may call the email function directly.
309
+ $wpmem_fields = wpmem_fields();
310
 
311
  // WP default user fields.
312
  $wp_user_fields = array(
344
 
345
  // Builds an array of the user data fields.
346
  $field_arr = array();
347
+ foreach ( $wpmem_fields as $meta_key => $field ) {
348
+ if ( $field['register'] ) {
 
349
  if ( ! in_array( $meta_key, wpmem_get_excluded_meta( 'email' ) ) ) {
350
+ if ( ( 'user_email' != $meta_key ) && ( 'password' != $meta_key ) ) {
351
+ if ( 'user_url' == $meta_key ) {
352
  $val = esc_url( $user->user_url );
353
  } elseif ( in_array( $meta_key, $wp_user_fields ) ) {
354
  $val = esc_html( $user->{$meta_key} );
355
+ } elseif ( 'file' == $field['type'] || 'image' == $field['type'] ) {
356
  $val = wp_get_attachment_url( get_user_meta( $user_id, $meta_key, true ) );
357
  } else {
358
  $val = ( is_array( $field_data ) ) ? esc_html( $field_data[ $meta_key ] ) : esc_html( get_user_meta( $user_id, $meta_key, true ) );
359
  }
360
+ $field_arr[ $field['label'] ] = $val;
361
  }
362
  }
363
  }
372
 
373
  // Handle backward compatibility for customizations that may call the email function directly.
374
  if ( ! $wpmem_fields ) {
375
+ $wpmem_fields = wpmem_fields();
376
  }
377
 
378
  /**
430
  );
431
 
432
  // Add custom field shortcodes.
433
+ foreach ( $wpmem_fields as $meta_key => $field ) {
434
+ $val = ( is_array( $field_data ) && $field['register'] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
435
+ $shortcodes[ $meta_key ] = $val;
 
436
  }
437
 
438
  /**
455
  }
456
 
457
  // Create the custom field shortcodes.
458
+ foreach ( $wpmem_fields as $meta_key => $field ) {
 
459
  $shortcd[] = '[' . $meta_key . ']';
460
+ $replace[] = ( is_array( $field_data ) && $field['register'] ) ? $field_data[ $meta_key ] : get_user_meta( $user_id, $meta_key, true );
461
  }
462
 
463
  // Get the subject, body, and footer shortcodes.
inc/forms.php CHANGED
@@ -338,7 +338,7 @@ function wpmem_login_form( $page, $arr ) {
338
  *
339
  * @param array An array of arguments to merge with defaults. Default null.
340
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
341
- */
342
  $args = apply_filters( 'wpmem_login_form_args', '', $arr['action'] );
343
 
344
  // Merge $args with defaults.
@@ -371,7 +371,7 @@ function wpmem_login_form( $page, $arr ) {
371
  *
372
  * @param array $rows An array containing the form rows.
373
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
374
- */
375
  $rows = apply_filters( 'wpmem_login_form_rows', $rows, $arr['action'] );
376
 
377
  // Put the rows from the array into $form.
@@ -395,12 +395,12 @@ function wpmem_login_form( $page, $arr ) {
395
  *
396
  * @param string $hidden The generated HTML of hidden fields.
397
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
398
- */
399
  $form = $form . apply_filters( 'wpmem_login_hidden_fields', $hidden, $arr['action'] );
400
 
401
  // Build the buttons, filter, and add to the form.
402
  if ( $arr['action'] == 'login' ) {
403
- $args['remember_check'] = ( $args['remember_check'] ) ? $args['t'] . wpmem_create_formfield( 'rememberme', 'checkbox', 'forever' ) . '&nbsp;' . $wpmem->get_text( 'remember_me' ) . '&nbsp;&nbsp;' . $args['n'] : '';
404
  $buttons = $args['remember_check'] . $args['t'] . '<input type="submit" name="Submit" value="' . $arr['button_text'] . '" class="' . $args['button_class'] . '" />' . $args['n'];
405
  } else {
406
  $buttons = '<input type="submit" name="Submit" value="' . $arr['button_text'] . '" class="' . $args['button_class'] . '" />' . $args['n'];
@@ -415,7 +415,7 @@ function wpmem_login_form( $page, $arr ) {
415
  *
416
  * @param string $buttons The generated HTML of the form buttons.
417
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
418
- */
419
  $form = $form . apply_filters( 'wpmem_login_form_buttons', $args['buttons_before'] . $args['n'] . $buttons . $args['buttons_after'] . $args['n'], $arr['action'] );
420
 
421
  if ( ( $wpmem->user_pages['profile'] != null || $page == 'members' ) && $arr['action'] == 'login' ) {
@@ -426,7 +426,7 @@ function wpmem_login_form( $page, $arr ) {
426
  * @since 2.8.0
427
  *
428
  * @param string The forgot password link.
429
- */
430
  $link = apply_filters( 'wpmem_forgot_link', add_query_arg( 'a', 'pwdreset', $wpmem->user_pages['profile'] ) );
431
  $str = $wpmem->get_text( 'forgot_link_before' ) . '<a href="' . $link . '">' . $wpmem->get_text( 'forgot_link' ) . '</a>';
432
  /**
@@ -450,7 +450,7 @@ function wpmem_login_form( $page, $arr ) {
450
  * @since 2.8.0
451
  *
452
  * @param string The registration page link.
453
- */
454
  $link = apply_filters( 'wpmem_reg_link', $wpmem->user_pages['register'] );
455
  $str = $wpmem->get_text( 'register_link_before' ) . '<a href="' . $link . '">' . $wpmem->get_text( 'register_link' ) . '</a>';
456
  /**
@@ -517,7 +517,7 @@ function wpmem_login_form( $page, $arr ) {
517
  *
518
  * @param string $form The HTML of the final generated form.
519
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
520
- */
521
  $form = apply_filters( 'wpmem_login_form', $form, $arr['action'] );
522
 
523
  /**
@@ -530,7 +530,7 @@ function wpmem_login_form( $page, $arr ) {
530
  *
531
  * @param string $str The HTML to add before the form. Default null.
532
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
533
- */
534
  $form = apply_filters( 'wpmem_login_form_before', '', $arr['action'] ) . $form;
535
 
536
  return $form;
@@ -611,7 +611,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
611
  *
612
  * @param array An array of arguments to merge with defaults. Default null.
613
  * @param string $tag Toggle new registration or profile update. new|edit.
614
- */
615
  $args = apply_filters( 'wpmem_register_form_args', '', $tag );
616
 
617
  // Merge $args with defaults.
@@ -629,7 +629,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
629
  // This is a new registration.
630
  $val = ( isset( $_POST['user_login'] ) ) ? stripslashes( $_POST['user_login'] ) : '';
631
  $label = '<label for="user_login" class="text">' . $wpmem->get_text( 'register_username' ) . $args['req_mark'] . '</label>';
632
- $input = $wpmem->forms->create_form_field( array(
633
  'name' => 'user_login',
634
  'type' => 'text',
635
  'value' => $val,
@@ -643,7 +643,6 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
643
 
644
  // Add the username row to the array.
645
  $rows['username'] = array(
646
- 'order' => 0,
647
  'meta' => 'username',
648
  'type' => 'text',
649
  'value' => $val,
@@ -668,15 +667,14 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
668
  *
669
  * @param array The array of form fields.
670
  * @param string $tag Toggle new registration or profile update. new|edit.
671
- */
672
- $wpmem_fields = apply_filters( 'wpmem_register_fields_arr', $wpmem->fields, $tag );
 
673
 
674
  $hidden = '';
675
 
676
  // Loop through the remaining fields.
677
- foreach ( $wpmem_fields as $field ) {
678
-
679
- $meta_key = $field[2];
680
 
681
  // Start with a clean row.
682
  $val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = '';
@@ -688,32 +686,36 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
688
  // Skips tos, makes tos field hidden on user edit page, unless they haven't got a value for tos.
689
  if ( $meta_key == 'tos' && $tag == 'edit' && ( get_user_meta( $userdata->ID, 'tos', true ) ) ) {
690
  $do_row = false;
691
- $hidden_tos = wpmem_create_formfield( $meta_key, 'hidden', get_user_meta( $userdata->ID, 'tos', true ) );
 
 
 
 
692
  }
693
 
694
  // Handle hidden fields
695
- if ( 'hidden' == $field[3] ) {
696
  $do_row = false;
697
- $hidden.= $wpmem->forms->create_form_field( array(
698
  'name' => $meta_key,
699
- 'type' => $field[3],
700
- 'value' => $field[7],
701
  'compare' => $valtochk,
702
  //'class' => ( $class ) ? $class : 'textbox',
703
- 'required' => ( 'y' == $field[5] ) ? true : false,
704
  ) );
705
  }
706
 
707
  // If the field is set to display and we aren't skipping, construct the row.
708
- if ( $field[4] == 'y' && $do_row == true ) {
709
 
710
  // Label for all but TOS.
711
  if ( $meta_key != 'tos' ) {
712
 
713
- $class = ( $field[3] == 'password' || $field[3] == 'email' || $field[3] == 'url' ) ? 'text' : $field[3];
714
 
715
- $label = '<label for="' . $meta_key . '" class="' . $class . '">' . __( $field[1], 'wp-members' );
716
- $label = ( $field[5] == 'y' ) ? $label . $args['req_mark'] : $label;
717
  $label = $label . '</label>';
718
 
719
  }
@@ -745,7 +747,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
745
  }
746
 
747
  } else {
748
- if ( 'file' == $field[3] ) {
749
  $val = ( isset( $_FILES[ $meta_key ]['name'] ) ) ? $_FILES[ $meta_key ]['name'] : '' ;
750
  } else {
751
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
@@ -758,9 +760,14 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
758
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
759
 
760
  // Should be checked by default? and only if form hasn't been submitted.
761
- $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
762
- $input = wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
763
- $input = ( $field[5] == 'y' ) ? $input . $args['req_mark'] : $input;
 
 
 
 
 
764
 
765
  // Determine if TOS is a WP page or not.
766
  $tos_content = stripslashes( get_option( 'wpmembers_tos' ) );
@@ -788,50 +795,56 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
788
  } else {
789
 
790
  // For checkboxes.
791
- if ( $field[3] == 'checkbox' ) {
792
  $valtochk = $val;
793
- $val = $field[7];
794
  // if it should it be checked by default (& only if form not submitted), then override above...
795
- if ( $field[8] == 'y' && ( ! $_POST && $tag != 'edit' ) ) { $val = $valtochk = $field[7]; }
796
  }
797
 
798
  // For dropdown select.
799
- if ( $field[3] == 'select' || $field[3] == 'radio' || $field[3] == 'multiselect' || $field[3] == 'multicheckbox' ) {
800
  $valtochk = $val;
801
- $val = $field[7];
802
  }
803
 
804
  if ( ! isset( $valtochk ) ) { $valtochk = ''; }
805
 
806
- if ( 'edit' == $tag && ( 'file' == $field[3] || 'image' == $field[3] ) ) {
807
 
808
  $attachment_url = wp_get_attachment_url( $val );
809
  $empty_file = '<span class="description">' . __( 'None' ) . '</span>';
810
- if ( 'file' == $field[3] ) {
811
  $input = ( $attachment_url ) ? '<a href="' . $attachment_url . '">' . get_the_title( $val ) . '</a>' : $empty_file;
812
  } else {
813
  $input = ( $attachment_url ) ? '<img src="' . $attachment_url . '">' : $empty_file;
814
  }
815
  // @todo - come up with a way to handle file updates - user profile form does not support multitype
816
  $input.= '<br />' . $wpmem->get_text( 'profile_upload' ) . '<br />';
817
- $input.= wpmem_create_formfield( $meta_key, $field[3], $val, $valtochk );
 
 
 
 
 
818
 
819
  } else {
820
 
821
  // For all other input types.
822
- //$input = wpmem_create_formfield( $field[2], $field[3], $val, $valtochk );
823
  $formfield_args = array(
824
  'name' => $meta_key,
825
- 'type' => $field[3],
826
  'value' => $val,
827
  'compare' => $valtochk,
828
  //'class' => ( $class ) ? $class : 'textbox',
829
- 'required' => ( 'y' == $field[5] ) ? true : false,
 
830
  );
831
- if ( 'multicheckbox' == $field[3] || 'multiselect' == $field[3] ) {
832
- $formfield_args['delimiter'] = ( isset( $field[8] ) ) ? $field[8] : '|';
833
  }
834
- $input = $wpmem->forms->create_form_field( $formfield_args );
835
 
836
  }
837
 
@@ -843,21 +856,20 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
843
  }
844
 
845
  // If the row is set to display, add the row to the form array.
846
- if ( $field[4] == 'y' ) {
847
 
848
  $values = '';
849
- if ( 'multicheckbox' == $field[3] || 'select' == $field[3] || 'multiselect' == $field[3] || 'radio' == $field[3] ) {
850
  $values = $val;
851
  $val = $valtochk;
852
  }
853
 
854
  $rows[ $meta_key ] = array(
855
- 'order' => $field[0],
856
  'meta' => $meta_key,
857
- 'type' => $field[3],
858
  'value' => $val,
859
  'values' => $values,
860
- 'label_text' => __( $field[1], 'wp-members' ),
861
  'row_before' => $args['row_before'],
862
  'label' => $label,
863
  'field_before' => $field_before,
@@ -872,7 +884,6 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
872
  if ( $wpmem->captcha == 2 && $tag != 'edit' ) {
873
  $row = wpmem_build_rs_captcha();
874
  $rows['captcha'] = array(
875
- 'order' => '',
876
  'meta' => '',
877
  'type' => 'text',
878
  'value' => '',
@@ -897,11 +908,12 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
897
  * @since 2.9.0
898
  * @since 3.0.9 Added $rows['label_text'].
899
  * @since 3.1.0 Added $rows['key'].
 
900
  *
901
  * @param array $rows {
902
  * An array containing the form rows.
903
  *
904
- * @type string order Field display order.
905
  * @type string meta Field meta tag (not used for display).
906
  * @type string type Input field type (not used for display).
907
  * @type string value Input field value (not used for display).
@@ -915,7 +927,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
915
  * @type string row_after Closing wrapper tag around the row.
916
  * }
917
  * @param string $tag Toggle new registration or profile update. new|edit.
918
- */
919
  $rows = apply_filters( 'wpmem_register_form_rows', $rows, $tag );
920
 
921
  // Put the rows from the array into $form.
@@ -947,7 +959,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
947
  *
948
  * @param string The HTML for the entire row (includes HTML tags plus reCAPTCHA).
949
  * @param string $tag Toggle new registration or profile update. new|edit.
950
- */
951
  $form.= apply_filters( 'wpmem_register_captcha_row', $args['row_before'] . $row . $args['row_after'], $tag );
952
  }
953
 
@@ -968,7 +980,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
968
  *
969
  * @param string $hidden The generated HTML of hidden fields.
970
  * @param string $tag Toggle new registration or profile update. new|edit.
971
- */
972
  $hidden = apply_filters( 'wpmem_register_hidden_fields', $hidden, $tag );
973
 
974
  // Add the hidden fields to the form.
@@ -988,7 +1000,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
988
  *
989
  * @param string $buttons The generated HTML of the form buttons.
990
  * @param string $tag Toggle new registration or profile update. new|edit.
991
- */
992
  $buttons = apply_filters( 'wpmem_register_form_buttons', $buttons, $tag );
993
 
994
  // Add the buttons to the form.
@@ -1005,7 +1017,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
1005
  *
1006
  * @param string $str
1007
  * @param string $tag Toggle new registration or profile update. new|edit.
1008
- */
1009
  $heading = ( !$heading ) ? apply_filters( 'wpmem_register_heading', $wpmem->get_text( 'register_heading' ), $tag ) : $heading;
1010
  $form = $args['heading_before'] . $heading . $args['heading_after'] . $args['n'] . $form;
1011
 
@@ -1040,8 +1052,8 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
1040
  *
1041
  * @since 2.7.4
1042
  *
1043
- * @param string $form The HTML of the final generated form.
1044
- * @param string $tag Toggle new registration or profile update. new|edit.
1045
  * @param array $rows {
1046
  * An array containing the form rows.
1047
  *
@@ -1059,7 +1071,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
1059
  * @type string row_after Closing wrapper tag around the row.
1060
  * }
1061
  * @param string $hidden The HTML string of hidden fields
1062
- */
1063
  $form = apply_filters( 'wpmem_register_form', $form, $tag, $rows, $hidden );
1064
 
1065
  /**
@@ -1072,7 +1084,7 @@ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = nul
1072
  *
1073
  * @param string $str The HTML to add before the form. Default null.
1074
  * @param string $tag Toggle new registration or profile update. new|edit.
1075
- */
1076
  $form = apply_filters( 'wpmem_register_form_before', '', $tag ) . $form;
1077
 
1078
  // Return the generated form.
338
  *
339
  * @param array An array of arguments to merge with defaults. Default null.
340
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
341
+ */
342
  $args = apply_filters( 'wpmem_login_form_args', '', $arr['action'] );
343
 
344
  // Merge $args with defaults.
371
  *
372
  * @param array $rows An array containing the form rows.
373
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
374
+ */
375
  $rows = apply_filters( 'wpmem_login_form_rows', $rows, $arr['action'] );
376
 
377
  // Put the rows from the array into $form.
395
  *
396
  * @param string $hidden The generated HTML of hidden fields.
397
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
398
+ */
399
  $form = $form . apply_filters( 'wpmem_login_hidden_fields', $hidden, $arr['action'] );
400
 
401
  // Build the buttons, filter, and add to the form.
402
  if ( $arr['action'] == 'login' ) {
403
+ $args['remember_check'] = ( $args['remember_check'] ) ? $args['t'] . wpmem_create_formfield( 'rememberme', 'checkbox', 'forever' ) . '&nbsp;' . '<label for="rememberme">' . $wpmem->get_text( 'remember_me' ) . '</label>&nbsp;&nbsp;' . $args['n'] : '';
404
  $buttons = $args['remember_check'] . $args['t'] . '<input type="submit" name="Submit" value="' . $arr['button_text'] . '" class="' . $args['button_class'] . '" />' . $args['n'];
405
  } else {
406
  $buttons = '<input type="submit" name="Submit" value="' . $arr['button_text'] . '" class="' . $args['button_class'] . '" />' . $args['n'];
415
  *
416
  * @param string $buttons The generated HTML of the form buttons.
417
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
418
+ */
419
  $form = $form . apply_filters( 'wpmem_login_form_buttons', $args['buttons_before'] . $args['n'] . $buttons . $args['buttons_after'] . $args['n'], $arr['action'] );
420
 
421
  if ( ( $wpmem->user_pages['profile'] != null || $page == 'members' ) && $arr['action'] == 'login' ) {
426
  * @since 2.8.0
427
  *
428
  * @param string The forgot password link.
429
+ */
430
  $link = apply_filters( 'wpmem_forgot_link', add_query_arg( 'a', 'pwdreset', $wpmem->user_pages['profile'] ) );
431
  $str = $wpmem->get_text( 'forgot_link_before' ) . '<a href="' . $link . '">' . $wpmem->get_text( 'forgot_link' ) . '</a>';
432
  /**
450
  * @since 2.8.0
451
  *
452
  * @param string The registration page link.
453
+ */
454
  $link = apply_filters( 'wpmem_reg_link', $wpmem->user_pages['register'] );
455
  $str = $wpmem->get_text( 'register_link_before' ) . '<a href="' . $link . '">' . $wpmem->get_text( 'register_link' ) . '</a>';
456
  /**
517
  *
518
  * @param string $form The HTML of the final generated form.
519
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
520
+ */
521
  $form = apply_filters( 'wpmem_login_form', $form, $arr['action'] );
522
 
523
  /**
530
  *
531
  * @param string $str The HTML to add before the form. Default null.
532
  * @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange|getusername.
533
+ */
534
  $form = apply_filters( 'wpmem_login_form_before', '', $arr['action'] ) . $form;
535
 
536
  return $form;
611
  *
612
  * @param array An array of arguments to merge with defaults. Default null.
613
  * @param string $tag Toggle new registration or profile update. new|edit.
614
+ */
615
  $args = apply_filters( 'wpmem_register_form_args', '', $tag );
616
 
617
  // Merge $args with defaults.
629
  // This is a new registration.
630
  $val = ( isset( $_POST['user_login'] ) ) ? stripslashes( $_POST['user_login'] ) : '';
631
  $label = '<label for="user_login" class="text">' . $wpmem->get_text( 'register_username' ) . $args['req_mark'] . '</label>';
632
+ $input = wpmem_form_field( array(
633
  'name' => 'user_login',
634
  'type' => 'text',
635
  'value' => $val,
643
 
644
  // Add the username row to the array.
645
  $rows['username'] = array(
 
646
  'meta' => 'username',
647
  'type' => 'text',
648
  'value' => $val,
667
  *
668
  * @param array The array of form fields.
669
  * @param string $tag Toggle new registration or profile update. new|edit.
670
+ */
671
+ $wpmem_fields = apply_filters( 'wpmem_register_fields_arr', wpmem_fields(), $tag );
672
+ //$wpmem_fields = wpmem_verify_fields( $wpmem_fields );
673
 
674
  $hidden = '';
675
 
676
  // Loop through the remaining fields.
677
+ foreach ( $wpmem_fields as $meta_key => $field ) {
 
 
678
 
679
  // Start with a clean row.
680
  $val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = '';
686
  // Skips tos, makes tos field hidden on user edit page, unless they haven't got a value for tos.
687
  if ( $meta_key == 'tos' && $tag == 'edit' && ( get_user_meta( $userdata->ID, 'tos', true ) ) ) {
688
  $do_row = false;
689
+ $hidden_tos = wpmem_form_field( array(
690
+ 'name' => $meta_key,
691
+ 'type' => 'hidden',
692
+ 'value' => get_user_meta( $userdata->ID, 'tos', true )
693
+ ) );
694
  }
695
 
696
  // Handle hidden fields
697
+ if ( 'hidden' == $field['type'] ) {
698
  $do_row = false;
699
+ $hidden.= wpmem_form_field( array(
700
  'name' => $meta_key,
701
+ 'type' => $field['type'],
702
+ 'value' => $field['value'],
703
  'compare' => $valtochk,
704
  //'class' => ( $class ) ? $class : 'textbox',
705
+ 'required' => $field['required'],
706
  ) );
707
  }
708
 
709
  // If the field is set to display and we aren't skipping, construct the row.
710
+ if ( $do_row && $field['register'] ) {
711
 
712
  // Label for all but TOS.
713
  if ( $meta_key != 'tos' ) {
714
 
715
+ $class = ( $field['type'] == 'password' || $field['type'] == 'email' || $field['type'] == 'url' ) ? 'text' : $field['type'];
716
 
717
+ $label = '<label for="' . $meta_key . '" class="' . $class . '">' . __( $field['label'], 'wp-members' );
718
+ $label = ( $field['required'] ) ? $label . $args['req_mark'] : $label;
719
  $label = $label . '</label>';
720
 
721
  }
747
  }
748
 
749
  } else {
750
+ if ( 'file' == $field['type'] ) {
751
  $val = ( isset( $_FILES[ $meta_key ]['name'] ) ) ? $_FILES[ $meta_key ]['name'] : '' ;
752
  } else {
753
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
760
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
761
 
762
  // Should be checked by default? and only if form hasn't been submitted.
763
+ $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
764
+ $input = wpmem_form_field( array(
765
+ 'name' => $meta_key,
766
+ 'type' => $field['type'],
767
+ 'value' => $field['checked_value'],
768
+ 'compare' => $val
769
+ ) );
770
+ $input = ( $field['required'] ) ? $input . $args['req_mark'] : $input;
771
 
772
  // Determine if TOS is a WP page or not.
773
  $tos_content = stripslashes( get_option( 'wpmembers_tos' ) );
795
  } else {
796
 
797
  // For checkboxes.
798
+ if ( $field['type'] == 'checkbox' ) {
799
  $valtochk = $val;
800
+ $val = $field['checked_value'];
801
  // if it should it be checked by default (& only if form not submitted), then override above...
802
+ if ( $field['checked_default'] && ( ! $_POST && $tag != 'edit' ) ) { $val = $valtochk = $field['checked_value']; }
803
  }
804
 
805
  // For dropdown select.
806
+ if ( $field['type'] == 'select' || $field['type'] == 'radio' || $field['type'] == 'multiselect' || $field['type'] == 'multicheckbox' ) {
807
  $valtochk = $val;
808
+ $val = $field['values'];
809
  }
810
 
811
  if ( ! isset( $valtochk ) ) { $valtochk = ''; }
812
 
813
+ if ( 'edit' == $tag && ( 'file' == $field['type'] || 'image' == $field['type'] ) ) {
814
 
815
  $attachment_url = wp_get_attachment_url( $val );
816
  $empty_file = '<span class="description">' . __( 'None' ) . '</span>';
817
+ if ( 'file' == $field['type'] ) {
818
  $input = ( $attachment_url ) ? '<a href="' . $attachment_url . '">' . get_the_title( $val ) . '</a>' : $empty_file;
819
  } else {
820
  $input = ( $attachment_url ) ? '<img src="' . $attachment_url . '">' : $empty_file;
821
  }
822
  // @todo - come up with a way to handle file updates - user profile form does not support multitype
823
  $input.= '<br />' . $wpmem->get_text( 'profile_upload' ) . '<br />';
824
+ $input.= wpmem_form_field( array(
825
+ 'name' => $meta_key,
826
+ 'type' => $field['type'],
827
+ 'value' => $val,
828
+ 'compare' => $valtochk,
829
+ ) );
830
 
831
  } else {
832
 
833
  // For all other input types.
834
+ //$input = wpmem_create_formfield( $meta_key, $field['type'], $val, $valtochk );
835
  $formfield_args = array(
836
  'name' => $meta_key,
837
+ 'type' => $field['type'],
838
  'value' => $val,
839
  'compare' => $valtochk,
840
  //'class' => ( $class ) ? $class : 'textbox',
841
+ 'required' => $field['required'],
842
+ 'placeholder' => ( isset( $field['placeholder'] ) ) ? $field['placeholder'] : '',
843
  );
844
+ if ( 'multicheckbox' == $field['type'] || 'multiselect' == $field['type'] ) {
845
+ $formfield_args['delimiter'] = $field['delimiter'];
846
  }
847
+ $input = wpmem_form_field( $formfield_args );
848
 
849
  }
850
 
856
  }
857
 
858
  // If the row is set to display, add the row to the form array.
859
+ if ( $field['register'] ) {
860
 
861
  $values = '';
862
+ if ( 'multicheckbox' == $field['type'] || 'select' == $field['type'] || 'multiselect' == $field['type'] || 'radio' == $field['type'] ) {
863
  $values = $val;
864
  $val = $valtochk;
865
  }
866
 
867
  $rows[ $meta_key ] = array(
 
868
  'meta' => $meta_key,
869
+ 'type' => $field['type'],
870
  'value' => $val,
871
  'values' => $values,
872
+ 'label_text' => __( $field['label'], 'wp-members' ),
873
  'row_before' => $args['row_before'],
874
  'label' => $label,
875
  'field_before' => $field_before,
884
  if ( $wpmem->captcha == 2 && $tag != 'edit' ) {
885
  $row = wpmem_build_rs_captcha();
886
  $rows['captcha'] = array(
 
887
  'meta' => '',
888
  'type' => 'text',
889
  'value' => '',
908
  * @since 2.9.0
909
  * @since 3.0.9 Added $rows['label_text'].
910
  * @since 3.1.0 Added $rows['key'].
911
+ * @since 3.1.6 Deprecated $rows['order'].
912
  *
913
  * @param array $rows {
914
  * An array containing the form rows.
915
  *
916
+ * @type string order Field display order. (deprecated as of 3.1.6)
917
  * @type string meta Field meta tag (not used for display).
918
  * @type string type Input field type (not used for display).
919
  * @type string value Input field value (not used for display).
927
  * @type string row_after Closing wrapper tag around the row.
928
  * }
929
  * @param string $tag Toggle new registration or profile update. new|edit.
930
+ */
931
  $rows = apply_filters( 'wpmem_register_form_rows', $rows, $tag );
932
 
933
  // Put the rows from the array into $form.
959
  *
960
  * @param string The HTML for the entire row (includes HTML tags plus reCAPTCHA).
961
  * @param string $tag Toggle new registration or profile update. new|edit.
962
+ */
963
  $form.= apply_filters( 'wpmem_register_captcha_row', $args['row_before'] . $row . $args['row_after'], $tag );
964
  }
965
 
980
  *
981
  * @param string $hidden The generated HTML of hidden fields.
982
  * @param string $tag Toggle new registration or profile update. new|edit.
983
+ */
984
  $hidden = apply_filters( 'wpmem_register_hidden_fields', $hidden, $tag );
985
 
986
  // Add the hidden fields to the form.
1000
  *
1001
  * @param string $buttons The generated HTML of the form buttons.
1002
  * @param string $tag Toggle new registration or profile update. new|edit.
1003
+ */
1004
  $buttons = apply_filters( 'wpmem_register_form_buttons', $buttons, $tag );
1005
 
1006
  // Add the buttons to the form.
1017
  *
1018
  * @param string $str
1019
  * @param string $tag Toggle new registration or profile update. new|edit.
1020
+ */
1021
  $heading = ( !$heading ) ? apply_filters( 'wpmem_register_heading', $wpmem->get_text( 'register_heading' ), $tag ) : $heading;
1022
  $form = $args['heading_before'] . $heading . $args['heading_after'] . $args['n'] . $form;
1023
 
1052
  *
1053
  * @since 2.7.4
1054
  *
1055
+ * @param string $form The HTML of the final generated form.
1056
+ * @param string $tag Toggle new registration or profile update. new|edit.
1057
  * @param array $rows {
1058
  * An array containing the form rows.
1059
  *
1071
  * @type string row_after Closing wrapper tag around the row.
1072
  * }
1073
  * @param string $hidden The HTML string of hidden fields
1074
+ */
1075
  $form = apply_filters( 'wpmem_register_form', $form, $tag, $rows, $hidden );
1076
 
1077
  /**
1084
  *
1085
  * @param string $str The HTML to add before the form. Default null.
1086
  * @param string $tag Toggle new registration or profile update. new|edit.
1087
+ */
1088
  $form = apply_filters( 'wpmem_register_form_before', '', $tag ) . $form;
1089
 
1090
  // Return the generated form.
inc/register.php CHANGED
@@ -60,33 +60,31 @@ function wpmem_registration( $tag ) {
60
  $fields['user_email'] = ( isset( $_POST['user_email'] ) ) ? sanitize_email( $_POST['user_email'] ) : '';
61
 
62
  /** This filter defined in inc/class-wp-members-forms.php */
63
- $wpmem_fields = apply_filters( 'wpmem_register_fields_arr', $wpmem->fields, $tag );
64
 
65
  // Build the $fields array from $_POST data.
66
- $wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' );
67
- foreach ( $wpmem_fields as $meta ) {
68
- if ( $meta[4] == 'y' ) {
69
- if ( $meta[2] != 'password' || $meta[2] != 'confirm_password' ) {
70
- if ( isset( $_POST[ $meta[2] ] ) ) {
71
- switch ( $meta[3] ) {
72
  case 'checkbox':
73
- $fields[ $meta[2] ] = sanitize_text_field( $_POST[ $meta[2] ] );
74
  break;
75
  case 'multiselect':
76
  case 'multicheckbox':
77
- $delimiter = ( isset( $meta[8] ) ) ? $meta[8] : '|';
78
- $fields[ $meta[2] ] = ( isset( $_POST[ $meta[2] ] ) ) ? implode( $delimiter, $_POST[ $meta[2] ] ) : '';
79
- $fields[ $meta[2] ] = sanitize_text_field( $fields[ $meta[2] ] );
80
  break;
81
  case 'textarea':
82
- $fields[ $meta[2] ] = $_POST[ $meta[2] ];
83
  break;
84
  default:
85
- $fields[ $meta[2] ] = sanitize_text_field( $_POST[ $meta[2] ] );
86
  break;
87
  }
88
  } else {
89
- $fields[ $meta[2] ] = '';
90
  }
91
  } else {
92
  // We do have password as part of the registration form.
@@ -112,23 +110,23 @@ function wpmem_registration( $tag ) {
112
  // Check for required fields, reverse the array for logical error message order.
113
  $wpmem_fields_rev = array_reverse( $wpmem_fields );
114
 
115
- foreach ( $wpmem_fields_rev as $meta ) {
116
  $pass_arr = array( 'password', 'confirm_password', 'password_confirm' );
117
- $pass_chk = ( $tag == 'update' && in_array( $meta[2], $pass_arr ) ) ? true : false;
118
  // Validation if the field is required.
119
- if ( $meta[5] == 'y' && $pass_chk == false ) {
120
- if ( 'file' == $meta[3] || 'image' == $meta[3] ) {
121
  // If this is a new registration.
122
  if ( 'register' == $tag ) {
123
  // If the required field is a file type.
124
- if ( empty( $_FILES[ $meta[2] ]['name'] ) ) {
125
- $wpmem_themsg = sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $meta[1], 'wp-members' ) );
126
  }
127
  }
128
  } else {
129
  // If the required field is any other field type.
130
- if ( ! $fields[ $meta[2] ] ) {
131
- $wpmem_themsg = sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $meta[1], 'wp-members' ) );
132
  }
133
  }
134
  }
@@ -169,104 +167,11 @@ function wpmem_registration( $tag ) {
169
  $wpmem_themsg = $wpmem->get_text( 'reg_email_match' );
170
  }
171
 
172
- // Get the captcha settings (api keys).
173
- $wpmem_captcha = get_option( 'wpmembers_captcha' );
174
-
175
- // If captcha is on, check the captcha.
176
- if ( $wpmem->captcha == 1 && $wpmem_captcha['recaptcha'] ) {
177
-
178
- // If there is no api key, the captcha never displayed to the end user.
179
- if ( $wpmem_captcha['recaptcha']['public'] && $wpmem_captcha['recaptcha']['private'] ) {
180
- if ( ! $_POST["recaptcha_response_field"] ) { // validate for empty captcha field
181
- $wpmem_themsg = $wpmem->get_text( 'reg_empty_captcha' );
182
- return "empty"; exit();
183
- }
184
- }
185
-
186
- // Check to see if the recaptcha library has already been loaded by another plugin.
187
- if ( ! function_exists( '_recaptcha_qsencode' ) ) {
188
- require_once( WPMEM_PATH . 'lib/recaptchalib.php' );
189
- }
190
-
191
- $publickey = $wpmem_captcha['recaptcha']['public'];
192
- $privatekey = $wpmem_captcha['recaptcha']['private'];
193
-
194
- // The response from reCAPTCHA.
195
- $resp = null;
196
- // The error code from reCAPTCHA, if any.
197
- $error = null;
198
-
199
- if ( $_POST["recaptcha_response_field"] ) {
200
-
201
- $resp = recaptcha_check_answer (
202
- $privatekey,
203
- $_SERVER["REMOTE_ADDR"],
204
- $_POST["recaptcha_challenge_field"],
205
- $_POST["recaptcha_response_field"]
206
- );
207
-
208
- if ( ! $resp->is_valid ) {
209
-
210
- // Set the error code so that we can display it.
211
- global $wpmem_captcha_err;
212
- $wpmem_captcha_err = $resp->error;
213
- $wpmem_captcha_err = wpmem_get_captcha_err( $wpmem_captcha_err );
214
-
215
- return "captcha";
216
- exit();
217
-
218
- }
219
- } // End check recaptcha.
220
- } elseif ( $wpmem->captcha == 2 ) {
221
- if ( defined( 'REALLYSIMPLECAPTCHA_VERSION' ) ) {
222
- // Validate Really Simple Captcha.
223
- $wpmem_captcha = new ReallySimpleCaptcha();
224
- // This variable holds the CAPTCHA image prefix, which corresponds to the correct answer.
225
- $wpmem_captcha_prefix = ( isset( $_POST['captcha_prefix'] ) ) ? $_POST['captcha_prefix'] : '';
226
- // This variable holds the CAPTCHA response, entered by the user.
227
- $wpmem_captcha_code = ( isset( $_POST['captcha_code'] ) ) ? $_POST['captcha_code'] : '';
228
- // Check CAPTCHA validity.
229
- $wpmem_captcha_correct = ( $wpmem_captcha->check( $wpmem_captcha_prefix, $wpmem_captcha_code ) ) ? true : false;
230
- // Clean up the tmp directory.
231
- $wpmem_captcha->remove( $wpmem_captcha_prefix );
232
- $wpmem_captcha->cleanup();
233
- // If CAPTCHA validation fails (incorrect value entered in CAPTCHA field), return an error.
234
- if ( ! $wpmem_captcha_correct ) {
235
- $wpmem_themsg = wpmem_get_captcha_err( 'really-simple' );
236
- return "empty"; exit();
237
- }
238
- }
239
- } elseif ( $wpmem->captcha == 3 && $wpmem_captcha['recaptcha'] ) {
240
- // Get the captcha response.
241
- if ( isset( $_POST['g-recaptcha-response'] ) ) {
242
- $captcha = $_POST['g-recaptcha-response'];
243
- }
244
-
245
- // If there is no captcha value, return error.
246
- if ( ! $captcha ) {
247
- $wpmem_themsg = $wpmem->get_text( 'reg_empty_captcha' );
248
- return "empty"; exit();
249
- }
250
-
251
- // We need the private key for validation.
252
- $privatekey = $wpmem_captcha['recaptcha']['private'];
253
-
254
- // Validate the captcha.
255
- $response = wp_remote_fopen( "https://www.google.com/recaptcha/api/siteverify?secret=" . $privatekey . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR'] );
256
-
257
- // Decode the json response.
258
- $response = json_decode( $response, true );
259
-
260
- // If captcha validation was unsuccessful.
261
- if ( $response['success'] == false ) {
262
- $wpmem_themsg = $wpmem->get_text( 'reg_invalid_captcha' );
263
- if ( WP_DEBUG && isset( $response['error-codes'] ) ) {
264
- $wpmem_themsg.= '<br /><br />';
265
- foreach( $response['error-codes'] as $code ) {
266
- $wpmem_themsg.= "Error code: " . $code . "<br />";
267
- }
268
- }
269
- return "empty"; exit();
270
  }
271
  }
272
 
@@ -334,10 +239,10 @@ function wpmem_registration( $tag ) {
334
 
335
  // Fields for wp_insert_user: user_url, first_name, last_name, description, jabber, aim, yim.
336
  $new_user_fields_meta = array( 'user_url', 'first_name', 'last_name', 'description', 'jabber', 'aim', 'yim' );
337
- foreach ( $wpmem_fields as $meta ) {
338
- if ( in_array( $meta[2], $new_user_fields_meta ) ) {
339
- if ( $meta[4] == 'y' && ! in_array( $meta[2], $excluded_meta ) ) {
340
- $new_user_fields[ $meta[2] ] = $fields[ $meta[2] ];
341
  }
342
  }
343
  }
@@ -346,11 +251,11 @@ function wpmem_registration( $tag ) {
346
  $fields['ID'] = wp_insert_user( $new_user_fields );
347
 
348
  // Set remaining fields to wp_usermeta table.
349
- foreach ( $wpmem_fields as $meta ) {
350
  // If the field is not excluded, update accordingly.
351
- if ( ! in_array( $meta[2], $excluded_meta ) && ! in_array( $meta[2], $new_user_fields_meta ) ) {
352
- if ( $meta[4] == 'y' && $meta[2] != 'user_email' ) {
353
- update_user_meta( $fields['ID'], $meta[2], $fields[ $meta[2] ] );
354
  }
355
  }
356
  }
@@ -371,15 +276,15 @@ function wpmem_registration( $tag ) {
371
  // Handle file uploads, if any.
372
  if ( ! empty( $_FILES ) ) {
373
 
374
- foreach ( $wpmem->fields as $file_field ) {
375
 
376
- if ( ( 'file' == $file_field[3] || 'image' == $file_field[3] ) && is_array( $_FILES[ $file_field[2] ] ) ) {
377
 
378
  // Upload the file and save it as an attachment.
379
- $file_post_id = $wpmem->forms->do_file_upload( $_FILES[ $file_field[2] ], $fields['ID'] );
380
 
381
  // Save the attachment ID as user meta.
382
- update_user_meta( $fields['ID'], $file_field[2], $file_post_id );
383
  }
384
  }
385
  }
@@ -393,8 +298,6 @@ function wpmem_registration( $tag ) {
393
  */
394
  do_action( 'wpmem_post_register_data', $fields );
395
 
396
- require_once( WPMEM_PATH . 'inc/email.php' );
397
-
398
  /*
399
  * If this was successful, and you have email properly
400
  * configured, send a notification email to the user.
@@ -498,16 +401,16 @@ function wpmem_registration( $tag ) {
498
  );
499
  $native_update = array( 'ID' => $user_ID );
500
 
501
- foreach ( $wpmem_fields as $meta ) {
502
  // If the field is not excluded, update accordingly.
503
- if ( ! in_array( $meta[2], wpmem_get_excluded_meta( 'update' ) ) ) {
504
- if ( 'file' != $meta[3] && 'image' != $meta[3] ) {
505
- switch ( $meta[2] ) {
506
 
507
  // If the field can be updated by wp_update_user.
508
- case( in_array( $meta[2], $native_fields ) ):
509
- $fields[ $meta[2] ] = ( isset( $fields[ $meta[2] ] ) ) ? $fields[ $meta[2] ] : '';
510
- $native_update[ $meta[2] ] = $fields[ $meta[2] ];
511
  break;
512
 
513
  // If the field is password.
@@ -517,8 +420,8 @@ function wpmem_registration( $tag ) {
517
 
518
  // Everything else goes into wp_usermeta.
519
  default:
520
- if ( $meta[4] == 'y' ) {
521
- update_user_meta( $user_ID, $meta[2], $fields[ $meta[2] ] );
522
  }
523
  break;
524
  }
@@ -529,15 +432,15 @@ function wpmem_registration( $tag ) {
529
  // Handle file uploads, if any.
530
  if ( ! empty( $_FILES ) ) {
531
 
532
- foreach ( $wpmem->fields as $file_field ) {
533
 
534
- if ( ( 'file' == $file_field[3] || 'image' == $file_field[3] ) && is_array( $_FILES[ $file_field[2] ] ) ) {
535
- if ( ! empty( $_FILES[ $file_field[2] ]['name'] ) ) {
536
  // Upload the file and save it as an attachment.
537
- $file_post_id = $wpmem->forms->do_file_upload( $_FILES[ $file_field[2] ], $fields['ID'] );
538
 
539
  // Save the attachment ID as user meta.
540
- update_user_meta( $fields['ID'], $file_field[2], $file_post_id );
541
  }
542
  }
543
  }
@@ -612,4 +515,120 @@ function wpmem_get_captcha_err( $wpmem_captcha_err ) {
612
  }
613
  endif;
614
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  // End of file.
60
  $fields['user_email'] = ( isset( $_POST['user_email'] ) ) ? sanitize_email( $_POST['user_email'] ) : '';
61
 
62
  /** This filter defined in inc/class-wp-members-forms.php */
63
+ $wpmem_fields = apply_filters( 'wpmem_register_fields_arr', wpmem_fields(), $tag );
64
 
65
  // Build the $fields array from $_POST data.
66
+ foreach ( $wpmem_fields as $meta_key => $field ) {
67
+ if ( $field['register'] ) {
68
+ if ( 'password' != $meta_key || 'confirm_password' != $meta_key ) {
69
+ if ( isset( $_POST[ $meta_key ] ) ) {
70
+ switch ( $field['type'] ) {
 
71
  case 'checkbox':
72
+ $fields[ $meta_key ] = sanitize_text_field( $_POST[ $meta_key ] );
73
  break;
74
  case 'multiselect':
75
  case 'multicheckbox':
76
+ $delimiter = ( isset( $field['delimiter'] ) ) ? $field['delimiter'] : '|';
77
+ $fields[ $meta_key ] = ( isset( $_POST[ $meta_key ] ) ) ? implode( $delimiter, $_POST[ $meta_key ] ) : '';
 
78
  break;
79
  case 'textarea':
80
+ $fields[ $meta_key ] = $_POST[ $meta_key ];
81
  break;
82
  default:
83
+ $fields[ $meta_key ] = sanitize_text_field( $_POST[ $meta_key ] );
84
  break;
85
  }
86
  } else {
87
+ $fields[ $meta_key ] = '';
88
  }
89
  } else {
90
  // We do have password as part of the registration form.
110
  // Check for required fields, reverse the array for logical error message order.
111
  $wpmem_fields_rev = array_reverse( $wpmem_fields );
112
 
113
+ foreach ( $wpmem_fields_rev as $meta_key => $field ) {
114
  $pass_arr = array( 'password', 'confirm_password', 'password_confirm' );
115
+ $pass_chk = ( $tag == 'update' && in_array( $meta_key, $pass_arr ) ) ? true : false;
116
  // Validation if the field is required.
117
+ if ( $field['required'] && $pass_chk == false ) { // @todo - verify $field['required']
118
+ if ( 'file' == $field['type'] || 'image' == $field['type'] ) {
119
  // If this is a new registration.
120
  if ( 'register' == $tag ) {
121
  // If the required field is a file type.
122
+ if ( empty( $_FILES[ $meta_key ]['name'] ) ) {
123
+ $wpmem_themsg = sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $field['label'], 'wp-members' ) );
124
  }
125
  }
126
  } else {
127
  // If the required field is any other field type.
128
+ if ( ! $fields[ $meta_key ] ) {
129
+ $wpmem_themsg = sprintf( $wpmem->get_text( 'reg_empty_field' ), __( $field['label'], 'wp-members' ) );
130
  }
131
  }
132
  }
167
  $wpmem_themsg = $wpmem->get_text( 'reg_email_match' );
168
  }
169
 
170
+ // Process CAPTCHA.
171
+ if ( 0 != $wpmem->captcha ) {
172
+ $check_captcha = wpmem_register_handle_captcha();
173
+ if ( 'passed_captcha' != $check_captcha ) {
174
+ return $check_captcha;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
  }
177
 
239
 
240
  // Fields for wp_insert_user: user_url, first_name, last_name, description, jabber, aim, yim.
241
  $new_user_fields_meta = array( 'user_url', 'first_name', 'last_name', 'description', 'jabber', 'aim', 'yim' );
242
+ foreach ( $wpmem_fields as $meta_key => $field ) {
243
+ if ( in_array( $meta_key, $new_user_fields_meta ) ) {
244
+ if ( $field['register'] && ! in_array( $meta_key, $excluded_meta ) ) {
245
+ $new_user_fields[ $meta_key ] = $fields[ $meta_key ];
246
  }
247
  }
248
  }
251
  $fields['ID'] = wp_insert_user( $new_user_fields );
252
 
253
  // Set remaining fields to wp_usermeta table.
254
+ foreach ( $wpmem_fields as $meta_key => $field ) {
255
  // If the field is not excluded, update accordingly.
256
+ if ( ! in_array( $meta_key, $excluded_meta ) && ! in_array( $meta_key, $new_user_fields_meta ) ) {
257
+ if ( $field['register'] && 'user_email' != $meta_key ) {
258
+ update_user_meta( $fields['ID'], $meta_key, $fields[ $meta_key ] );
259
  }
260
  }
261
  }
276
  // Handle file uploads, if any.
277
  if ( ! empty( $_FILES ) ) {
278
 
279
+ foreach ( $wpmem_fields as $meta_key => $field ) {
280
 
281
+ if ( ( 'file' == $field['type'] || 'image' == $field['type'] ) && is_array( $_FILES[ $meta_key ] ) ) {
282
 
283
  // Upload the file and save it as an attachment.
284
+ $file_post_id = $wpmem->forms->do_file_upload( $_FILES[ $meta_key ], $fields['ID'] );
285
 
286
  // Save the attachment ID as user meta.
287
+ update_user_meta( $fields['ID'], $meta_key, $file_post_id );
288
  }
289
  }
290
  }
298
  */
299
  do_action( 'wpmem_post_register_data', $fields );
300
 
 
 
301
  /*
302
  * If this was successful, and you have email properly
303
  * configured, send a notification email to the user.
401
  );
402
  $native_update = array( 'ID' => $user_ID );
403
 
404
+ foreach ( $wpmem_fields as $meta_key => $field ) {
405
  // If the field is not excluded, update accordingly.
406
+ if ( ! in_array( $meta_key, wpmem_get_excluded_meta( 'update' ) ) ) {
407
+ if ( 'file' != $field['type'] && 'image' != $field['type'] ) {
408
+ switch ( $meta_key ) {
409
 
410
  // If the field can be updated by wp_update_user.
411
+ case( in_array( $meta_key, $native_fields ) ):
412
+ $fields[ $meta_key ] = ( isset( $fields[ $meta_key ] ) ) ? $fields[ $meta_key ] : '';
413
+ $native_update[ $meta_key ] = $fields[ $meta_key ];
414
  break;
415
 
416
  // If the field is password.
420
 
421
  // Everything else goes into wp_usermeta.
422
  default:
423
+ if ( $field['register'] ) {
424
+ update_user_meta( $user_ID, $meta_key, $fields[ $meta_key ] );
425
  }
426
  break;
427
  }
432
  // Handle file uploads, if any.
433
  if ( ! empty( $_FILES ) ) {
434
 
435
+ foreach ( $wpmem_fields as $meta_key => $field ) {
436
 
437
+ if ( ( 'file' == $field['type'] || 'image' == $field['type'] ) && is_array( $_FILES[ $meta_key ] ) ) {
438
+ if ( ! empty( $_FILES[ $meta_key ]['name'] ) ) {
439
  // Upload the file and save it as an attachment.
440
+ $file_post_id = $wpmem->forms->do_file_upload( $_FILES[ $meta_key ], $fields['ID'] );
441
 
442
  // Save the attachment ID as user meta.
443
+ update_user_meta( $fields['ID'], $meta_key, $file_post_id );
444
  }
445
  }
446
  }
515
  }
516
  endif;
517
 
518
+ /**
519
+ * Process registration captcha.
520
+ *
521
+ * @since 3.1.6
522
+ *
523
+ * @global $wpmem
524
+ * @global $wpmem_themsg
525
+ * @return $string
526
+ */
527
+ function wpmem_register_handle_captcha() {
528
+
529
+ global $wpmem, $wpmem_themsg;
530
+
531
+ // Get the captcha settings (api keys).
532
+ $wpmem_captcha = get_option( 'wpmembers_captcha' );
533
+
534
+ // If captcha is on, check the captcha.
535
+ if ( $wpmem->captcha == 1 && $wpmem_captcha['recaptcha'] ) {
536
+
537
+ // If there is no api key, the captcha never displayed to the end user.
538
+ if ( $wpmem_captcha['recaptcha']['public'] && $wpmem_captcha['recaptcha']['private'] ) {
539
+ if ( ! $_POST["recaptcha_response_field"] ) { // validate for empty captcha field
540
+ $wpmem_themsg = $wpmem->get_text( 'reg_empty_captcha' );
541
+ return "empty";
542
+ }
543
+ }
544
+
545
+ // Check to see if the recaptcha library has already been loaded by another plugin.
546
+ if ( ! function_exists( '_recaptcha_qsencode' ) ) {
547
+ require_once( WPMEM_PATH . 'lib/recaptchalib.php' );
548
+ }
549
+
550
+ $publickey = $wpmem_captcha['recaptcha']['public'];
551
+ $privatekey = $wpmem_captcha['recaptcha']['private'];
552
+
553
+ // The response from reCAPTCHA.
554
+ $resp = null;
555
+ // The error code from reCAPTCHA, if any.
556
+ $error = null;
557
+
558
+ if ( $_POST["recaptcha_response_field"] ) {
559
+
560
+ $resp = recaptcha_check_answer (
561
+ $privatekey,
562
+ $_SERVER["REMOTE_ADDR"],
563
+ $_POST["recaptcha_challenge_field"],
564
+ $_POST["recaptcha_response_field"]
565
+ );
566
+
567
+ if ( ! $resp->is_valid ) {
568
+
569
+ // Set the error code so that we can display it.
570
+ global $wpmem_captcha_err;
571
+ $wpmem_captcha_err = $resp->error;
572
+ $wpmem_captcha_err = wpmem_get_captcha_err( $wpmem_captcha_err );
573
+
574
+ return "captcha";
575
+
576
+ }
577
+ } // End check recaptcha.
578
+ } elseif ( $wpmem->captcha == 2 ) {
579
+ if ( defined( 'REALLYSIMPLECAPTCHA_VERSION' ) ) {
580
+ // Validate Really Simple Captcha.
581
+ $wpmem_captcha = new ReallySimpleCaptcha();
582
+ // This variable holds the CAPTCHA image prefix, which corresponds to the correct answer.
583
+ $wpmem_captcha_prefix = ( isset( $_POST['captcha_prefix'] ) ) ? $_POST['captcha_prefix'] : '';
584
+ // This variable holds the CAPTCHA response, entered by the user.
585
+ $wpmem_captcha_code = ( isset( $_POST['captcha_code'] ) ) ? $_POST['captcha_code'] : '';
586
+ // Check CAPTCHA validity.
587
+ $wpmem_captcha_correct = ( $wpmem_captcha->check( $wpmem_captcha_prefix, $wpmem_captcha_code ) ) ? true : false;
588
+ // Clean up the tmp directory.
589
+ $wpmem_captcha->remove( $wpmem_captcha_prefix );
590
+ $wpmem_captcha->cleanup();
591
+ // If CAPTCHA validation fails (incorrect value entered in CAPTCHA field), return an error.
592
+ if ( ! $wpmem_captcha_correct ) {
593
+ $wpmem_themsg = wpmem_get_captcha_err( 'really-simple' );
594
+ return "empty";
595
+ }
596
+ }
597
+ } elseif ( $wpmem->captcha == 3 && $wpmem_captcha['recaptcha'] ) {
598
+ // Get the captcha response.
599
+ if ( isset( $_POST['g-recaptcha-response'] ) ) {
600
+ $captcha = $_POST['g-recaptcha-response'];
601
+ }
602
+
603
+ // If there is no captcha value, return error.
604
+ if ( ! $captcha ) {
605
+ $wpmem_themsg = $wpmem->get_text( 'reg_empty_captcha' );
606
+ return "empty";
607
+ }
608
+
609
+ // We need the private key for validation.
610
+ $privatekey = $wpmem_captcha['recaptcha']['private'];
611
+
612
+ // Validate the captcha.
613
+ $response = wp_remote_fopen( "https://www.google.com/recaptcha/api/siteverify?secret=" . $privatekey . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR'] );
614
+
615
+ // Decode the json response.
616
+ $response = json_decode( $response, true );
617
+
618
+ // If captcha validation was unsuccessful.
619
+ if ( $response['success'] == false ) {
620
+ $wpmem_themsg = $wpmem->get_text( 'reg_invalid_captcha' );
621
+ if ( WP_DEBUG && isset( $response['error-codes'] ) ) {
622
+ $wpmem_themsg.= '<br /><br />';
623
+ foreach( $response['error-codes'] as $code ) {
624
+ $wpmem_themsg.= "Error code: " . $code . "<br />";
625
+ }
626
+ }
627
+ return "empty";
628
+ }
629
+ }
630
+
631
+ return "passed_captcha";
632
+ }
633
+
634
  // End of file.
inc/shortcodes.php CHANGED
@@ -141,7 +141,6 @@ function wpmem_sc_forms( $atts, $content = null, $tag = 'wpmem_form' ) {
141
  return do_shortcode( $content );
142
  }
143
 
144
-
145
  /**
146
  * Handles the logged in status shortcodes.
147
  *
@@ -157,7 +156,14 @@ function wpmem_sc_forms( $atts, $content = null, $tag = 'wpmem_form' ) {
157
  *
158
  * @global object $wpmem The WP_Members object.
159
  *
160
- * @param array $atts
 
 
 
 
 
 
 
161
  * @param string $content
162
  * @param string $tag
163
  * @return string $content
@@ -229,7 +235,6 @@ function wpmem_sc_logged_in( $atts, $content = null, $tag = 'wpmem_logged_in' )
229
  }
230
  }
231
 
232
-
233
  /**
234
  * Handles the [wpmem_logged_out] shortcode.
235
  *
@@ -244,7 +249,6 @@ function wpmem_sc_logged_out( $atts, $content = null, $tag ) {
244
  return ( ! is_user_logged_in() ) ? do_shortcode( $content ) : '';
245
  }
246
 
247
-
248
  if ( ! function_exists( 'wpmem_shortcode' ) ):
249
  /**
250
  * Executes various shortcodes.
@@ -259,7 +263,16 @@ if ( ! function_exists( 'wpmem_shortcode' ) ):
259
  *
260
  * @global object $wpmem The WP_Members object.
261
  *
262
- * @param array $attr page|url|status|msg|field|id
 
 
 
 
 
 
 
 
 
263
  * @param string $content
264
  * @param string $tag
265
  * @return string Returns the result of wpmem_do_sc_pages|wpmem_list_users|wpmem_sc_expmessage|$content.
@@ -324,7 +337,6 @@ function wpmem_shortcode( $attr, $content = null, $tag = 'wp-members' ) {
324
  }
325
  endif;
326
 
327
-
328
  if ( ! function_exists( 'wpmem_do_sc_pages' ) ):
329
  /**
330
  * Builds the shortcode pages (login, register, user-profile, user-edit, password).
@@ -339,8 +351,14 @@ if ( ! function_exists( 'wpmem_do_sc_pages' ) ):
339
  * @global string $wpmem_themsg The WP-Members message container.
340
  * @global object $post The WordPress post object.
341
  *
342
- * @param string $page
343
- * @param string $redirect_to
 
 
 
 
 
 
344
  * @param string $tag
345
  * @return string $content
346
  */
@@ -473,7 +491,6 @@ function wpmem_do_sc_pages( $atts, $content, $tag ) {
473
  } // End wpmem_do_sc_pages.
474
  endif;
475
 
476
-
477
  /**
478
  * User count shortcode [wpmem_show_count].
479
  *
@@ -486,7 +503,14 @@ endif;
486
  * @since 3.1.5 Added total user count features.
487
  *
488
  * @global object $wpdb The WordPress database object.
489
- * @param array $atts Shortcode attributes.
 
 
 
 
 
 
 
490
  * @param string $content The shortcode content.
491
  * @return string $content
492
  */
@@ -510,14 +534,17 @@ function wpmem_sc_user_count( $atts, $content = null ) {
510
  return do_shortcode( $content );
511
  }
512
 
513
-
514
  /**
515
  * Creates the user profile dashboard area [wpmem_profile].
516
  *
517
  * @since 3.1.0
518
  * @since 3.1.2 Added function arguments.
519
  *
520
- * @param array $atts
 
 
 
 
521
  * @param string $content
522
  * @param string $tag
523
  * @return string $content
@@ -528,38 +555,29 @@ function wpmem_sc_user_profile( $atts, $content, $tag ) {
528
  return $content;
529
  }
530
 
531
-
532
  /**
533
  * Log in/out shortcode [wpmem_loginout].
534
  *
535
  * @since 3.1.1
 
536
  *
537
- * @param array $atts
 
 
 
 
 
 
 
538
  * @param string $content
539
  * @param string $tag
540
  * @return string $content
541
  */
542
  function wpmem_sc_loginout( $atts, $content, $tag ) {
543
- $defaults = array(
544
- 'login_redirect_to' => ( isset( $atts['login_redirect_to'] ) ) ? $atts['login_redirect_to'] : wpmem_current_url(),
545
- 'logout_redirect_to' => ( isset( $atts['logout_redirect_to'] ) ) ? $atts['logout_redirect_to'] : wpmem_current_url(), // @todo - This is not currently active.
546
- 'login_text' => ( isset( $atts['login_text'] ) ) ? $atts['login_text'] : __( 'log in', 'wp-members' ),
547
- 'logout_text' => ( isset( $atts['logout_text'] ) ) ? $atts['logout_text'] : __( 'log out', 'wp-members' ),
548
- );
549
- $args = wp_parse_args( $atts, $defaults );
550
- $redirect_to = ( is_user_logged_in() ) ? $args['logout_redirect_to'] : $args['login_redirect_to'];
551
- $text = ( is_user_logged_in() ) ? $args['logout_text'] : $args['login_text'];
552
- if ( is_user_logged_in() ) {
553
- /** This filter is defined in /inc/dialogs.php */
554
- $link = apply_filters( 'wpmem_logout_link', add_query_arg( 'a', 'logout' ) );
555
- } else {
556
- $link = wpmem_login_url( $args['login_redirect_to'] );
557
- }
558
- $link = sprintf( '<a href="%s">%s</a>', $link, $text );
559
  return do_shortcode( $link );
560
  }
561
 
562
-
563
  /**
564
  * Function to handle field shortcodes [wpmem_field].
565
  *
@@ -581,7 +599,16 @@ function wpmem_sc_loginout( $atts, $content, $tag ) {
581
  * @since 3.1.5 Added display attribute, meta key as a direct attribute, and image/file display.
582
  *
583
  * @global object $wpmem The WP_Members object.
584
- * @param array $atts Shortcode attributes.
 
 
 
 
 
 
 
 
 
585
  * @param string $content Any content passed with the shortcode (default:null).
586
  * @param string $tag The shortcode tag (wpmem_form).
587
  * @return string $content Content to return.
@@ -601,18 +628,32 @@ function wpmem_sc_fields( $atts, $content = null, $tag ) {
601
 
602
  // If there is userdata.
603
  if ( $user_info ) {
604
-
605
  global $wpmem;
606
- $field_type = ( isset( $wpmem->fields[ $field ]['type'] ) ) ? $wpmem->fields[ $field ]['type'] : 'native';
607
-
 
608
  $result = $user_info->{$field};
609
 
610
- // Handle select, multiple select, multiple checkbox, and radio groups.
611
- $array_fields = array( 'select', 'multiselect', 'multicheckbox', 'radio' );
612
- if ( ( ! isset( $atts['options'] ) ) && in_array( $field_type, $array_fields ) ) {
613
- $result = ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) ? $user_info->{$field} : $wpmem->fields[ $field ]['options'][ $user_info->{$field} ];
614
  }
615
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
  // Handle file/image fields.
617
  if ( isset( $field_type ) && ( 'file' == $field_type || 'image' == $field_type ) ) {
618
  if ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) {
@@ -633,12 +674,12 @@ function wpmem_sc_fields( $atts, $content = null, $tag ) {
633
  }
634
  return do_shortcode( $result );
635
  }
636
-
637
  // Remove underscores from value if requested (default: on).
638
  if ( isset( $atts['underscores'] ) && 'off' == $atts['underscores'] && $user_info ) {
639
  $result = str_replace( '_', ' ', $result );
640
  }
641
-
642
  $content = ( $content ) ? $result . $content : $result;
643
 
644
  return do_shortcode( htmlspecialchars( $content ) );
@@ -646,13 +687,16 @@ function wpmem_sc_fields( $atts, $content = null, $tag ) {
646
  return;
647
  }
648
 
649
-
650
  /**
651
  * Logout link shortcode [wpmem_logout].
652
  *
653
  * @since 3.1.2
654
  *
655
- * @param array $atts
 
 
 
 
656
  * @param string $content
657
  * @param string $tag
658
  * @retrun string $content
@@ -666,13 +710,16 @@ function wpmem_sc_logout( $atts, $content, $tag ) {
666
  }
667
  }
668
 
669
-
670
  /**
671
  * TOS shortcode [wpmem_tos].
672
  *
673
  * @since 3.1.2
674
  *
675
- * @param array $atts
 
 
 
 
676
  * @param string $content
677
  * @param string $tag
678
  * @retrun string $content
141
  return do_shortcode( $content );
142
  }
143
 
 
144
  /**
145
  * Handles the logged in status shortcodes.
146
  *
156
  *
157
  * @global object $wpmem The WP_Members object.
158
  *
159
+ * @param array $atts {
160
+ * The shortcode attributes.
161
+ *
162
+ * @type string $status
163
+ * @type int $id
164
+ * @type string $role
165
+ * @type string $sub
166
+ * }
167
  * @param string $content
168
  * @param string $tag
169
  * @return string $content
235
  }
236
  }
237
 
 
238
  /**
239
  * Handles the [wpmem_logged_out] shortcode.
240
  *
249
  return ( ! is_user_logged_in() ) ? do_shortcode( $content ) : '';
250
  }
251
 
 
252
  if ( ! function_exists( 'wpmem_shortcode' ) ):
253
  /**
254
  * Executes various shortcodes.
263
  *
264
  * @global object $wpmem The WP_Members object.
265
  *
266
+ * @param array $attr {
267
+ * The shortcode attributes.
268
+ *
269
+ * @type string $page
270
+ * @type string $url
271
+ * @type string $status
272
+ * @type string $msg
273
+ * @type string $field
274
+ * @type int $id
275
+ * }
276
  * @param string $content
277
  * @param string $tag
278
  * @return string Returns the result of wpmem_do_sc_pages|wpmem_list_users|wpmem_sc_expmessage|$content.
337
  }
338
  endif;
339
 
 
340
  if ( ! function_exists( 'wpmem_do_sc_pages' ) ):
341
  /**
342
  * Builds the shortcode pages (login, register, user-profile, user-edit, password).
351
  * @global string $wpmem_themsg The WP-Members message container.
352
  * @global object $post The WordPress post object.
353
  *
354
+ * @param string $atts {
355
+ * The shortcode attributes.
356
+ *
357
+ * @type string $page
358
+ * @type string $redirect_to
359
+ * @type string $register
360
+ * }
361
+ * @param string $content
362
  * @param string $tag
363
  * @return string $content
364
  */
491
  } // End wpmem_do_sc_pages.
492
  endif;
493
 
 
494
  /**
495
  * User count shortcode [wpmem_show_count].
496
  *
503
  * @since 3.1.5 Added total user count features.
504
  *
505
  * @global object $wpdb The WordPress database object.
506
+ * @param array $atts {
507
+ * The shortcode attributes.
508
+ *
509
+ * @type string $key
510
+ * @type string $value
511
+ * @type string $role
512
+ * @type string $label
513
+ * }
514
  * @param string $content The shortcode content.
515
  * @return string $content
516
  */
534
  return do_shortcode( $content );
535
  }
536
 
 
537
  /**
538
  * Creates the user profile dashboard area [wpmem_profile].
539
  *
540
  * @since 3.1.0
541
  * @since 3.1.2 Added function arguments.
542
  *
543
+ * @param array $atts {
544
+ * The shortcode attributes.
545
+ *
546
+ * @type string $page
547
+ * }
548
  * @param string $content
549
  * @param string $tag
550
  * @return string $content
555
  return $content;
556
  }
557
 
 
558
  /**
559
  * Log in/out shortcode [wpmem_loginout].
560
  *
561
  * @since 3.1.1
562
+ * @since 3.1.6 Uses wpmem_loginout().
563
  *
564
+ * @param array $atts {
565
+ * The shortcode attributes.
566
+ *
567
+ * @type string $login_redirect_to The url to redirect to after login (optional).
568
+ * @type string $logout_redirect_to The url to redirect to after logout (optional).
569
+ * @type string $login_text Text for the login link (optional).
570
+ * @type string $logout_text Text for the logout link (optional).
571
+ * }
572
  * @param string $content
573
  * @param string $tag
574
  * @return string $content
575
  */
576
  function wpmem_sc_loginout( $atts, $content, $tag ) {
577
+ $link = wpmem_loginout( $atts );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  return do_shortcode( $link );
579
  }
580
 
 
581
  /**
582
  * Function to handle field shortcodes [wpmem_field].
583
  *
599
  * @since 3.1.5 Added display attribute, meta key as a direct attribute, and image/file display.
600
  *
601
  * @global object $wpmem The WP_Members object.
602
+ * @param array $atts {
603
+ * The shortcode attributes.
604
+ *
605
+ * @type string {meta_key}
606
+ * @type string $field
607
+ * @type int $id
608
+ * @type string $underscores
609
+ * @type string $display
610
+ * @type string size
611
+ * }
612
  * @param string $content Any content passed with the shortcode (default:null).
613
  * @param string $tag The shortcode tag (wpmem_form).
614
  * @return string $content Content to return.
628
 
629
  // If there is userdata.
630
  if ( $user_info ) {
631
+
632
  global $wpmem;
633
+ $fields = wpmem_fields();
634
+ $field_type = ( isset( $fields[ $field ]['type'] ) ) ? $fields[ $field ]['type'] : 'native';
635
+
636
  $result = $user_info->{$field};
637
 
638
+ // Handle select and radio groups (have single selections).
639
+ if ( 'select' == $field_type || 'radio' == $field_type ) {
640
+ $result = ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) ? $user_info->{$field} : $fields[ $field ]['options'][ $user_info->{$field} ];
 
641
  }
642
+
643
+ // Handle multiple select and multiple checkbox (have multiple selections).
644
+ if ( 'multiselect' == $field_type || 'multicheckbox' == $field_type ) {
645
+ if ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) {
646
+ $result = $user_info->{$field};
647
+ } else {
648
+ $saved_vals = explode( $fields[ $field ]['delimiter'], $user_info->{$field} );
649
+ $result = ''; $x = 1;
650
+ foreach ( $saved_vals as $value ) {
651
+ $result.= ( $x > 1 ) ? ', ' : ''; $x++;
652
+ $result.= $fields[ $field ]['options'][ $value ];
653
+ }
654
+ }
655
+ }
656
+
657
  // Handle file/image fields.
658
  if ( isset( $field_type ) && ( 'file' == $field_type || 'image' == $field_type ) ) {
659
  if ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) {
674
  }
675
  return do_shortcode( $result );
676
  }
677
+
678
  // Remove underscores from value if requested (default: on).
679
  if ( isset( $atts['underscores'] ) && 'off' == $atts['underscores'] && $user_info ) {
680
  $result = str_replace( '_', ' ', $result );
681
  }
682
+
683
  $content = ( $content ) ? $result . $content : $result;
684
 
685
  return do_shortcode( htmlspecialchars( $content ) );
687
  return;
688
  }
689
 
 
690
  /**
691
  * Logout link shortcode [wpmem_logout].
692
  *
693
  * @since 3.1.2
694
  *
695
+ * @param array $atts {
696
+ * The shortcode attributes.
697
+ *
698
+ * @type string $url
699
+ * }
700
  * @param string $content
701
  * @param string $tag
702
  * @retrun string $content
710
  }
711
  }
712
 
 
713
  /**
714
  * TOS shortcode [wpmem_tos].
715
  *
716
  * @since 3.1.2
717
  *
718
+ * @param array $atts {
719
+ * The shortcode attributes.
720
+ *
721
+ * @type string $url
722
+ * }
723
  * @param string $content
724
  * @param string $tag
725
  * @retrun string $content
inc/users.php CHANGED
@@ -38,66 +38,64 @@ function wpmem_user_profile() {
38
  <table class="form-table">
39
  <?php
40
  // Get fields.
41
- $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' );
42
  // Get excluded meta.
43
  $exclude = wpmem_get_excluded_meta( 'user-profile' );
44
 
45
  $rows = array();
46
- foreach ( $wpmem_fields as $meta ) {
47
 
48
  $valtochk = ''; $values = '';
49
 
50
  // Do we exclude the row?
51
- $chk_pass = ( in_array( $meta[2], $exclude ) ) ? false : true;
52
 
53
- if ( $meta[4] == "y" && $meta[6] == "n" && $chk_pass ) {
54
 
55
- $val = get_user_meta( $user_id, $meta[2], true );
56
 
57
- if ( $meta[3] == 'checkbox' ) {
58
  $valtochk = $val;
59
- $val = $meta[7];
60
  }
61
 
62
- if ( 'multicheckbox' == $meta[3] || 'select' == $meta[3] || 'multiselect' == $meta[3] || 'radio' == $meta[3] ) {
63
- $values = $meta[7];
64
  $valtochk = $val;
65
  }
66
 
67
  // Is this an image or a file?
68
- if ( 'file' == $meta[3] || 'image' == $meta[3] ) {
69
  $attachment_url = wp_get_attachment_url( $val );
70
  $empty_file = '<span class="description">' . __( 'None' ) . '</span>';
71
- if ( 'file' == $meta[3] ) {
72
  $input = ( 0 < $attachment_url ) ? '<a href="' . $attachment_url . '">' . $attachment_url . '</a>' : $empty_file;
73
  } else {
74
  $input = ( 0 < $attachment_url ) ? '<img src="' . $attachment_url . '">' : $empty_file;
75
  }
76
  // @todo - come up with a way to handle file updates - user profile form does not support multitype
77
  //$show_field.= '<br /><span class="description">' . __( 'Update this file:' ) . '</span><br />';
78
- //$show_field.= wpmem_create_formfield( $meta[2] . '_update_file', $meta[3], $val, $valtochk );
79
  } else {
80
- if ( $meta[2] == 'tos' && $val == 'agree' ) {
81
- $input = wpmem_create_formfield( $meta[2], 'hidden', $val );
82
- } elseif ( 'multicheckbox' == $meta[3] || 'select' == $meta[3] || 'multiselect' == $meta[3] || 'radio' == $meta[3] ) {
83
- $input = wpmem_create_formfield( $meta[2], $meta[3], $values, $valtochk );
84
  } else {
85
- $input = wpmem_create_formfield( $meta[2], $meta[3], $val, $valtochk );
86
  }
87
  }
88
 
89
  // If there are any required fields.
90
- $req = ( $meta[5] == 'y' ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
91
- $label = '<label>' . __( $meta[1], 'wp-members' ) . $req . '</label>';
92
 
93
  // Build the form rows for filtering.
94
- $rows[ $meta[2] ] = array(
95
- 'order' => $meta[0],
96
- 'meta' => $meta[2],
97
- 'type' => $meta[3],
98
  'value' => $val,
99
  'values' => $values,
100
- 'label_text' => __( $meta[1], 'wp-members' ),
101
  'row_before' => '',
102
  'label' => $label,
103
  'field_before' => '',
@@ -112,8 +110,22 @@ function wpmem_user_profile() {
112
  * Filter for rows
113
  *
114
  * @since 3.1.0
 
115
  *
116
- * @param array $rows
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  * @param string $toggle
118
  */
119
  $rows = apply_filters( 'wpmem_register_form_rows_profile', $rows, 'userprofile' );
@@ -155,37 +167,37 @@ function wpmem_profile_update() {
155
 
156
  global $wpmem, $user_id;
157
  // Get the fields.
158
- $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' );
159
  // Get any excluded meta fields.
160
  $exclude = wpmem_get_excluded_meta( 'user-profile' );
161
- foreach ( $wpmem_fields as $meta ) {
162
  // If this is not an excluded meta field.
163
- if ( ! in_array( $meta[2], $exclude ) ) {
164
  // If the field is user editable.
165
- if ( $meta[4] == "y"
166
- && $meta[6] == "n"
167
- && $meta[3] != 'password'
168
- && $meta[3] != 'file'
169
- && $meta[3] != 'image' ) {
170
 
171
  // Check for required fields.
172
  $chk = '';
173
- if ( $meta[5] == "n" || ( ! $meta[5] ) ) {
174
  $chk = 'ok';
175
  }
176
- if ( $meta[5] == "y" && $_POST[$meta[2]] != '' ) {
177
  $chk = 'ok';
178
  }
179
 
180
  // Check for field value.
181
- if ( $meta[3] == 'multiselect' || $meta[3] == 'multicheckbox' ) {
182
- $field_val = ( isset( $_POST[ $meta[2] ] ) ) ? implode( '|', $_POST[ $meta[2] ] ) : '';
183
  } else {
184
- $field_val = ( isset( $_POST[$meta[2]] ) ) ? $_POST[$meta[2]] : '';
185
  }
186
 
187
  if ( $chk == 'ok' ) {
188
- update_user_meta( $user_id, $meta[2], $field_val );
189
  }
190
  }
191
  }
38
  <table class="form-table">
39
  <?php
40
  // Get fields.
41
+ $wpmem_fields = wpmem_fields();
42
  // Get excluded meta.
43
  $exclude = wpmem_get_excluded_meta( 'user-profile' );
44
 
45
  $rows = array();
46
+ foreach ( $wpmem_fields as $meta => $field ) {
47
 
48
  $valtochk = ''; $values = '';
49
 
50
  // Do we exclude the row?
51
+ $chk_pass = ( in_array( $meta, $exclude ) ) ? false : true;
52
 
53
+ if ( $field['register'] && ! $field['native'] && $chk_pass ) {
54
 
55
+ $val = get_user_meta( $user_id, $meta, true );
56
 
57
+ if ( $field['type'] == 'checkbox' ) {
58
  $valtochk = $val;
59
+ $val = $field['checked_value'];
60
  }
61
 
62
+ if ( 'multicheckbox' == $field['type'] || 'select' == $field['type'] || 'multiselect' == $field['type'] || 'radio' == $field['type'] ) {
63
+ $values = $field['values'];
64
  $valtochk = $val;
65
  }
66
 
67
  // Is this an image or a file?
68
+ if ( 'file' == $field['type'] || 'image' == $field['type'] ) {
69
  $attachment_url = wp_get_attachment_url( $val );
70
  $empty_file = '<span class="description">' . __( 'None' ) . '</span>';
71
+ if ( 'file' == $field['type'] ) {
72
  $input = ( 0 < $attachment_url ) ? '<a href="' . $attachment_url . '">' . $attachment_url . '</a>' : $empty_file;
73
  } else {
74
  $input = ( 0 < $attachment_url ) ? '<img src="' . $attachment_url . '">' : $empty_file;
75
  }
76
  // @todo - come up with a way to handle file updates - user profile form does not support multitype
77
  //$show_field.= '<br /><span class="description">' . __( 'Update this file:' ) . '</span><br />';
78
+ //$show_field.= wpmem_create_formfield( $meta . '_update_file', $field['type'], $val, $valtochk );
79
  } else {
80
+ if ( $meta == 'tos' && $val == 'agree' ) {
81
+ $input = wpmem_create_formfield( $meta, 'hidden', $val );
82
+ } elseif ( 'multicheckbox' == $field['type'] || 'select' == $field['type'] || 'multiselect' == $field['type'] || 'radio' == $field['type'] ) {
83
+ $input = wpmem_create_formfield( $meta, $field['type'], $values, $valtochk );
84
  } else {
85
+ $input = wpmem_create_formfield( $meta, $field['type'], $val, $valtochk );
86
  }
87
  }
88
 
89
  // If there are any required fields.
90
+ $req = ( $field['required'] ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
91
+ $label = '<label>' . __( $field['label'], 'wp-members' ) . $req . '</label>';
92
 
93
  // Build the form rows for filtering.
94
+ $rows[ $meta ] = array(
95
+ 'type' => $field['type'],
 
 
96
  'value' => $val,
97
  'values' => $values,
98
+ 'label_text' => __( $field['label'], 'wp-members' ),
99
  'row_before' => '',
100
  'label' => $label,
101
  'field_before' => '',
110
  * Filter for rows
111
  *
112
  * @since 3.1.0
113
+ * @since 3.1.6 Deprecated $order and $meta.
114
  *
115
+ * @param array $rows {
116
+ * An array of the profile rows.
117
+ *
118
+ * @type string $type The field type.
119
+ * @type string $value Value if set.
120
+ * @type string $values Possible values (select, multiselect, multicheckbox, radio).
121
+ * @type string $label_text Raw label text (no HTML).
122
+ * @type string $row_before HTML before the row.
123
+ * @type string $label HTML label.
124
+ * @type string $field_before HTML before the field input tag.
125
+ * @type string $field HTML for field input.
126
+ * @type string $field_after HTML after the field.
127
+ * @type string $row_after HTML after the row.
128
+ * }
129
  * @param string $toggle
130
  */
131
  $rows = apply_filters( 'wpmem_register_form_rows_profile', $rows, 'userprofile' );
167
 
168
  global $wpmem, $user_id;
169
  // Get the fields.
170
+ $wpmem_fields = wpmem_fields();
171
  // Get any excluded meta fields.
172
  $exclude = wpmem_get_excluded_meta( 'user-profile' );
173
+ foreach ( $wpmem_fields as $meta => $field ) {
174
  // If this is not an excluded meta field.
175
+ if ( ! in_array( $meta, $exclude ) ) {
176
  // If the field is user editable.
177
+ if ( $field['register']
178
+ && $field['type'] != 'password'
179
+ && $field['type'] != 'file'
180
+ && $field['type'] != 'image'
181
+ && ! $field['native'] ) {
182
 
183
  // Check for required fields.
184
  $chk = '';
185
+ if ( ! $field['required'] ) {
186
  $chk = 'ok';
187
  }
188
+ if ( $field['required'] && $_POST[ $meta ] != '' ) {
189
  $chk = 'ok';
190
  }
191
 
192
  // Check for field value.
193
+ if ( $field['type'] == 'multiselect' || $field['type'] == 'multicheckbox' ) {
194
+ $field_val = ( isset( $_POST[ $meta ] ) ) ? implode( '|', $_POST[ $meta ] ) : '';
195
  } else {
196
+ $field_val = ( isset( $_POST[ $meta ] ) ) ? $_POST[ $meta ] : '';
197
  }
198
 
199
  if ( $chk == 'ok' ) {
200
+ update_user_meta( $user_id, $meta, $field_val );
201
  }
202
  }
203
  }
inc/utilities.php CHANGED
@@ -28,7 +28,6 @@
28
  * - wpmem_use_ssl
29
  * - wpmem_wp_reserved_terms
30
  * - wpmem_write_log
31
- * - wpmem_get
32
  */
33
 
34
 
@@ -198,13 +197,19 @@ function wpmem_do_excerpt( $content ) {
198
  // Build an excerpt if one does not exist.
199
  if ( ! $has_more_link ) {
200
 
201
- if ( is_singular( $post->post_type ) ) {
 
 
202
  // If it's a single post, we don't need the 'more' link.
203
  $more_link_text = '';
204
  $more_link = '';
205
  } else {
206
  // The default $more_link_text.
207
- $more_link_text = __( '(more&hellip;)' );
 
 
 
 
208
  // The default $more_link.
209
  $more_link = ' <a href="'. get_permalink( $post->ID ) . '" class="more-link">' . $more_link_text . '</a>';
210
  }
@@ -255,6 +260,10 @@ function wpmem_do_excerpt( $content ) {
255
 
256
  if ( $do_excerpt ) {
257
  $content = wp_trim_words( $content, $args['length'], $args['more_link'] );
 
 
 
 
258
  }
259
 
260
  }
@@ -376,30 +385,4 @@ function wpmem_write_log ( $log ) {
376
  }
377
  }
378
 
379
-
380
- /**
381
- * Utility function to validate post.
382
- *
383
- * @since 3.1.3
384
- *
385
- * @todo Should this include trim? as an option? Perhaps that's better done on the returned result so that other escapes, etc could be done.
386
- *
387
- * @param string $tag The form field or query string.
388
- * @param string $default The default value (optional).
389
- * @param string $type post|get|request (optional).
390
- * @return string
391
- */
392
- function wpmem_get( $tag, $default = '', $type = 'post' ) {
393
- switch ( $type ) {
394
- case 'post':
395
- return ( isset( $_POST[ $tag ] ) ) ? $_POST[ $tag ] : $default;
396
- break;
397
- case 'get':
398
- return ( isset( $_GET[ $tag ] ) ) ? $_GET[ $tag ] : $default;
399
- break;
400
- case 'request':
401
- return ( isset( $_REQUEST[ $tag ] ) ) ? $_REQUEST[ $tag ] : $default;
402
- break;
403
- }
404
- }
405
  // End of file.
28
  * - wpmem_use_ssl
29
  * - wpmem_wp_reserved_terms
30
  * - wpmem_write_log
 
31
  */
32
 
33
 
197
  // Build an excerpt if one does not exist.
198
  if ( ! $has_more_link ) {
199
 
200
+ $is_singular = ( is_singular( $post->post_type ) ) ? true : false;
201
+
202
+ if ( $is_singular ) {
203
  // If it's a single post, we don't need the 'more' link.
204
  $more_link_text = '';
205
  $more_link = '';
206
  } else {
207
  // The default $more_link_text.
208
+ if ( isset( $wpmem->autoex[ $post->post_type ]['text'] ) && '' != $wpmem->autoex[ $post->post_type ]['text'] ) {
209
+ $more_link_text = __( $wpmem->autoex[ $post->post_type ]['text'], 'wp-members' );
210
+ } else {
211
+ $more_link_text = __( '(more&hellip;)' );
212
+ }
213
  // The default $more_link.
214
  $more_link = ' <a href="'. get_permalink( $post->ID ) . '" class="more-link">' . $more_link_text . '</a>';
215
  }
260
 
261
  if ( $do_excerpt ) {
262
  $content = wp_trim_words( $content, $args['length'], $args['more_link'] );
263
+ // Check if the more link was added (note: singular has no more_link):
264
+ if ( ! $is_singular && ! strpos( $content, $args['more_link'] ) ) {
265
+ $content = $content . $args['more_link'];
266
+ }
267
  }
268
 
269
  }
385
  }
386
  }
387
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  // End of file.
inc/wp-registration.php CHANGED
@@ -26,22 +26,28 @@
26
  *
27
  * @since 2.8.7
28
  * @since 3.1.1 Updated to support new (3.1.0) field types.
 
29
  */
30
  function wpmem_do_wp_register_form() {
31
 
32
  global $wpmem;
33
- $wpmem_fields = $wpmem->fields; //$wpmem_fields = get_option( 'wpmembers_fields' );
 
 
 
 
 
 
 
34
  if ( isset( $wpmem_fields ) && is_array( $wpmem_fields ) ) {
35
- foreach ( $wpmem_fields as $field ) {
36
-
37
- $meta_key = $field[2];
38
 
39
- $req = ( $field[5] == 'y' ) ? ' <span class="req">' . __( '(required)' ) . '</span>' : '';
40
 
41
  // File fields not yet supported for this form.
42
- if ( $field[4] == 'y' && $meta_key != 'user_email' && $field[3] != 'file' && $field[3] != 'image' ) {
43
 
44
- if ( $field[3] == 'checkbox' ) {
45
 
46
  if ( $meta_key == 'tos' ) {
47
  $tos_content = stripslashes( get_option( 'wpmembers_tos' ) );
@@ -62,28 +68,43 @@ function wpmem_do_wp_register_form() {
62
 
63
  }
64
 
65
- $label = ( $meta_key == 'tos' ) ? $tos : __( $field[1], 'wp-members' );
66
 
67
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
68
- $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
69
 
70
  $row_before = '<p class="wpmem-checkbox">';
71
  $label = '<label for="' . $meta_key . '">' . $label . $req;
72
- $input = wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
73
  $row_after = '</label></p>';
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  } else {
76
 
77
- $row_before = '<p>';
78
- $label = '<label for="' . $meta_key . '">' . __( $field[1], 'wp-members' ) . $req . '<br />';
79
 
80
  // determine the field type and generate accordingly...
81
 
82
- switch ( $field[3] ) {
83
 
84
  case( 'select' ):
85
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
86
- $input = wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
87
  break;
88
 
89
  case( 'textarea' ):
@@ -95,17 +116,17 @@ function wpmem_do_wp_register_form() {
95
  case( 'multiselect' ):
96
  case( 'multicheckbox' ):
97
  case( 'radio' ):
98
- $row_before = '<p class="' . $field[3] . '">';
99
  $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
100
  $formfield_args = array(
101
  'name' => $meta_key,
102
- 'type' => $field[3],
103
- 'value' => $field[7],
104
  'compare' => $valtochk,
105
- 'required' => ( 'y' == $field[5] ) ? true : false,
106
  );
107
- if ( 'multicheckbox' == $field[3] || 'multiselect' == $field[3] ) {
108
- $formfield_args['delimiter'] = ( isset( $field[8] ) ) ? $field[8] : '|';
109
  }
110
  $input = $wpmem->forms->create_form_field( $formfield_args );
111
  break;
@@ -116,7 +137,8 @@ function wpmem_do_wp_register_form() {
116
  break;
117
 
118
  default:
119
- $input = '<input type="' . $field[3] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="';
 
120
  $input.= ( isset( $_POST[ $meta_key ] ) ) ? esc_attr( $_POST[ $meta_key ] ) : '';
121
  $input.= '" size="25" />';
122
  break;
@@ -128,7 +150,7 @@ function wpmem_do_wp_register_form() {
128
 
129
  // if the row is set to display, add the row to the form array
130
  $rows[ $meta_key ] = array(
131
- 'type' => $field[3],
132
  'row_before' => $row_before,
133
  'label' => $label,
134
  'field' => $input,
@@ -165,36 +187,35 @@ function wpmem_do_wp_register_form() {
165
  *
166
  * @since 2.9.0
167
  * @since 3.1.1 Updated to support new (3.1.0) field types and user activation.
 
168
  */
169
  function wpmem_do_wp_newuser_form() {
170
 
171
  global $wpmem;
172
  echo '<table class="form-table"><tbody>';
173
 
174
- $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' );
175
  $exclude = wpmem_get_excluded_meta( 'register' );
176
 
177
- foreach ( $wpmem_fields as $field ) {
178
-
179
- $meta_key = $field[2];
180
 
181
- if ( $field[6] == 'n' && ! in_array( $meta_key, $exclude ) ) {
182
 
183
- $req = ( $field[5] == 'y' ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
184
 
185
  echo '<tr>
186
  <th scope="row">
187
- <label for="' . $meta_key . '">' . __( $field[1], 'wp-members' ) . $req . '</label>
188
  </th>
189
  <td>';
190
 
191
  // determine the field type and generate accordingly.
192
 
193
- switch ( $field[3] ) {
194
 
195
  case( 'select' ):
196
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
197
- echo wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
198
  break;
199
 
200
  case( 'textarea' ):
@@ -205,8 +226,8 @@ function wpmem_do_wp_newuser_form() {
205
 
206
  case( 'checkbox' ):
207
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
208
- $val = ( ! $_POST && $field[8] == 'y' ) ? $field[7] : $val;
209
- echo wpmem_create_formfield( $meta_key, $field[3], $field[7], $val );
210
  break;
211
 
212
  case( 'multiselect' ):
@@ -215,13 +236,13 @@ function wpmem_do_wp_newuser_form() {
215
  $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
216
  $formfield_args = array(
217
  'name' => $meta_key,
218
- 'type' => $field[3],
219
- 'value' => $field[7],
220
  'compare' => $valtochk,
221
- 'required' => ( 'y' == $field[5] ) ? true : false,
222
  );
223
- if ( 'multicheckbox' == $field[3] || 'multiselect' == $field[3] ) {
224
- $formfield_args['delimiter'] = ( isset( $field[8] ) ) ? $field[8] : '|';
225
  }
226
  echo $wpmem->forms->create_form_field( $formfield_args );
227
  break;
@@ -231,7 +252,7 @@ function wpmem_do_wp_newuser_form() {
231
  break;
232
 
233
  default:
234
- echo '<input type="' . $field[3] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="'; echo ( isset( $_POST[ $meta_key ] ) ) ? esc_attr( $_POST[ $meta_key ] ) : ''; echo '" size="25" />';
235
  break;
236
  }
237
 
26
  *
27
  * @since 2.8.7
28
  * @since 3.1.1 Updated to support new (3.1.0) field types.
29
+ * @since 3.1.6 Updated to support new fields array. Added WC classes.
30
  */
31
  function wpmem_do_wp_register_form() {
32
 
33
  global $wpmem;
34
+ $wpmem_fields = wpmem_fields();
35
+
36
+ // Check if this is WooCommerce account page.
37
+ $is_woo = false;
38
+ if ( function_exists( 'is_account_page' ) ) {
39
+ $is_woo = ( is_account_page() ) ? true : $is_woo;
40
+ }
41
+
42
  if ( isset( $wpmem_fields ) && is_array( $wpmem_fields ) ) {
43
+ foreach ( $wpmem_fields as $meta_key => $field ) {
 
 
44
 
45
+ $req = ( $field['required'] ) ? ' <span class="req">' . __( '(required)' ) . '</span>' : '';
46
 
47
  // File fields not yet supported for this form.
48
+ if ( $field['register'] && $meta_key != 'user_email' && $field['type'] != 'file' && $field['type'] != 'image' ) {
49
 
50
+ if ( 'checkbox' == $field['type'] ) {
51
 
52
  if ( $meta_key == 'tos' ) {
53
  $tos_content = stripslashes( get_option( 'wpmembers_tos' ) );
68
 
69
  }
70
 
71
+ $label = ( $meta_key == 'tos' ) ? $tos : __( $field['label'], 'wp-members' );
72
 
73
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
74
+ $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
75
 
76
  $row_before = '<p class="wpmem-checkbox">';
77
  $label = '<label for="' . $meta_key . '">' . $label . $req;
78
+ $input = wpmem_create_formfield( $meta_key, $field['type'], $field['checked_value'], $val );
79
  $row_after = '</label></p>';
80
 
81
+ } elseif ( 'hidden' == $field['type'] ) {
82
+
83
+ // Handle hidden fields
84
+ $row_before = '';
85
+ $label = '';
86
+ $input = wpmem_form_field( array(
87
+ 'name' => $meta_key,
88
+ 'type' => $field['type'],
89
+ 'value' => $field['value'],
90
+ 'compare' => $valtochk,
91
+ //'class' => ( $class ) ? $class : 'textbox',
92
+ 'required' => $field['required'],
93
+ ) );
94
+ $row_after = '';
95
+
96
  } else {
97
 
98
+ $row_before = ( $is_woo ) ? '<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">' : '<p>';
99
+ $label = '<label for="' . $meta_key . '">' . __( $field['label'], 'wp-members' ) . $req . '<br />';
100
 
101
  // determine the field type and generate accordingly...
102
 
103
+ switch ( $field['type'] ) {
104
 
105
  case( 'select' ):
106
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
107
+ $input = wpmem_create_formfield( $meta_key, $field['type'], $field['values'], $val );
108
  break;
109
 
110
  case( 'textarea' ):
116
  case( 'multiselect' ):
117
  case( 'multicheckbox' ):
118
  case( 'radio' ):
119
+ $row_before = '<p class="' . $field['type'] . '">';
120
  $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
121
  $formfield_args = array(
122
  'name' => $meta_key,
123
+ 'type' => $field['type'],
124
+ 'value' => $field['values'],
125
  'compare' => $valtochk,
126
+ 'required' => ( $field['required'] ) ? true : false,
127
  );
128
+ if ( 'multicheckbox' == $field['type'] || 'multiselect' == $field['type'] ) {
129
+ $formfield_args['delimiter'] = $field['delimiter'];
130
  }
131
  $input = $wpmem->forms->create_form_field( $formfield_args );
132
  break;
137
  break;
138
 
139
  default:
140
+ $class = ( $is_woo ) ? 'woocommerce-Input woocommerce-Input--text input-text' : 'input';
141
+ $input = '<input type="' . $field['type'] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="' . $class . '" value="';
142
  $input.= ( isset( $_POST[ $meta_key ] ) ) ? esc_attr( $_POST[ $meta_key ] ) : '';
143
  $input.= '" size="25" />';
144
  break;
150
 
151
  // if the row is set to display, add the row to the form array
152
  $rows[ $meta_key ] = array(
153
+ 'type' => $field['type'],
154
  'row_before' => $row_before,
155
  'label' => $label,
156
  'field' => $input,
187
  *
188
  * @since 2.9.0
189
  * @since 3.1.1 Updated to support new (3.1.0) field types and user activation.
190
+ * @since 3.1.6 Updated to support new fields array.
191
  */
192
  function wpmem_do_wp_newuser_form() {
193
 
194
  global $wpmem;
195
  echo '<table class="form-table"><tbody>';
196
 
197
+ $wpmem_fields = wpmem_fields();
198
  $exclude = wpmem_get_excluded_meta( 'register' );
199
 
200
+ foreach ( $wpmem_fields as $meta_key => $field ) {
 
 
201
 
202
+ if ( ! $field['native'] && ! in_array( $meta_key, $exclude ) ) {
203
 
204
+ $req = ( $field['required'] ) ? ' <span class="description">' . __( '(required)' ) . '</span>' : '';
205
 
206
  echo '<tr>
207
  <th scope="row">
208
+ <label for="' . $meta_key . '">' . __( $field['label'], 'wp-members' ) . $req . '</label>
209
  </th>
210
  <td>';
211
 
212
  // determine the field type and generate accordingly.
213
 
214
+ switch ( $field['type'] ) {
215
 
216
  case( 'select' ):
217
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
218
+ echo wpmem_create_formfield( $meta_key, $field['type'], $field['values'], $val );
219
  break;
220
 
221
  case( 'textarea' ):
226
 
227
  case( 'checkbox' ):
228
  $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
229
+ $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
230
+ echo wpmem_create_formfield( $meta_key, $field['type'], $field['checked_value'], $val );
231
  break;
232
 
233
  case( 'multiselect' ):
236
  $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
237
  $formfield_args = array(
238
  'name' => $meta_key,
239
+ 'type' => $field['type'],
240
+ 'value' => $field['values'],
241
  'compare' => $valtochk,
242
+ 'required' => $field['required'],
243
  );
244
+ if ( 'multicheckbox' == $field['type'] || 'multiselect' == $field['type'] ) {
245
+ $formfield_args['delimiter'] = $field['delimiter'];
246
  }
247
  echo $wpmem->forms->create_form_field( $formfield_args );
248
  break;
252
  break;
253
 
254
  default:
255
+ echo '<input type="' . $field['type'] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="'; echo ( isset( $_POST[ $meta_key ] ) ) ? esc_attr( $_POST[ $meta_key ] ) : ''; echo '" size="25" />';
256
  break;
257
  }
258
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: cbutlerjr
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.6
5
- Tested up to: 4.6.1
6
- Stable tag: 3.1.5.2
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
@@ -112,8 +112,8 @@ Premium priority support is available at the plugin's site [RocketGeek.com](http
112
 
113
  == Upgrade Notice ==
114
 
115
- WP-Members 3.1.5 is a security and feature update. Minimum WP version is 3.6.
116
- WP-Members 3.1.5.1 and 3.1.5.2 are minor fixes to shortcodes.
117
 
118
  == Screenshots ==
119
 
@@ -136,15 +136,44 @@ WP-Members 3.1.5.1 and 3.1.5.2 are minor fixes to shortcodes.
136
 
137
  == Changelog ==
138
 
139
- = 3.1.5.2 =
140
-
141
- * Fixes undefined index for [wpmem_field] if the field is not a field in the plugin's fields array (such as user_login, user_registered, etc).
142
- * Fixes undefined index for [wpmem_loginout] for text attributes.
143
- * Updated [wp-members] deprecated shortcode notice to include post/page information on where the shortcode is being used.
144
-
145
- = 3.1.5.1 =
146
-
147
- * Fixes [wpmem_field] support for raw data display (when display=raw attribute is used) for select (dropdown), multiple select, multiple checkbox, and radio groups.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
  = 3.1.5 =
150
 
@@ -158,6 +187,7 @@ WP-Members 3.1.5.1 and 3.1.5.2 are minor fixes to shortcodes.
158
  * Field loader now validates settings, if none exist due to install error it will run the default fields install.
159
  * Removed dialog setting downgrade on deactivation. Need to re-evaluate necessity of downgrading.
160
  * Fixed issue with slash handling in Emails tab.
 
161
 
162
  = 3.1.4 =
163
 
2
  Contributors: cbutlerjr
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 3.6
5
+ Tested up to: 4.7.0
6
+ Stable tag: 3.1.6.3
7
  License: GPLv2
8
 
9
  WP-Members&trade; is a free membership management framework for WordPress&reg; that restricts content to registered users.
112
 
113
  == Upgrade Notice ==
114
 
115
+ WP-Members 3.1.6.3 fixes some invalid characters in certain files in the wordpress.org repo version.
116
+ WP-Members 3.1.6 is primarily a settings update. See changelog for important details. Minimum WP version is 3.6.
117
 
118
  == Screenshots ==
119
 
136
 
137
  == Changelog ==
138
 
139
+ = 3.1.6.3 =
140
+
141
+ * Fixes some invalid characters in the wordpress.org repo version of the plugin that seem to have crept in during the 3.1.6.2 commit.
142
+ * Applies some admin strings for translation.
143
+ * Notes WordPress 4.7 compatibility.
144
+
145
+ = 3.1.6.2 =
146
+
147
+ * Applies style properties for the remember me checkbox label to the default stylesheets. The label tag was added to this text in 3.1.6 (see below).
148
+
149
+ = 3.1.6.1 =
150
+
151
+ * Fixes issue with displaying checkbox state on the admin user profile screen.
152
+ * Fixes issue with auto excerpt when excerpts are displayed on single posts/pages.
153
+
154
+ = 3.1.6 =
155
+
156
+ * Fixed [wpmem_field] display handling for multiple select and multiple checkbox field types.
157
+ * Updates to always load fields from wpmem_fields() API function.
158
+ * Updates to begin to utilize new fields settings array. Fields setting is still store in the same array format as before. However, it is loaded into the new settings format. Current object class keeps numeric keys in place for legacy purposes.
159
+ * Updates to dropdown handling on main options tab to display proper preselected value when site is using ssl (https://) and no value is selected.
160
+ * Added wpmem_loginout() API function, changed [wpmem_loginout] shortcode to use API function.
161
+ * Added wpmem_array_insert() API function, allows for inserting array elements at any point in an array.
162
+ * Added wp_destroy_current_session() to logout function.
163
+ * Added WooCommerce support in native WP registration functions. Began adding WooCommerce classes to registration form elements.
164
+ * Added to wpmem_user_has_role() function to check for a single role or if the user has a role that is in an array of roles.
165
+ * Added wpmem_shortcodes_loaded, wpmem_hooks_loaded, and wpmem_dropins_loaded to fire after.
166
+ * Added text input to set a default 'read more' link for auto excerpt.
167
+ * Fixed issue with auto excerpt where an excerpt shorter than the excerpt setting would not display the more link.
168
+ * Preliminary updates to include placeholder support in fields (this will be an option in a future release).
169
+ * Localization fix of untranslated strings.
170
+ * Wrap "Remember Me" checkbox label with label tag in login form.
171
+ * Moved remaining initialization functions to class constructor.
172
+ * Moved wpmem_load_shortcodes, wpmem_load_hooks, and wpmem_load_dropins to fire before.
173
+ * reCAPTCHA version 1 is no longer supported by Google. It is now deprecated in the plugin. If you have reCAPTCHA v1 selected, it will remain so. But once this is changed to a different CAPTCHA setting or if this is a new install, reCAPTCHA version 1 will no longer be available as a selection.
174
+ * Custom field term "Option Name" changed to "Meta Key" for clarity.
175
+ * Marked required custom field properties as required in Add/Edit Field dialogs.
176
+ * Changed redirect_to process to escape the url with esc_url_raw rather than esc_url, otherwise query string variables do not get handled correctly.
177
 
178
  = 3.1.5 =
179
 
187
  * Field loader now validates settings, if none exist due to install error it will run the default fields install.
188
  * Removed dialog setting downgrade on deactivation. Need to re-evaluate necessity of downgrading.
189
  * Fixed issue with slash handling in Emails tab.
190
+ * Updated [wp-members] deprecated shortcode notice to include post/page information on where the shortcode is being used.
191
 
192
  = 3.1.4 =
193
 
wp-members-install.php CHANGED
@@ -27,6 +27,9 @@
27
  * Installs or upgrades the plugin.
28
  *
29
  * @since 2.2.2
 
 
 
30
  */
31
  function wpmem_do_install() {
32
 
@@ -43,7 +46,7 @@ function wpmem_do_install() {
43
 
44
  if ( ! get_option( 'wpmembers_settings' ) || $chk_force == true ) {
45
 
46
- wpmem_install_settings();
47
  wpmem_install_fields();
48
  wpmem_install_dialogs();
49
  wpmem_append_email();
@@ -51,11 +54,13 @@ function wpmem_do_install() {
51
 
52
  } else {
53
 
54
- wpmem_upgrade_settings();
55
  wpmem_upgrade_captcha();
56
  wpmem_append_email();
57
 
58
  }
 
 
59
  }
60
 
61
 
@@ -436,7 +441,14 @@ function wpmem_upgrade_captcha() {
436
  return;
437
  }
438
 
439
-
 
 
 
 
 
 
 
440
  function wpmem_install_settings() {
441
 
442
  $wpmem_settings = array(
@@ -482,8 +494,15 @@ function wpmem_install_settings() {
482
 
483
  // Using update_option to allow for forced update.
484
  update_option( 'wpmembers_settings', $wpmem_settings, '', 'yes' );
 
 
485
  }
486
 
 
 
 
 
 
487
  function wpmem_install_fields() {
488
  /*
489
  * Field array elements:
@@ -522,6 +541,11 @@ function wpmem_install_fields() {
522
  update_option( 'wpmembers_fields', $wpmem_fields_options_arr, '', 'yes' ); // using update_option to allow for forced update
523
  }
524
 
 
 
 
 
 
525
  function wpmem_install_dialogs() {
526
  $wpmem_dialogs_arr = array(
527
  'restricted_msg' => "This content is restricted to site members. If you are an existing user, please log in. New users may register below.",
27
  * Installs or upgrades the plugin.
28
  *
29
  * @since 2.2.2
30
+ * @since 3.1.6 Returns $wpmem_settings.
31
+ *
32
+ * @return array $wpmem_settings
33
  */
34
  function wpmem_do_install() {
35
 
46
 
47
  if ( ! get_option( 'wpmembers_settings' ) || $chk_force == true ) {
48
 
49
+ $wpmem_settings = wpmem_install_settings();
50
  wpmem_install_fields();
51
  wpmem_install_dialogs();
52
  wpmem_append_email();
54
 
55
  } else {
56
 
57
+ $wpmem_settings = wpmem_upgrade_settings();
58
  wpmem_upgrade_captcha();
59
  wpmem_append_email();
60
 
61
  }
62
+
63
+ return $wpmem_settings;
64
  }
65
 
66
 
441
  return;
442
  }
443
 
444
+ /**
445
+ * Does install of default settings.
446
+ *
447
+ * @since 3.1.5
448
+ * @since 3.1.6 Returns $wpmem_settings
449
+ *
450
+ * @return array $wpmem_settings
451
+ */
452
  function wpmem_install_settings() {
453
 
454
  $wpmem_settings = array(
494
 
495
  // Using update_option to allow for forced update.
496
  update_option( 'wpmembers_settings', $wpmem_settings, '', 'yes' );
497
+
498
+ return $wpmem_settings;
499
  }
500
 
501
+ /**
502
+ * Installs default fields.
503
+ *
504
+ * @since 3.1.5
505
+ */
506
  function wpmem_install_fields() {
507
  /*
508
  * Field array elements:
541
  update_option( 'wpmembers_fields', $wpmem_fields_options_arr, '', 'yes' ); // using update_option to allow for forced update
542
  }
543
 
544
+ /**
545
+ * Installs default dialogs.
546
+ *
547
+ * @since 3.1.5
548
+ */
549
  function wpmem_install_dialogs() {
550
  $wpmem_dialogs_arr = array(
551
  'restricted_msg' => "This content is restricted to site members. If you are an existing user, please log in. New users may register below.",
wp-members.php CHANGED
@@ -1,351 +1,311 @@
1
- <?php
2
- /*
3
- Plugin Name: WP-Members
4
- Plugin URI: http://rocketgeek.com
5
- Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="http://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="http://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
- Version: 3.1.5.2
7
- Author: Chad Butler
8
- Author URI: http://butlerblog.com/
9
- Text Domain: wp-members
10
- Domain Path: /lang
11
- License: GPLv2
12
- */
13
-
14
-
15
- /*
16
- Copyright (c) 2006-2016 Chad Butler
17
-
18
- The name WP-Members(tm) is a trademark of butlerblog.com
19
-
20
- This program is free software; you can redistribute it and/or modify
21
- it under the terms of the GNU General Public License, version 2, as
22
- published by the Free Software Foundation.
23
-
24
- This program is distributed in the hope that it will be useful,
25
- but WITHOUT ANY WARRANTY; without even the implied warranty of
26
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
- GNU General Public License for more details.
28
-
29
- You should have received a copy of the GNU General Public License
30
- along with this program; if not, write to the Free Software
31
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
-
33
- You may also view the license here:
34
- http://www.gnu.org/licenses/gpl.html
35
- */
36
-
37
-
38
- /*
39
- A NOTE ABOUT LICENSE:
40
-
41
- While this plugin is freely available and open-source under the GPL2
42
- license, that does not mean it is "public domain." You are free to modify
43
- and redistribute as long as you comply with the license. Any derivative
44
- work MUST be GPL licensed and available as open source. You also MUST give
45
- proper attribution to the original author, copyright holder, and trademark
46
- owner. This means you cannot change two lines of code and claim copyright
47
- of the entire work as your own. The GPL2 license requires that if you
48
- modify this code, you must clearly indicate what section(s) you have
49
- modified and you may only claim copyright of your modifications and not
50
- the body of work. If you are unsure or have questions about how a
51
- derivative work you are developing complies with the license, copyright,
52
- trademark, or if you do not understand the difference between
53
- open source and public domain, contact the original author at:
54
- http://rocketgeek.com/contact/.
55
-
56
-
57
- INSTALLATION PROCEDURE:
58
-
59
- For complete installation and usage instructions,
60
- visit http://rocketgeek.com
61
- */
62
-
63
-
64
- // Initialize constants.
65
- define( 'WPMEM_VERSION', '3.1.5.2' );
66
- define( 'WPMEM_DEBUG', false );
67
- define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
- define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
69
-
70
- // Localization.
71
- add_action( 'init', 'wpmem_load_textdomain' ); //add_action( 'plugins_loaded', 'wpmem_load_textdomain' );
72
-
73
- // Initialize the plugin.
74
- add_action( 'after_setup_theme', 'wpmem_init', 10 );
75
-
76
- // Install the plugin.
77
- register_activation_hook( __FILE__, 'wpmem_install' );
78
-
79
- // Downgrade settings on deactivation.
80
- //register_deactivation_hook( __FILE__, 'wpmem_downgrade' );
81
-
82
-
83
- /**
84
- * Initialize WP-Members.
85
- *
86
- * The initialization function contains much of what was previously just
87
- * loaded in the main plugin file. It has been moved into this function
88
- * in order to allow action hooks for loading the plugin and initializing
89
- * its features and options.
90
- *
91
- * @since 2.9.0
92
- *
93
- * @global object $wpmem The WP-Members object class.
94
- */
95
- function wpmem_init() {
96
-
97
- // Set the object as global.
98
- global $wpmem;
99
-
100
- /**
101
- * Fires before initialization of plugin options.
102
- *
103
- * @since 2.9.0
104
- */
105
- do_action( 'wpmem_pre_init' );
106
-
107
- /**
108
- * Load the WP_Members class.
109
- */
110
- require_once( WPMEM_PATH . 'inc/class-wp-members.php' );
111
-
112
- // Invoke the WP_Members class.
113
- $wpmem = new WP_Members();
114
-
115
- /**
116
- * Fires after main settings are loaded.
117
- *
118
- * @since 3.0
119
- */
120
- do_action( 'wpmem_settings_loaded' );
121
-
122
- /**
123
- * Filter the location and name of the pluggable file.
124
- *
125
- * @since 2.9.0
126
- *
127
- * @param string The path to WP-Members plugin functions file.
128
- */
129
- $wpmem_pluggable = apply_filters( 'wpmem_plugins_file', WP_PLUGIN_DIR . '/wp-members-pluggable.php' );
130
-
131
- // Preload any custom functions, if available.
132
- if ( file_exists( $wpmem_pluggable ) ) {
133
- include( $wpmem_pluggable );
134
- }
135
-
136
- // Preload the expiration module, if available.
137
- $exp_active = ( function_exists( 'wpmem_exp_init' ) || function_exists( 'wpmem_set_exp' ) ) ? true : false;
138
- define( 'WPMEM_EXP_MODULE', $exp_active );
139
-
140
- /**
141
- * Load the WP-Members core functions file.
142
- */
143
- require_once( WPMEM_PATH . 'inc/core.php' );
144
-
145
- // Load actions and filters.
146
- $wpmem->load_hooks();
147
-
148
- // Load shortcodes.
149
- $wpmem->load_shortcodes();
150
-
151
- // Load fields.
152
- $wpmem->load_fields();
153
-
154
- // Load contants.
155
- $wpmem->load_constants();
156
-
157
- /**
158
- * Fires after initialization of plugin options.
159
- *
160
- * @since 2.9.0
161
- */
162
- do_action( 'wpmem_after_init' );
163
- }
164
-
165
-
166
- /**
167
- * Scripts for admin panels.
168
- *
169
- * Determines which scripts to load and actions to use based on the
170
- * current users capabilities.
171
- *
172
- * @since 2.5.2
173
- * @since 3.1.0 Added admin api object.
174
- *
175
- * @global object $wpmem WP_Members object class.
176
- */
177
- function wpmem_chk_admin() {
178
-
179
- global $wpmem;
180
-
181
- /**
182
- * Fires before initialization of admin options.
183
- *
184
- * @since 2.9.0
185
- */
186
- do_action( 'wpmem_pre_admin_init' );
187
-
188
- /**
189
- * Load the admin api class.
190
- *
191
- * @since 3.1
192
- */
193
- include_once( WPMEM_PATH . 'admin/includes/class-wp-members-admin-api.php' );
194
-
195
- // Initilize the admin api.
196
- $wpmem->load_admin_api();
197
-
198
- /**
199
- * Fires after initialization of admin options.
200
- *
201
- * @since 2.9.0
202
- */
203
- do_action( 'wpmem_after_admin_init' );
204
- }
205
-
206
-
207
- /**
208
- * Adds the plugin options page and JavaScript.
209
- *
210
- * @since 2.5.2
211
- */
212
- function wpmem_admin_options() {
213
- if ( ! is_multisite() || ( is_multisite() && current_user_can( 'edit_theme_options' ) ) ) {
214
- $plugin_page = add_options_page ( 'WP-Members', 'WP-Members', 'manage_options', 'wpmem-settings', 'wpmem_admin' );
215
- }
216
- }
217
-
218
-
219
- /**
220
- * Install the plugin options.
221
- *
222
- * @since 2.5.2
223
- * @since 3.1.1 Added rollback.
224
- *
225
- * @param
226
- */
227
- function wpmem_install( $rollback = false ) {
228
-
229
- /**
230
- * Load the install file.
231
- */
232
- require_once( WPMEM_PATH . 'wp-members-install.php' );
233
-
234
- // Multisite requires different install process.
235
- if ( is_multisite() ) {
236
-
237
- // If it is multisite, install options for each blog.
238
- global $wpdb;
239
- $blogs = $wpdb->get_results(
240
- "SELECT blog_id
241
- FROM {$wpdb->blogs}
242
- WHERE site_id = '{$wpdb->siteid}'
243
- AND spam = '0'
244
- AND deleted = '0'
245
- AND archived = '0'"
246
- );
247
- $original_blog_id = get_current_blog_id();
248
- foreach ( $blogs as $blog_id ) {
249
- switch_to_blog( $blog_id->blog_id );
250
- ( 'downgrade' == $rollback ) ? wpmem_downgrade_dialogs() : wpmem_do_install();
251
- }
252
- switch_to_blog( $original_blog_id );
253
-
254
- } else {
255
-
256
- // Single site install.
257
- ( 'downgrade' == $rollback ) ? wpmem_downgrade_dialogs() : wpmem_do_install();
258
- }
259
- }
260
-
261
-
262
- /**
263
- * Runs downgrade steps in install function.
264
- *
265
- * @since 3.1.1
266
- */
267
- function wpmem_downgrade() {
268
- wpmem_install( 'downgrade' );
269
- }
270
-
271
-
272
- add_action( 'wpmu_new_blog', 'wpmem_mu_new_site', 10, 6 );
273
- /**
274
- * Install default plugin options for a newly added blog in multisite.
275
- *
276
- * @since 2.9.3
277
- *
278
- * @param $blog_id
279
- * @param $user_id
280
- * @param $domain
281
- * @param $path
282
- * @param $site_id
283
- * @param $meta
284
- */
285
- function wpmem_mu_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
286
-
287
- /**
288
- * Load the install file.
289
- */
290
- require_once( WPMEM_PATH . 'wp-members-install.php' );
291
-
292
- // Switch to the new blog.
293
- switch_to_blog( $blog_id );
294
-
295
- // Run the WP-Members install.
296
- wpmem_do_install();
297
-
298
- // Switch back to the current blog.
299
- restore_current_blog();
300
- }
301
-
302
-
303
- /**
304
- * Loads translation files.
305
- *
306
- * @since 3.0.0
307
- */
308
- function wpmem_load_textdomain() {
309
-
310
- // @see: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
311
-
312
- // Plugin textdomain.
313
- $domain = 'wp-members';
314
-
315
- // Wordpress locale.
316
- /** This filter is documented in wp-includes/l10n.php */
317
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
318
-
319
- /**
320
- * Filter translation file.
321
- *
322
- * If the translate.wordpress.org language pack is available, it will
323
- * be /wp-content/languages/plugins/wp-members-{locale}.mo by default.
324
- * You can filter this if you want to load a language pack from a
325
- * different location (or different file name).
326
- *
327
- * @since 3.0.0
328
- *
329
- * @param string $file The translation file to load.
330
- */
331
- $file = apply_filters( 'wpmem_localization_file', trailingslashit( WP_LANG_DIR ) . 'plugins/' . $domain . '-' . $locale . '.mo' );
332
-
333
- $loaded = load_textdomain( $domain, $file );
334
- if ( $loaded ) {
335
- return $loaded;
336
- } else {
337
-
338
- /**
339
- * Filter translation directory.
340
- *
341
- * @since 3.0.3
342
- *
343
- * @param string $dir The translation directory.
344
- */
345
- $dir = apply_filters( 'wpmem_localization_dir', dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
346
- load_plugin_textdomain( $domain, FALSE, $dir );
347
- }
348
- return;
349
- }
350
-
351
  // End of file.
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-Members
4
+ Plugin URI: http://rocketgeek.com
5
+ Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="http://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="http://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
+ Version: 3.1.6.3
7
+ Author: Chad Butler
8
+ Author URI: http://butlerblog.com/
9
+ Text Domain: wp-members
10
+ Domain Path: /lang
11
+ License: GPLv2
12
+ */
13
+
14
+
15
+ /*
16
+ Copyright (c) 2006-2016 Chad Butler
17
+
18
+ The name WP-Members(tm) is a trademark of butlerblog.com
19
+
20
+ This program is free software; you can redistribute it and/or modify
21
+ it under the terms of the GNU General Public License, version 2, as
22
+ published by the Free Software Foundation.
23
+
24
+ This program is distributed in the hope that it will be useful,
25
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ GNU General Public License for more details.
28
+
29
+ You should have received a copy of the GNU General Public License
30
+ along with this program; if not, write to the Free Software
31
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
+
33
+ You may also view the license here:
34
+ http://www.gnu.org/licenses/gpl.html
35
+ */
36
+
37
+
38
+ /*
39
+ A NOTE ABOUT LICENSE:
40
+
41
+ While this plugin is freely available and open-source under the GPL2
42
+ license, that does not mean it is "public domain." You are free to modify
43
+ and redistribute as long as you comply with the license. Any derivative
44
+ work MUST be GPL licensed and available as open source. You also MUST give
45
+ proper attribution to the original author, copyright holder, and trademark
46
+ owner. This means you cannot change two lines of code and claim copyright
47
+ of the entire work as your own. The GPL2 license requires that if you
48
+ modify this code, you must clearly indicate what section(s) you have
49
+ modified and you may only claim copyright of your modifications and not
50
+ the body of work. If you are unsure or have questions about how a
51
+ derivative work you are developing complies with the license, copyright,
52
+ trademark, or if you do not understand the difference between
53
+ open source and public domain, contact the original author at:
54
+ http://rocketgeek.com/contact/.
55
+
56
+
57
+ INSTALLATION PROCEDURE:
58
+
59
+ For complete installation and usage instructions,
60
+ visit http://rocketgeek.com
61
+ */
62
+
63
+
64
+ // Initialize constants.
65
+ define( 'WPMEM_VERSION', '3.1.6.3' );
66
+ define( 'WPMEM_DEBUG', false );
67
+ define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
68
+ define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
69
+
70
+ // Localization.
71
+ add_action( 'init', 'wpmem_load_textdomain' ); //add_action( 'plugins_loaded', 'wpmem_load_textdomain' );
72
+
73
+ // Initialize the plugin.
74
+ add_action( 'after_setup_theme', 'wpmem_init', 10 );
75
+
76
+ // Install the plugin.
77
+ register_activation_hook( __FILE__, 'wpmem_install' );
78
+
79
+ // Downgrade settings on deactivation.
80
+ //register_deactivation_hook( __FILE__, 'wpmem_downgrade' );
81
+
82
+
83
+ /**
84
+ * Initialize WP-Members.
85
+ *
86
+ * The initialization function contains much of what was previously just
87
+ * loaded in the main plugin file. It has been moved into this function
88
+ * in order to allow action hooks for loading the plugin and initializing
89
+ * its features and options.
90
+ *
91
+ * @since 2.9.0
92
+ * @since 3.1.6 Dependencies now loaded by object.
93
+ *
94
+ * @global object $wpmem The WP-Members object class.
95
+ */
96
+ function wpmem_init() {
97
+
98
+ // Set the object as global.
99
+ global $wpmem;
100
+
101
+ /**
102
+ * Fires before initialization of plugin options.
103
+ *
104
+ * @since 2.9.0
105
+ */
106
+ do_action( 'wpmem_pre_init' );
107
+
108
+ /**
109
+ * Load the WP_Members class.
110
+ */
111
+ require_once( WPMEM_PATH . 'inc/class-wp-members.php' );
112
+
113
+ // Invoke the WP_Members class.
114
+ $wpmem = new WP_Members();
115
+
116
+ /**
117
+ * Fires after initialization of plugin options.
118
+ *
119
+ * @since 2.9.0
120
+ */
121
+ do_action( 'wpmem_after_init' );
122
+ }
123
+
124
+
125
+ /**
126
+ * Scripts for admin panels.
127
+ *
128
+ * Determines which scripts to load and actions to use based on the
129
+ * current users capabilities.
130
+ *
131
+ * @since 2.5.2
132
+ * @since 3.1.0 Added admin api object.
133
+ *
134
+ * @global object $wpmem WP_Members object class.
135
+ */
136
+ function wpmem_chk_admin() {
137
+
138
+ global $wpmem;
139
+
140
+ /**
141
+ * Fires before initialization of admin options.
142
+ *
143
+ * @since 2.9.0
144
+ */
145
+ do_action( 'wpmem_pre_admin_init' );
146
+
147
+ /**
148
+ * Load the admin api class.
149
+ *
150
+ * @since 3.1
151
+ */
152
+ include_once( WPMEM_PATH . 'admin/includes/class-wp-members-admin-api.php' );
153
+
154
+ // Initilize the admin api.
155
+ $wpmem->load_admin_api();
156
+
157
+ /**
158
+ * Fires after initialization of admin options.
159
+ *
160
+ * @since 2.9.0
161
+ */
162
+ do_action( 'wpmem_after_admin_init' );
163
+ }
164
+
165
+
166
+ /**
167
+ * Adds the plugin options page and JavaScript.
168
+ *
169
+ * @since 2.5.2
170
+ */
171
+ function wpmem_admin_options() {
172
+ if ( ! is_multisite() || ( is_multisite() && current_user_can( 'edit_theme_options' ) ) ) {
173
+ $plugin_page = add_options_page ( 'WP-Members', 'WP-Members', 'manage_options', 'wpmem-settings', 'wpmem_admin' );
174
+ }
175
+ }
176
+
177
+
178
+ /**
179
+ * Install the plugin options.
180
+ *
181
+ * @since 2.5.2
182
+ * @since 3.1.1 Added rollback.
183
+ * @since 3.1.6 Removed rollback.
184
+ *
185
+ * @param
186
+ */
187
+ function wpmem_install() {
188
+
189
+ /**
190
+ * Load the install file.
191
+ */
192
+ require_once( WPMEM_PATH . 'wp-members-install.php' );
193
+
194
+ // Multisite requires different install process.
195
+ if ( is_multisite() ) {
196
+
197
+ // If it is multisite, install options for each blog.
198
+ global $wpdb;
199
+ $blogs = $wpdb->get_results(
200
+ "SELECT blog_id
201
+ FROM {$wpdb->blogs}
202
+ WHERE site_id = '{$wpdb->siteid}'
203
+ AND spam = '0'
204
+ AND deleted = '0'
205
+ AND archived = '0'"
206
+ );
207
+ $original_blog_id = get_current_blog_id();
208
+ foreach ( $blogs as $blog_id ) {
209
+ switch_to_blog( $blog_id->blog_id );
210
+ wpmem_do_install();
211
+ }
212
+ switch_to_blog( $original_blog_id );
213
+
214
+ } else {
215
+
216
+ // Single site install.
217
+ wpmem_do_install();
218
+ }
219
+ }
220
+
221
+
222
+ /**
223
+ * Runs downgrade steps in install function.
224
+ *
225
+ * @since 3.1.1
226
+ */
227
+ function wpmem_downgrade() {
228
+ //wpmem_install( 'downgrade' );
229
+ }
230
+
231
+
232
+ add_action( 'wpmu_new_blog', 'wpmem_mu_new_site', 10, 6 );
233
+ /**
234
+ * Install default plugin options for a newly added blog in multisite.
235
+ *
236
+ * @since 2.9.3
237
+ *
238
+ * @param $blog_id
239
+ * @param $user_id
240
+ * @param $domain
241
+ * @param $path
242
+ * @param $site_id
243
+ * @param $meta
244
+ */
245
+ function wpmem_mu_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
246
+
247
+ /**
248
+ * Load the install file.
249
+ */
250
+ require_once( WPMEM_PATH . 'wp-members-install.php' );
251
+
252
+ // Switch to the new blog.
253
+ switch_to_blog( $blog_id );
254
+
255
+ // Run the WP-Members install.
256
+ wpmem_do_install();
257
+
258
+ // Switch back to the current blog.
259
+ restore_current_blog();
260
+ }
261
+
262
+
263
+ /**
264
+ * Loads translation files.
265
+ *
266
+ * @since 3.0.0
267
+ */
268
+ function wpmem_load_textdomain() {
269
+
270
+ // @see: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
271
+
272
+ // Plugin textdomain.
273
+ $domain = 'wp-members';
274
+
275
+ // Wordpress locale.
276
+ /** This filter is documented in wp-includes/l10n.php */
277
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
278
+
279
+ /**
280
+ * Filter translation file.
281
+ *
282
+ * If the translate.wordpress.org language pack is available, it will
283
+ * be /wp-content/languages/plugins/wp-members-{locale}.mo by default.
284
+ * You can filter this if you want to load a language pack from a
285
+ * different location (or different file name).
286
+ *
287
+ * @since 3.0.0
288
+ *
289
+ * @param string $file The translation file to load.
290
+ */
291
+ $file = apply_filters( 'wpmem_localization_file', trailingslashit( WP_LANG_DIR ) . 'plugins/' . $domain . '-' . $locale . '.mo' );
292
+
293
+ $loaded = load_textdomain( $domain, $file );
294
+ if ( $loaded ) {
295
+ return $loaded;
296
+ } else {
297
+
298
+ /**
299
+ * Filter translation directory.
300
+ *
301
+ * @since 3.0.3
302
+ *
303
+ * @param string $dir The translation directory.
304
+ */
305
+ $dir = apply_filters( 'wpmem_localization_dir', dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
306
+ load_plugin_textdomain( $domain, FALSE, $dir );
307
+ }
308
+ return;
309
+ }
310
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  // End of file.