Simple Membership - Version 2.2.9

Version Description

  • Added a new feature to customize the password reset email.
  • Added a new feature to customize the admin notification email address.
  • Improved the help text for a few of the email settings fields.
  • Updated the message that gets displayed after a member updates the profile.
Download this release

Release Info

Developer mra13
Plugin Icon 128x128 Simple Membership
Version 2.2.9
Comparing to
See all releases

Code changes from version 2.2.7 to 2.2.9

Files changed (33) hide show
  1. classes/admin-includes/class.swpm-payment-buttons-list-table.php +189 -0
  2. classes/class.simple-wp-membership.php +12 -117
  3. classes/class.swpm-auth.php +77 -71
  4. classes/class.swpm-front-registration.php +10 -6
  5. classes/class.swpm-init-time-tasks.php +147 -0
  6. classes/class.swpm-installation.php +3 -2
  7. classes/class.swpm-misc-utils.php +37 -1
  8. classes/class.swpm-registration.php +18 -5
  9. classes/class.swpm-settings.php +190 -217
  10. classes/shortcode-related/class.swpm-shortcodes-handler.php +35 -0
  11. css/swpm.common.css +3 -0
  12. ipn/swpm_handle_pp_ipn.php +7 -7
  13. ipn/swpm_handle_subsc_ipn.php +1 -1
  14. languages/swpm-sv_SE.mo +0 -0
  15. languages/swpm-sv_SE.po +584 -373
  16. readme.txt +17 -1
  17. simple-wp-membership.php +2 -2
  18. views/admin_addon_settings.php +8 -7
  19. views/admin_members.php +1 -1
  20. views/admin_membership_level_menu.php +2 -2
  21. views/admin_membership_levels.php +3 -1
  22. views/admin_membership_manage.php +1 -1
  23. views/admin_settings.php +12 -11
  24. views/admin_tools_settings.php +34 -34
  25. views/payments/admin_all_payment_transactions.php +47 -0
  26. views/payments/admin_create_payment_buttons.php +48 -0
  27. views/payments/admin_edit_payment_buttons.php +22 -0
  28. views/payments/admin_payment_buttons.php +30 -0
  29. views/payments/admin_payment_settings.php +45 -0
  30. views/payments/admin_payments_page.php +46 -0
  31. views/payments/payment-gateway/admin_paypal_buy_now_button.php +345 -0
  32. views/payments/payment-gateway/admin_paypal_subscription_button.php +165 -0
  33. views/payments/payment-gateway/paypal_button_shortcode_view.php +77 -0
classes/admin-includes/class.swpm-payment-buttons-list-table.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'classes/common/class.swpm-list-table.php');
4
+
5
+ class SwpmPaymentButtonsListTable extends SWPM_List_Table {
6
+
7
+ private $per_page;
8
+
9
+ function __construct() {
10
+ global $status, $page;
11
+
12
+ //Set parent defaults
13
+ parent::__construct(array(
14
+ 'singular' => 'payment button', //singular name of the listed records
15
+ 'plural' => 'payment buttons', //plural name of the listed records
16
+ 'ajax' => false //does this table support ajax?
17
+ ));
18
+
19
+ $this->per_page = 30;
20
+ }
21
+
22
+ function column_default($item, $column_name) {
23
+ //We need to read the values from our CPT and feed the column value for the given column name manually.
24
+
25
+ switch ($column_name) {
26
+ case 'title':
27
+ return get_the_title($item['ID']);
28
+ break;
29
+ case 'membership_level':
30
+ return get_post_meta($item['ID'], 'membership_level_id', true);
31
+ break;
32
+ case 'button_shortcode':
33
+ $shortcode = '[swpm_payment_button id='.$item['ID'].']';
34
+ return $shortcode;
35
+ break;
36
+ }
37
+ }
38
+
39
+ function column_ID($item) {
40
+
41
+ $button_type = get_post_meta($item['ID'], 'button_type', true);
42
+ //Build row actions
43
+ $actions = array(
44
+ 'edit' => sprintf('<a href="admin.php?page=simple_wp_membership_payments&tab=edit_button&button_id=%s&button_type=%s">Edit</a>', $item['ID'], $button_type),
45
+ 'delete' => sprintf('<a href="admin.php?page=simple_wp_membership_payments&tab=payment_buttons&action=delete_payment_btn&button_id=%s" onclick="return confirm(\'Are you sure you want to delete this record?\')">Delete</a>', $item['ID']),
46
+ );
47
+
48
+ //Return the refid column contents
49
+ return $item['ID'] . $this->row_actions($actions);
50
+ }
51
+
52
+ function column_cb($item) {
53
+ return sprintf(
54
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
55
+ /* $1%s */ $this->_args['singular'], //Let's reuse singular label (affiliate)
56
+ /* $2%s */ $item['ID'] //The value of the checkbox should be the record's key/id
57
+ );
58
+ }
59
+
60
+ function get_columns() {
61
+ $columns = array(
62
+ 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
63
+ 'ID' => 'Payment Button ID',
64
+ 'title' => 'Payment Button Title',
65
+ 'membership_level' => 'Membership Level ID',
66
+ 'button_shortcode' => 'Button Shortcode',
67
+ );
68
+ return $columns;
69
+ }
70
+
71
+ function get_sortable_columns() {
72
+ $sortable_columns = array(
73
+ 'ID' => array('ID', false), //true means its already sorted
74
+ );
75
+ return $sortable_columns;
76
+ }
77
+
78
+ function get_bulk_actions() {
79
+ $actions = array(
80
+ 'delete' => 'Delete'
81
+ );
82
+ return $actions;
83
+ }
84
+
85
+ function process_bulk_action() {
86
+ //Detect when a bulk action is being triggered... //print_r($_REQUEST);
87
+ if ('delete' === $this->current_action()) {
88
+ $records_to_delete = $_REQUEST['paymentbutton'];
89
+ if (empty($records_to_delete)) {
90
+ echo '<div id="message" class="updated fade"><p>Error! You need to select multiple records to perform a bulk action!</p></div>';
91
+ return;
92
+ }
93
+ foreach ($records_to_delete as $record_id) {
94
+ wp_delete_post( $record_id );
95
+ }
96
+ echo '<div id="message" class="updated fade"><p>Selected records deleted successfully!</p></div>';
97
+ }
98
+ }
99
+
100
+ function process_delete_action() {
101
+
102
+ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete_payment_btn') { //Delete link was clicked for a row in list table
103
+ $record_id = strip_tags($_REQUEST['button_id']);
104
+ wp_delete_post( $record_id );
105
+ $success_msg = '<div id="message" class="updated"><p>';
106
+ $success_msg .= SwpmUtils::_('The selected entry was deleted!');
107
+ $success_msg .= '</p></div>';
108
+ echo $success_msg;
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Retrieve the current page number
114
+ */
115
+ function get_paged() {
116
+ return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
117
+ }
118
+
119
+ /**
120
+ * Retrieve the total number of CPT items
121
+ */
122
+ function get_total_items() {
123
+ $counts = wp_count_posts('swpm_payment_button');
124
+ $total = 0;
125
+ foreach ($counts as $count)
126
+ $total += $count;
127
+
128
+ return $total;
129
+ }
130
+
131
+ function payment_buttons_data() {
132
+ $data = array();
133
+ $cpt_args = array(
134
+ 'post_type' => 'swpm_payment_button',
135
+ 'post_status' => 'publish',
136
+ 'posts_per_page' => $this->per_page,
137
+ 'paged' => $this->get_paged()
138
+ );
139
+
140
+ //TODO - Do search and sort stuff (see example code)
141
+
142
+ //Retrieve all the CPT items
143
+ $items = get_posts($cpt_args);
144
+ if ($items) {
145
+ foreach ($items as $item) {
146
+
147
+ $membership_level = get_post_meta($item->ID, 'membership_level_id', true);
148
+ $data[] = array(
149
+ 'ID' => $item->ID,
150
+ 'title' => get_the_title($item->ID),
151
+ 'membership_level' => $membership_level,
152
+ );
153
+ }
154
+ }
155
+
156
+ return $data;
157
+ }
158
+
159
+ function prepare_items() {
160
+
161
+ // Lets decide how many records per page to show
162
+ $per_page = $this->per_page;
163
+
164
+ $columns = $this->get_columns();
165
+ $hidden = array();
166
+ $sortable = $this->get_sortable_columns();
167
+
168
+ $this->_column_headers = array($columns, $hidden, $sortable);
169
+
170
+ $this->process_delete_action();
171
+ $this->process_bulk_action();
172
+
173
+ // Pagination requirement
174
+ $current_page = $this->get_pagenum();
175
+ $total_items = $this->get_total_items();
176
+
177
+ // Now we add our *sorted* data to the items property, where it can be used by the rest of the class.
178
+ $data = $this->payment_buttons_data();
179
+ $this->items = $data;
180
+
181
+ //pagination requirement
182
+ $this->set_pagination_args(array(
183
+ 'total_items' => $total_items, //WE have to calculate the total number of items
184
+ 'per_page' => $per_page, //WE have to determine how many items to show on a page
185
+ 'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
186
+ ));
187
+ }
188
+
189
+ }
classes/class.simple-wp-membership.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  include_once('class.swpm-misc-utils.php');
4
  include_once('class.swpm-utils.php');
 
5
  include_once('class.swpm-member-utils.php');
6
  include_once('class.swpm-settings.php');
7
  include_once('class.swpm-protection.php');
@@ -25,12 +26,13 @@ include_once('class.swpm-membership-level-utils.php');
25
  include_once('class.swpm-permission-collection.php');
26
  include_once('class.swpm-auth-permission-collection.php');
27
  include_once('class.swpm-transactions.php');
 
28
 
29
  class SimpleWpMembership {
30
 
31
  public function __construct() {
32
  add_action('admin_menu', array(&$this, 'menu'));
33
- add_action('init', array(&$this, 'init'));
34
 
35
  add_filter('the_content', array(&$this, 'filter_content'), 11, 1);
36
  add_filter('widget_text', 'do_shortcode');
@@ -41,10 +43,13 @@ class SimpleWpMembership {
41
  add_filter('attachment_fields_to_save', array(&$this, 'save_attachment_extra'), 10, 2);
42
  add_filter('the_content_more_link', array(&$this, 'filter_moretag'), 10, 2);
43
 
 
44
  add_shortcode("swpm_registration_form", array(&$this, 'registration_form'));
45
  add_shortcode('swpm_profile_form', array(&$this, 'profile_form'));
46
  add_shortcode('swpm_login_form', array(&$this, 'login'));
47
  add_shortcode('swpm_reset_form', array(&$this, 'reset'));
 
 
48
 
49
  add_action('save_post', array(&$this, 'save_postdata'));
50
  add_action('admin_notices', array(&$this, 'notices'));
@@ -411,82 +416,9 @@ class SimpleWpMembership {
411
  return $acl->filter_post_with_moretag($post->ID, $more_link, $more_link_text);
412
  }
413
 
414
- public function admin_init() {
415
- $createswpmuser = filter_input(INPUT_POST, 'createswpmuser');
416
- if (!empty($createswpmuser)) {
417
- SwpmAdminRegistration::get_instance()->register();
418
- }
419
- $editswpmuser = filter_input(INPUT_POST, 'editswpmuser');
420
- if (!empty($editswpmuser)) {
421
- $id = filter_input(INPUT_GET, 'member_id', FILTER_VALIDATE_INT);
422
- SwpmAdminRegistration::get_instance()->edit($id);
423
- }
424
- $createswpmlevel = filter_input(INPUT_POST, 'createswpmlevel');
425
- if (!empty($createswpmlevel)) {
426
- SwpmMembershipLevel::get_instance()->create();
427
- }
428
- $editswpmlevel = filter_input(INPUT_POST, 'editswpmlevel');
429
- if (!empty($editswpmlevel)) {
430
- $id = filter_input(INPUT_GET, 'id');
431
- SwpmMembershipLevel::get_instance()->edit($id);
432
- }
433
- }
434
-
435
- public function init() {
436
-
437
- //Set up localisation. First loaded ones will override strings present in later loaded file.
438
- //Allows users to have a customized language in a different folder.
439
- $locale = apply_filters('plugin_locale', get_locale(), 'swpm');
440
- load_textdomain('swpm', WP_LANG_DIR . "/swpm-$locale.mo");
441
- load_plugin_textdomain('swpm', false, SIMPLE_WP_MEMBERSHIP_DIRNAME . '/languages/');
442
-
443
- if (!isset($_COOKIE['swpm_session'])) { // give a unique ID to current session.
444
- $uid = md5(microtime());
445
- $_COOKIE['swpm_session'] = $uid; // fake it for current session/
446
- setcookie('swpm_session', $uid, 0, '/');
447
- }
448
-
449
- if (current_user_can('manage_options')) { // admin stuff
450
- $this->admin_init();
451
- }
452
- if (!is_admin()) { //frontend stuff
453
- SwpmAuth::get_instance();
454
- $this->verify_and_delete_account();
455
- $swpm_logout = filter_input(INPUT_GET, 'swpm-logout');
456
- if (!empty($swpm_logout)) {
457
- SwpmAuth::get_instance()->logout();
458
- wp_redirect(home_url());
459
- }
460
- $this->process_password_reset();
461
- $this->register_member();
462
- $this->edit_profile();
463
- }
464
- $this->swpm_ipn_listener();
465
- }
466
-
467
- public function swpm_ipn_listener() {
468
- $swpm_process_ipn = filter_input(INPUT_GET, 'swpm_process_ipn');
469
- if ($swpm_process_ipn == '1') {
470
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm_handle_pp_ipn.php');
471
- exit;
472
- }
473
- }
474
-
475
- public function process_password_reset() {
476
- $message = "";
477
- $swpm_reset = filter_input(INPUT_POST, 'swpm-reset');
478
- $swpm_reset_email = filter_input(INPUT_POST, 'swpm_reset_email', FILTER_UNSAFE_RAW);
479
- if (!empty($swpm_reset)) {
480
- SwpmFrontRegistration::get_instance()->reset_password($swpm_reset_email);
481
- }
482
- }
483
-
484
- private function edit_profile() {
485
- $swpm_editprofile_submit = filter_input(INPUT_POST, 'swpm_editprofile_submit');
486
- if (!empty($swpm_editprofile_submit)) {
487
- SwpmFrontRegistration::get_instance()->edit();
488
- //todo: do a redirect
489
- }
490
  }
491
 
492
  public function admin_library() {
@@ -523,19 +455,10 @@ class SimpleWpMembership {
523
  return SwpmFrontRegistration::get_instance()->regigstration_ui($level);
524
  }
525
 
526
- private function register_member() {
527
- $registration = filter_input(INPUT_POST, 'swpm_registration_submit');
528
- if (!empty($registration)) {
529
- SwpmFrontRegistration::get_instance()->register();
530
- }
531
- }
532
-
533
  public function menu() {
534
  $menu_parent_slug = 'simple_wp_membership';
535
 
536
- add_menu_page(__("WP Membership", 'swpm'), __("WP Membership", 'swpm')
537
- , 'manage_options', $menu_parent_slug, array(&$this, "admin_members")
538
- , SIMPLE_WP_MEMBERSHIP_URL . '/images/logo.png');
539
  add_submenu_page($menu_parent_slug, __("Members", 'swpm'), __('Members', 'swpm'), 'manage_options', 'simple_wp_membership', array(&$this, "admin_members"));
540
  add_submenu_page($menu_parent_slug, __("Membership Levels", 'swpm'), __("Membership Levels", 'swpm'), 'manage_options', 'simple_wp_membership_levels', array(&$this, "admin_membership_levels"));
541
  add_submenu_page($menu_parent_slug, __("Settings", 'swpm'), __("Settings", 'swpm'), 'manage_options', 'simple_wp_membership_settings', array(&$this, "admin_settings"));
@@ -606,7 +529,7 @@ class SimpleWpMembership {
606
  include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_tools_settings.php');
607
  break;
608
  case 2:
609
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_payment_settings.php');
610
  break;
611
  default:
612
  include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_settings.php');
@@ -615,7 +538,7 @@ class SimpleWpMembership {
615
  }
616
 
617
  public function payments_menu() {
618
- include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_payments_page.php');
619
  }
620
 
621
  public function add_ons_menu() {
@@ -645,32 +568,4 @@ class SimpleWpMembership {
645
  wp_clear_scheduled_hook('swpm_delete_pending_account_event');
646
  }
647
 
648
- private function verify_and_delete_account() {
649
- include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'classes/class.swpm-members.php');
650
- $delete_account = filter_input(INPUT_GET, 'delete_account');
651
- if (empty($delete_account)) {
652
- return;
653
- }
654
- $password = filter_input(INPUT_POST, 'account_delete_confirm_pass', FILTER_UNSAFE_RAW);
655
-
656
- $auth = SwpmAuth::get_instance();
657
- if (!$auth->is_logged_in()) {
658
- return;
659
- }
660
- if (empty($password)) {
661
- SwpmUtils::account_delete_confirmation_ui();
662
- }
663
-
664
- $nonce_field = filter_input(INPUT_POST, 'account_delete_confirm_nonce');
665
- if (empty($nonce_field) || !wp_verify_nonce($nonce_field, 'swpm_account_delete_confirm')) {
666
- SwpmUtils::account_delete_confirmation_ui(SwpmUtils::_("Sorry, Nonce verification failed."));
667
- }
668
- if ($auth->match_password($password)) {
669
- $auth->delete();
670
- wp_redirect(home_url());
671
- } else {
672
- SwpmUtils::account_delete_confirmation_ui(SwpmUtils::_("Sorry, Password didn't match."));
673
- }
674
- }
675
-
676
  }
2
 
3
  include_once('class.swpm-misc-utils.php');
4
  include_once('class.swpm-utils.php');
5
+ include_once('class.swpm-init-time-tasks.php');
6
  include_once('class.swpm-member-utils.php');
7
  include_once('class.swpm-settings.php');
8
  include_once('class.swpm-protection.php');
26
  include_once('class.swpm-permission-collection.php');
27
  include_once('class.swpm-auth-permission-collection.php');
28
  include_once('class.swpm-transactions.php');
29
+ include_once('shortcode-related/class.swpm-shortcodes-handler.php');
30
 
31
  class SimpleWpMembership {
32
 
33
  public function __construct() {
34
  add_action('admin_menu', array(&$this, 'menu'));
35
+ add_action('init', array(&$this, 'init_hook'));
36
 
37
  add_filter('the_content', array(&$this, 'filter_content'), 11, 1);
38
  add_filter('widget_text', 'do_shortcode');
43
  add_filter('attachment_fields_to_save', array(&$this, 'save_attachment_extra'), 10, 2);
44
  add_filter('the_content_more_link', array(&$this, 'filter_moretag'), 10, 2);
45
 
46
+ //TODO - refactor these shortcodes into the shortcodes handler class
47
  add_shortcode("swpm_registration_form", array(&$this, 'registration_form'));
48
  add_shortcode('swpm_profile_form', array(&$this, 'profile_form'));
49
  add_shortcode('swpm_login_form', array(&$this, 'login'));
50
  add_shortcode('swpm_reset_form', array(&$this, 'reset'));
51
+
52
+ new SwpmShortcodesHandler();//Tackle the shortcode definitions and implementation.
53
 
54
  add_action('save_post', array(&$this, 'save_postdata'));
55
  add_action('admin_notices', array(&$this, 'notices'));
416
  return $acl->filter_post_with_moretag($post->ID, $more_link, $more_link_text);
417
  }
418
 
419
+ public function init_hook() {
420
+ $init_tasks = new SwpmInitTimeTasks();
421
+ $init_tasks->do_init_tasks();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  }
423
 
424
  public function admin_library() {
455
  return SwpmFrontRegistration::get_instance()->regigstration_ui($level);
456
  }
457
 
 
 
 
 
 
 
 
458
  public function menu() {
459
  $menu_parent_slug = 'simple_wp_membership';
460
 
461
+ add_menu_page(__("WP Membership", 'swpm'), __("WP Membership", 'swpm'), 'manage_options', $menu_parent_slug, array(&$this, "admin_members"), 'dashicons-id');
 
 
462
  add_submenu_page($menu_parent_slug, __("Members", 'swpm'), __('Members', 'swpm'), 'manage_options', 'simple_wp_membership', array(&$this, "admin_members"));
463
  add_submenu_page($menu_parent_slug, __("Membership Levels", 'swpm'), __("Membership Levels", 'swpm'), 'manage_options', 'simple_wp_membership_levels', array(&$this, "admin_membership_levels"));
464
  add_submenu_page($menu_parent_slug, __("Settings", 'swpm'), __("Settings", 'swpm'), 'manage_options', 'simple_wp_membership_settings', array(&$this, "admin_settings"));
529
  include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_tools_settings.php');
530
  break;
531
  case 2:
532
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/admin_payment_settings.php');
533
  break;
534
  default:
535
  include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_settings.php');
538
  }
539
 
540
  public function payments_menu() {
541
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/admin_payments_page.php');
542
  }
543
 
544
  public function add_ons_menu() {
568
  wp_clear_scheduled_hook('swpm_delete_pending_account_event');
569
  }
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  }
classes/class.swpm-auth.php CHANGED
@@ -14,15 +14,17 @@ class SwpmAuth {
14
  $this->userData = null;
15
  $this->protected = SwpmProtection::get_instance();
16
  }
17
- private function init(){
 
18
  $valid = $this->validate();
19
  //Blog::log_simple_debug("init:". ($valid? "valid": "invalid"), true);
20
- if (!$valid){
21
  $this->authenticate();
22
  }
23
  }
 
24
  public static function get_instance() {
25
- if (empty(self::$_this)){
26
  self::$_this = new SwpmAuth();
27
  self::$_this->init();
28
  }
@@ -31,8 +33,8 @@ class SwpmAuth {
31
 
32
  private function authenticate($user = null, $pass = null) {
33
  global $wpdb;
34
- $swpm_password = empty($pass)?filter_input(INPUT_POST, 'swpm_password') : $pass;
35
- $swpm_user_name = empty($user)? apply_filters('swpm_user_name', filter_input(INPUT_POST, 'swpm_user_name')) : $user;
36
  //Blog::log_simple_debug("Authenticate:" . $swpm_user_name, true);
37
  if (!empty($swpm_user_name) && !empty($swpm_password)) {
38
  $user = sanitize_user($swpm_user_name);
@@ -68,51 +70,45 @@ class SwpmAuth {
68
  }
69
 
70
  private function check_constraints() {
71
- if (empty($this->userData)){
72
  return false;
73
  }
74
  $enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
75
-
76
  $can_login = true;
77
- if( $this->userData->account_state == 'inactive'){
78
  $this->lastStatusMsg = SwpmUtils::_('Account is inactive.');
79
  $can_login = false;
80
- }
81
- else if( $this->userData->account_state == 'pending'){
82
  $this->lastStatusMsg = SwpmUtils::_('Account is pending.');
83
  $can_login = false;
84
- }
85
- else if( ($this->userData->account_state == 'expired') && empty($enable_expired_login) ){
86
  $this->lastStatusMsg = SwpmUtils::_('Account has expired.');
87
  $can_login = false;
88
- }
89
 
90
- if(!$can_login){
91
  $this->isLoggedIn = false;
92
  $this->userData = null;
93
- return false;
94
  }
95
-
96
- if (SwpmUtils::is_subscription_expired($this->userData)){
97
- if ($this->userData->account_state == 'active'){
98
  global $wpdb;
99
- $wpdb->update(
100
- $wpdb->prefix . 'swpm_members_tbl',
101
- array( 'account_state' => 'expired'),
102
- array( 'member_id' => $this->userData->member_id ),
103
- array( '%s'),
104
- array( '%d' )
105
  );
106
  }
107
- if (empty($enable_expired_login)){
108
  $this->lastStatusMsg = SwpmUtils::_('Account has expired.');
109
  $this->isLoggedIn = false;
110
  $this->userData = null;
111
  return false;
112
  }
113
  }
114
-
115
- $this->permitted = SwpmPermission::get_instance($this->userData->membership_level);
116
  $this->lastStatusMsg = SwpmUtils::_("You are logged in as:") . $this->userData->user_name;
117
  $this->isLoggedIn = true;
118
  return true;
@@ -120,7 +116,7 @@ class SwpmAuth {
120
 
121
  private function check_password($password, $hash) {
122
  global $wp_hasher;
123
- if (empty($password)){
124
  return false;
125
  }
126
  if (empty($wp_hasher)) {
@@ -129,17 +125,21 @@ class SwpmAuth {
129
  }
130
  return $wp_hasher->CheckPassword($password, $hash);
131
  }
132
- public function match_password($password){
133
- if (!$this->is_logged_in()) {return false;}
 
 
 
134
  return $this->check_password($password, $this->get('password'));
135
  }
 
136
  public function login($user, $pass, $remember = '', $secure = '') {
137
- SwpmLog::log_simple_debug("login",true);
138
- if ($this->isLoggedIn){
139
  return;
140
  }
141
  if ($this->authenticate($user, $pass) && $this->validate()) {
142
- $this->set_cookie($remember, $secure);
143
  } else {
144
  $this->isLoggedIn = false;
145
  $this->userData = null;
@@ -148,7 +148,7 @@ class SwpmAuth {
148
  }
149
 
150
  public function logout() {
151
- if (!$this->isLoggedIn){
152
  return;
153
  }
154
  setcookie(SIMPLE_WP_MEMBERSHIP_AUTH, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
@@ -160,23 +160,22 @@ class SwpmAuth {
160
  }
161
 
162
  private function set_cookie($remember = '', $secure = '') {
163
- if ($remember){
164
  $expiration = time() + 1209600; // 14 days
165
- $expire = $expiration + 43200; // 12 hours grace period
166
- }
167
- else{
168
  $expiration = time() + 172800; // 2 days.
169
- $expire = $expiration;//The minimum cookie expiration should be at least couple of days.
170
  }
171
-
172
  $expiration_timestamp = SwpmUtils::get_expiration_timestamp($this->userData);
173
  $enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
174
  // make sure cookie doesn't live beyond account expiration date.
175
  // but if expired account login is enabled then ignore if account is expired
176
- $expiration = empty($enable_expired_login)? min ($expiration,$expiration_timestamp) : $expiration;
177
  $pass_frag = substr($this->userData->password, 8, 4);
178
  $scheme = 'auth';
179
- if (!$secure){
180
  $secure = is_ssl();
181
  }
182
  $key = SwpmAuth::b_hash($this->userData->user_name . $pass_frag . '|' . $expiration, $scheme);
@@ -189,18 +188,18 @@ class SwpmAuth {
189
 
190
  private function validate() {
191
  $auth_cookie_name = is_ssl() ? SIMPLE_WP_MEMBERSHIP_SEC_AUTH : SIMPLE_WP_MEMBERSHIP_AUTH;
192
- if (!isset($_COOKIE[$auth_cookie_name]) || empty($_COOKIE[$auth_cookie_name])){
193
  return false;
194
  }
195
  $cookie_elements = explode('|', $_COOKIE[$auth_cookie_name]);
196
- if (count($cookie_elements) != 3){
197
  return false;
198
  }
199
- SwpmLog::log_simple_debug("validate:" . $_COOKIE[$auth_cookie_name],true);
200
  list($username, $expiration, $hmac) = $cookie_elements;
201
  $expired = $expiration;
202
  // Allow a grace period for POST and AJAX requests
203
- if (defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD']){
204
  $expired += HOUR_IN_SECONDS;
205
  }
206
  // Quick check to see if an honest cookie has expired
@@ -208,7 +207,7 @@ class SwpmAuth {
208
  $this->lastStatusMsg = SwpmUtils::_("Session Expired."); //do_action('auth_cookie_expired', $cookie_elements);
209
  return false;
210
  }
211
- SwpmLog::log_simple_debug("validate:Session Expired",true);
212
  global $wpdb;
213
  $query = " SELECT * FROM " . $wpdb->prefix . "swpm_members_tbl WHERE user_name = %s";
214
  $user = $wpdb->get_row($wpdb->prepare($query, $username));
@@ -216,16 +215,16 @@ class SwpmAuth {
216
  $this->lastStatusMsg = SwpmUtils::_("Invalid User Name");
217
  return false;
218
  }
219
- SwpmLog::log_simple_debug("validate:Invalid User Name:" . serialize($user),true);
220
  $pass_frag = substr($user->password, 8, 4);
221
  $key = SwpmAuth::b_hash($username . $pass_frag . '|' . $expiration);
222
  $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
223
  if ($hmac != $hash) {
224
- $this->lastStatusMsg = SwpmUtils::_("Sorry! Something went wrong");
225
  return false;
226
  }
227
- SwpmLog::log_simple_debug("validate:bad hash",true);
228
- if ($expiration < time()){
229
  $GLOBALS['login_grace_period'] = 1;
230
  }
231
  $this->userData = $user;
@@ -242,13 +241,13 @@ class SwpmAuth {
242
  }
243
 
244
  public function get($key, $default = "") {
245
- if (isset($this->userData->$key)){
246
  return $this->userData->$key;
247
  }
248
- if (isset($this->permitted->$key)){
249
  return $this->permitted->$key;
250
  }
251
- if (!empty($this->permitted)){
252
  return $this->permitted->get($key, $default);
253
  }
254
  return $default;
@@ -257,35 +256,42 @@ class SwpmAuth {
257
  public function get_message() {
258
  return $this->lastStatusMsg;
259
  }
260
- public function get_expire_date(){
261
- if ($this->isLoggedIn){
 
262
  return SwpmUtils::get_expire_date(
263
- $this->get('subscription_starts'),
264
- $this->get('subscription_period'),
265
- $this->get('subscription_duration_type'));
266
  }
267
  return "";
268
  }
269
- public function delete(){
270
- if (!$this->is_logged_in()) {return ;}
 
 
 
271
  $user_name = $this->get('user_name');
272
- $user_id = $this->get('member_id');
273
  wp_clear_auth_cookie();
274
- $this->logout();
275
  SwpmMembers::delete_swpm_user_by_id($user_id);
276
  SwpmMembers::delete_wp_user($user_name);
277
  }
278
-
279
- public function reload_user_data(){
280
- if (!$this->is_logged_in()) {return ;}
 
 
281
  global $wpdb;
282
  $query = "SELECT * FROM " . $wpdb->prefix . "swpm_members_tbl WHERE member_id = %d";
283
- $this->userData = $wpdb->get_row($wpdb->prepare($query, $this->userData->member_id));
284
-
285
  }
286
- public function is_expired_account(){
287
- // should be called after logging in.
288
- if (!$this->is_logged_in()) {return null;}
 
 
 
289
  return $this->get('account_state') === 'expired';
290
  }
 
291
  }
14
  $this->userData = null;
15
  $this->protected = SwpmProtection::get_instance();
16
  }
17
+
18
+ private function init() {
19
  $valid = $this->validate();
20
  //Blog::log_simple_debug("init:". ($valid? "valid": "invalid"), true);
21
+ if (!$valid) {
22
  $this->authenticate();
23
  }
24
  }
25
+
26
  public static function get_instance() {
27
+ if (empty(self::$_this)) {
28
  self::$_this = new SwpmAuth();
29
  self::$_this->init();
30
  }
33
 
34
  private function authenticate($user = null, $pass = null) {
35
  global $wpdb;
36
+ $swpm_password = empty($pass) ? filter_input(INPUT_POST, 'swpm_password') : $pass;
37
+ $swpm_user_name = empty($user) ? apply_filters('swpm_user_name', filter_input(INPUT_POST, 'swpm_user_name')) : $user;
38
  //Blog::log_simple_debug("Authenticate:" . $swpm_user_name, true);
39
  if (!empty($swpm_user_name) && !empty($swpm_password)) {
40
  $user = sanitize_user($swpm_user_name);
70
  }
71
 
72
  private function check_constraints() {
73
+ if (empty($this->userData)) {
74
  return false;
75
  }
76
  $enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
77
+
78
  $can_login = true;
79
+ if ($this->userData->account_state == 'inactive') {
80
  $this->lastStatusMsg = SwpmUtils::_('Account is inactive.');
81
  $can_login = false;
82
+ } else if ($this->userData->account_state == 'pending') {
 
83
  $this->lastStatusMsg = SwpmUtils::_('Account is pending.');
84
  $can_login = false;
85
+ } else if (($this->userData->account_state == 'expired') && empty($enable_expired_login)) {
 
86
  $this->lastStatusMsg = SwpmUtils::_('Account has expired.');
87
  $can_login = false;
88
+ }
89
 
90
+ if (!$can_login) {
91
  $this->isLoggedIn = false;
92
  $this->userData = null;
93
+ return false;
94
  }
95
+
96
+ if (SwpmUtils::is_subscription_expired($this->userData)) {
97
+ if ($this->userData->account_state == 'active') {
98
  global $wpdb;
99
+ $wpdb->update(
100
+ $wpdb->prefix . 'swpm_members_tbl', array('account_state' => 'expired'), array('member_id' => $this->userData->member_id), array('%s'), array('%d')
 
 
 
 
101
  );
102
  }
103
+ if (empty($enable_expired_login)) {
104
  $this->lastStatusMsg = SwpmUtils::_('Account has expired.');
105
  $this->isLoggedIn = false;
106
  $this->userData = null;
107
  return false;
108
  }
109
  }
110
+
111
+ $this->permitted = SwpmPermission::get_instance($this->userData->membership_level);
112
  $this->lastStatusMsg = SwpmUtils::_("You are logged in as:") . $this->userData->user_name;
113
  $this->isLoggedIn = true;
114
  return true;
116
 
117
  private function check_password($password, $hash) {
118
  global $wp_hasher;
119
+ if (empty($password)) {
120
  return false;
121
  }
122
  if (empty($wp_hasher)) {
125
  }
126
  return $wp_hasher->CheckPassword($password, $hash);
127
  }
128
+
129
+ public function match_password($password) {
130
+ if (!$this->is_logged_in()) {
131
+ return false;
132
+ }
133
  return $this->check_password($password, $this->get('password'));
134
  }
135
+
136
  public function login($user, $pass, $remember = '', $secure = '') {
137
+ SwpmLog::log_simple_debug("login", true);
138
+ if ($this->isLoggedIn) {
139
  return;
140
  }
141
  if ($this->authenticate($user, $pass) && $this->validate()) {
142
+ $this->set_cookie($remember, $secure);
143
  } else {
144
  $this->isLoggedIn = false;
145
  $this->userData = null;
148
  }
149
 
150
  public function logout() {
151
+ if (!$this->isLoggedIn) {
152
  return;
153
  }
154
  setcookie(SIMPLE_WP_MEMBERSHIP_AUTH, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
160
  }
161
 
162
  private function set_cookie($remember = '', $secure = '') {
163
+ if ($remember) {
164
  $expiration = time() + 1209600; // 14 days
165
+ $expire = $expiration + 43200; // 12 hours grace period
166
+ } else {
 
167
  $expiration = time() + 172800; // 2 days.
168
+ $expire = $expiration; //The minimum cookie expiration should be at least couple of days.
169
  }
170
+
171
  $expiration_timestamp = SwpmUtils::get_expiration_timestamp($this->userData);
172
  $enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
173
  // make sure cookie doesn't live beyond account expiration date.
174
  // but if expired account login is enabled then ignore if account is expired
175
+ $expiration = empty($enable_expired_login) ? min($expiration, $expiration_timestamp) : $expiration;
176
  $pass_frag = substr($this->userData->password, 8, 4);
177
  $scheme = 'auth';
178
+ if (!$secure) {
179
  $secure = is_ssl();
180
  }
181
  $key = SwpmAuth::b_hash($this->userData->user_name . $pass_frag . '|' . $expiration, $scheme);
188
 
189
  private function validate() {
190
  $auth_cookie_name = is_ssl() ? SIMPLE_WP_MEMBERSHIP_SEC_AUTH : SIMPLE_WP_MEMBERSHIP_AUTH;
191
+ if (!isset($_COOKIE[$auth_cookie_name]) || empty($_COOKIE[$auth_cookie_name])) {
192
  return false;
193
  }
194
  $cookie_elements = explode('|', $_COOKIE[$auth_cookie_name]);
195
+ if (count($cookie_elements) != 3) {
196
  return false;
197
  }
198
+ SwpmLog::log_simple_debug("validate:" . $_COOKIE[$auth_cookie_name], true);
199
  list($username, $expiration, $hmac) = $cookie_elements;
200
  $expired = $expiration;
201
  // Allow a grace period for POST and AJAX requests
202
+ if (defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD']) {
203
  $expired += HOUR_IN_SECONDS;
204
  }
205
  // Quick check to see if an honest cookie has expired
207
  $this->lastStatusMsg = SwpmUtils::_("Session Expired."); //do_action('auth_cookie_expired', $cookie_elements);
208
  return false;
209
  }
210
+ SwpmLog::log_simple_debug("validate:Session Expired", true);
211
  global $wpdb;
212
  $query = " SELECT * FROM " . $wpdb->prefix . "swpm_members_tbl WHERE user_name = %s";
213
  $user = $wpdb->get_row($wpdb->prepare($query, $username));
215
  $this->lastStatusMsg = SwpmUtils::_("Invalid User Name");
216
  return false;
217
  }
218
+ SwpmLog::log_simple_debug("validate:Invalid User Name:" . serialize($user), true);
219
  $pass_frag = substr($user->password, 8, 4);
220
  $key = SwpmAuth::b_hash($username . $pass_frag . '|' . $expiration);
221
  $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
222
  if ($hmac != $hash) {
223
+ $this->lastStatusMsg = SwpmUtils::_("Please login again.");
224
  return false;
225
  }
226
+ SwpmLog::log_simple_debug("validate:bad hash", true);
227
+ if ($expiration < time()) {
228
  $GLOBALS['login_grace_period'] = 1;
229
  }
230
  $this->userData = $user;
241
  }
242
 
243
  public function get($key, $default = "") {
244
+ if (isset($this->userData->$key)) {
245
  return $this->userData->$key;
246
  }
247
+ if (isset($this->permitted->$key)) {
248
  return $this->permitted->$key;
249
  }
250
+ if (!empty($this->permitted)) {
251
  return $this->permitted->get($key, $default);
252
  }
253
  return $default;
256
  public function get_message() {
257
  return $this->lastStatusMsg;
258
  }
259
+
260
+ public function get_expire_date() {
261
+ if ($this->isLoggedIn) {
262
  return SwpmUtils::get_expire_date(
263
+ $this->get('subscription_starts'), $this->get('subscription_period'), $this->get('subscription_duration_type'));
 
 
264
  }
265
  return "";
266
  }
267
+
268
+ public function delete() {
269
+ if (!$this->is_logged_in()) {
270
+ return;
271
+ }
272
  $user_name = $this->get('user_name');
273
+ $user_id = $this->get('member_id');
274
  wp_clear_auth_cookie();
275
+ $this->logout();
276
  SwpmMembers::delete_swpm_user_by_id($user_id);
277
  SwpmMembers::delete_wp_user($user_name);
278
  }
279
+
280
+ public function reload_user_data() {
281
+ if (!$this->is_logged_in()) {
282
+ return;
283
+ }
284
  global $wpdb;
285
  $query = "SELECT * FROM " . $wpdb->prefix . "swpm_members_tbl WHERE member_id = %d";
286
+ $this->userData = $wpdb->get_row($wpdb->prepare($query, $this->userData->member_id));
 
287
  }
288
+
289
+ public function is_expired_account() {
290
+ // should be called after logging in.
291
+ if (!$this->is_logged_in()) {
292
+ return null;
293
+ }
294
  return $this->get('account_state') === 'expired';
295
  }
296
+
297
  }
classes/class.swpm-front-registration.php CHANGED
@@ -145,17 +145,21 @@ class SwpmFrontRegistration extends SwpmRegistration {
145
  $form = new SwpmForm($user_data);
146
  if ($form->is_valid()) {
147
  global $wpdb;
148
- $member_info = $form->get_sanitized();
149
- // update corresponding wp user.
150
- SwpmUtils::update_wp_user($auth->get('user_name'), $member_info);
 
 
 
151
  if (isset($member_info['plain_password'])) {
 
 
152
  unset($member_info['plain_password']);
153
  }
154
 
155
- $wpdb->update(
156
- $wpdb->prefix . "swpm_members_tbl", $member_info, array('member_id' => $auth->get('member_id')));
157
  $auth->reload_user_data();
158
- $message = array('succeeded' => true, 'message' => 'Profile Updated.');
159
  SwpmTransfer::get_instance()->set('status', $message);
160
  } else {
161
  $message = array('succeeded' => false, 'message' => SwpmUtils::_('Please correct the following'),
145
  $form = new SwpmForm($user_data);
146
  if ($form->is_valid()) {
147
  global $wpdb;
148
+ $message = array('succeeded' => true, 'message' => SwpmUtils::_('Profile updated successfully.'));
149
+
150
+ $member_info = $form->get_sanitized();
151
+ SwpmUtils::update_wp_user($auth->get('user_name'), $member_info); //Update corresponding wp user record.
152
+
153
+
154
  if (isset($member_info['plain_password'])) {
155
+ //Password was also changed so show the appropriate message
156
+ $message = array('succeeded' => true, 'message' => SwpmUtils::_('Profile updated successfully. You will need to re-login since you changed your password.'));
157
  unset($member_info['plain_password']);
158
  }
159
 
160
+ $wpdb->update($wpdb->prefix . "swpm_members_tbl", $member_info, array('member_id' => $auth->get('member_id')));
 
161
  $auth->reload_user_data();
162
+
163
  SwpmTransfer::get_instance()->set('status', $message);
164
  } else {
165
  $message = array('succeeded' => false, 'message' => SwpmUtils::_('Please correct the following'),
classes/class.swpm-init-time-tasks.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SwpmInitTimeTasks {
4
+
5
+ public function __construct() {
6
+
7
+ }
8
+
9
+ public function do_init_tasks() {
10
+
11
+ //Set up localisation. First loaded ones will override strings present in later loaded file.
12
+ //Allows users to have a customized language in a different folder.
13
+ $locale = apply_filters('plugin_locale', get_locale(), 'swpm');
14
+ load_textdomain('swpm', WP_LANG_DIR . "/swpm-$locale.mo");
15
+ load_plugin_textdomain('swpm', false, SIMPLE_WP_MEMBERSHIP_DIRNAME . '/languages/');
16
+
17
+ if (!isset($_COOKIE['swpm_session'])) { // give a unique ID to current session.
18
+ $uid = md5(microtime());
19
+ $_COOKIE['swpm_session'] = $uid; // fake it for current session/
20
+ setcookie('swpm_session', $uid, 0, '/');
21
+ }
22
+
23
+ //Crete the custom post types
24
+ $this->create_post_type();
25
+
26
+ if (current_user_can('manage_options')) { // Admin stuff
27
+ $this->admin_init();
28
+ }
29
+
30
+ //Do frontend-only init time taks
31
+ if (!is_admin()) {
32
+ SwpmAuth::get_instance();
33
+ $this->verify_and_delete_account();
34
+ $swpm_logout = filter_input(INPUT_GET, 'swpm-logout');
35
+ if (!empty($swpm_logout)) {
36
+ SwpmAuth::get_instance()->logout();
37
+ wp_redirect(home_url());
38
+ }
39
+ $this->process_password_reset();
40
+ $this->register_member();
41
+ $this->edit_profile();
42
+ }
43
+
44
+ //IPN listener
45
+ $this->swpm_ipn_listener();
46
+ }
47
+
48
+ public function admin_init() {
49
+ $createswpmuser = filter_input(INPUT_POST, 'createswpmuser');
50
+ if (!empty($createswpmuser)) {
51
+ SwpmAdminRegistration::get_instance()->register();
52
+ }
53
+ $editswpmuser = filter_input(INPUT_POST, 'editswpmuser');
54
+ if (!empty($editswpmuser)) {
55
+ $id = filter_input(INPUT_GET, 'member_id', FILTER_VALIDATE_INT);
56
+ SwpmAdminRegistration::get_instance()->edit($id);
57
+ }
58
+ $createswpmlevel = filter_input(INPUT_POST, 'createswpmlevel');
59
+ if (!empty($createswpmlevel)) {
60
+ SwpmMembershipLevel::get_instance()->create();
61
+ }
62
+ $editswpmlevel = filter_input(INPUT_POST, 'editswpmlevel');
63
+ if (!empty($editswpmlevel)) {
64
+ $id = filter_input(INPUT_GET, 'id');
65
+ SwpmMembershipLevel::get_instance()->edit($id);
66
+ }
67
+ }
68
+
69
+ public function create_post_type() {
70
+ //The payment button data for membership levels will be stored using this CPT
71
+ register_post_type('swpm_payment_button', array(
72
+ 'public' => false,
73
+ 'publicly_queryable' => false,
74
+ 'show_ui' => false,
75
+ 'query_var' => false,
76
+ 'rewrite' => false,
77
+ 'capability_type' => 'page',
78
+ 'has_archive' => false,
79
+ 'hierarchical' => false,
80
+ 'supports' => array('title', 'editor')
81
+ ));
82
+
83
+ }
84
+
85
+ private function verify_and_delete_account() {
86
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'classes/class.swpm-members.php');
87
+ $delete_account = filter_input(INPUT_GET, 'delete_account');
88
+ if (empty($delete_account)) {
89
+ return;
90
+ }
91
+ $password = filter_input(INPUT_POST, 'account_delete_confirm_pass', FILTER_UNSAFE_RAW);
92
+
93
+ $auth = SwpmAuth::get_instance();
94
+ if (!$auth->is_logged_in()) {
95
+ return;
96
+ }
97
+ if (empty($password)) {
98
+ SwpmUtils::account_delete_confirmation_ui();
99
+ }
100
+
101
+ $nonce_field = filter_input(INPUT_POST, 'account_delete_confirm_nonce');
102
+ if (empty($nonce_field) || !wp_verify_nonce($nonce_field, 'swpm_account_delete_confirm')) {
103
+ SwpmUtils::account_delete_confirmation_ui(SwpmUtils::_("Sorry, Nonce verification failed."));
104
+ }
105
+ if ($auth->match_password($password)) {
106
+ $auth->delete();
107
+ wp_redirect(home_url());
108
+ } else {
109
+ SwpmUtils::account_delete_confirmation_ui(SwpmUtils::_("Sorry, Password didn't match."));
110
+ }
111
+ }
112
+
113
+ public function process_password_reset() {
114
+ $message = "";
115
+ $swpm_reset = filter_input(INPUT_POST, 'swpm-reset');
116
+ $swpm_reset_email = filter_input(INPUT_POST, 'swpm_reset_email', FILTER_UNSAFE_RAW);
117
+ if (!empty($swpm_reset)) {
118
+ SwpmFrontRegistration::get_instance()->reset_password($swpm_reset_email);
119
+ }
120
+ }
121
+
122
+ private function register_member() {
123
+ $registration = filter_input(INPUT_POST, 'swpm_registration_submit');
124
+ if (!empty($registration)) {
125
+ SwpmFrontRegistration::get_instance()->register();
126
+ }
127
+ }
128
+
129
+ private function edit_profile() {
130
+ $swpm_editprofile_submit = filter_input(INPUT_POST, 'swpm_editprofile_submit');
131
+ if (!empty($swpm_editprofile_submit)) {
132
+ SwpmFrontRegistration::get_instance()->edit();
133
+ //TODO - do a redirect?
134
+ }
135
+ }
136
+
137
+ /* PayPal Payment IPN listener */
138
+
139
+ public function swpm_ipn_listener() {
140
+ $swpm_process_ipn = filter_input(INPUT_GET, 'swpm_process_ipn');
141
+ if ($swpm_process_ipn == '1') {
142
+ include(SIMPLE_WP_MEMBERSHIP_PATH . 'ipn/swpm_handle_pp_ipn.php');
143
+ exit;
144
+ }
145
+ }
146
+
147
+ }
classes/class.swpm-installation.php CHANGED
@@ -201,9 +201,10 @@ class SwpmInstallation {
201
  "\n\nThank You";
202
  $reset_email_subject = get_bloginfo('name') . ": New Password";
203
  $reset_email_body = "Dear {first_name} {last_name}" .
204
- "\n\nHere is your new password" .
205
  "\n\nUser name: {user_name}" .
206
- "\n\nPassword: {password}" .
 
207
  "\n\nThank You";
208
 
209
  $status_change_email_subject = "Account Updated!";
201
  "\n\nThank You";
202
  $reset_email_subject = get_bloginfo('name') . ": New Password";
203
  $reset_email_body = "Dear {first_name} {last_name}" .
204
+ "\n\nHere is your new password:" .
205
  "\n\nUser name: {user_name}" .
206
+ "\nPassword: {password}" .
207
+ "\n\nYou can change the password from the edit profile section of the site (after you log into the site)" .
208
  "\n\nThank You";
209
 
210
  $status_change_email_subject = "Account Updated!";
classes/class.swpm-misc-utils.php CHANGED
@@ -143,7 +143,7 @@ class SwpmMiscUtils {
143
  public static function reset_swmp_log_files() {
144
  $log_reset = true;
145
  $logfile_list = array(
146
- SIMPLE_WP_MEMBERSHIP_PATH.'/log.txt',
147
  );
148
 
149
  foreach ($logfile_list as $logfile) {
@@ -164,4 +164,40 @@ class SwpmMiscUtils {
164
  return $log_reset;
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
143
  public static function reset_swmp_log_files() {
144
  $log_reset = true;
145
  $logfile_list = array(
146
+ SIMPLE_WP_MEMBERSHIP_PATH . '/log.txt',
147
  );
148
 
149
  foreach ($logfile_list as $logfile) {
164
  return $log_reset;
165
  }
166
 
167
+ public static function redirect_to_url($url) {
168
+ if (empty($url)) {
169
+ return;
170
+ }
171
+ $url = apply_filters('swpm_redirect_to_url', $url);
172
+
173
+ if (!preg_match("/http/", $url)) {//URL value is incorrect
174
+ echo '<p>Error! The URL value you entered in the plugin configuration is incorrect.</p>';
175
+ echo '<p>A URL must always have the "http" keyword in it.</p>';
176
+ echo '<p style="font-weight: bold;">The URL value you currently configured is: <br />' . $url . '</p>';
177
+ echo '<p>Here are some examples of correctly formatted URL values for your reference: <br />http://www.example.com<br/>http://example.com<br />https://www.example.com</p>';
178
+ echo '<p>Find the field where you entered this incorrect URL value and correct the mistake then try again.</p>';
179
+ exit;
180
+ }
181
+ if (!headers_sent()) {
182
+ header('Location: ' . $url);
183
+ } else {
184
+ echo '<meta http-equiv="refresh" content="0;url=' . $url . '" />';
185
+ }
186
+ exit;
187
+ }
188
+
189
+ public static function get_current_page_url() {
190
+ $pageURL = 'http';
191
+ if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
192
+ $pageURL .= "s";
193
+ }
194
+ $pageURL .= "://";
195
+ if ($_SERVER["SERVER_PORT"] != "80") {
196
+ $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
197
+ } else {
198
+ $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
199
+ }
200
+ return $pageURL;
201
+ }
202
+
203
  }
classes/class.swpm-registration.php CHANGED
@@ -6,12 +6,16 @@
6
  * @author nur
7
  */
8
  abstract class SwpmRegistration {
 
9
  protected $member_info = array();
10
  protected static $_intance = null;
 
11
  //public abstract static function get_instance();
12
- protected function send_reg_email(){
13
  global $wpdb;
14
- if (empty($this->member_info)) {return false;}
 
 
15
  $member_info = $this->member_info;
16
  $settings = SwpmSettings::get_instance();
17
  $subject = $settings->get_value('reg-complete-mail-subject');
@@ -26,17 +30,26 @@ abstract class SwpmRegistration {
26
  $keys = array_map('swpm_enclose_var', array_keys($member_info));
27
  $body = str_replace($keys, $values, $body);
28
  $email = sanitize_email(filter_input(INPUT_POST, 'email', FILTER_UNSAFE_RAW));
 
29
  wp_mail(trim($email), $subject, $body, $headers);
 
 
30
  if ($settings->get_value('enable-admin-notification-after-reg')) {
 
 
31
  $subject = "Notification of New Member Registration";
32
  $body = "A new member has registered. The following email was sent to the member." .
33
  "\n\n-------Member Email----------\n" . $body .
34
  "\n\n------End------\n";
35
- wp_mail($from_address, $subject, $body, $headers);
 
 
36
  }
37
  return true;
38
  }
 
39
  }
40
- function swpm_enclose_var($n){
41
- return '{'.$n .'}';
 
42
  }
6
  * @author nur
7
  */
8
  abstract class SwpmRegistration {
9
+
10
  protected $member_info = array();
11
  protected static $_intance = null;
12
+
13
  //public abstract static function get_instance();
14
+ protected function send_reg_email() {
15
  global $wpdb;
16
+ if (empty($this->member_info)) {
17
+ return false;
18
+ }
19
  $member_info = $this->member_info;
20
  $settings = SwpmSettings::get_instance();
21
  $subject = $settings->get_value('reg-complete-mail-subject');
30
  $keys = array_map('swpm_enclose_var', array_keys($member_info));
31
  $body = str_replace($keys, $values, $body);
32
  $email = sanitize_email(filter_input(INPUT_POST, 'email', FILTER_UNSAFE_RAW));
33
+
34
  wp_mail(trim($email), $subject, $body, $headers);
35
+ SwpmLog::log_simple_debug('Member notification email sent to: '.$email, true);
36
+
37
  if ($settings->get_value('enable-admin-notification-after-reg')) {
38
+ $to_email_address = $settings->get_value('admin-notification-email');
39
+ $headers = 'From: ' . $from_address . "\r\n";
40
  $subject = "Notification of New Member Registration";
41
  $body = "A new member has registered. The following email was sent to the member." .
42
  "\n\n-------Member Email----------\n" . $body .
43
  "\n\n------End------\n";
44
+ $admin_notification = empty($to_email_address) ? $from_address : $to_email_address;
45
+ wp_mail(trim($admin_notification), $subject, $body, $headers);
46
+ SwpmLog::log_simple_debug('Admin notification email sent to: '.$admin_notification, true);
47
  }
48
  return true;
49
  }
50
+
51
  }
52
+
53
+ function swpm_enclose_var($n) {
54
+ return '{' . $n . '}';
55
  }
classes/class.swpm-settings.php CHANGED
@@ -6,316 +6,283 @@ class SwpmSettings {
6
  private $settings;
7
  public $current_tab;
8
  private $tabs;
 
9
  private function __construct() {
10
  $this->settings = (array) get_option('swpm-settings');
11
  }
12
- public function init_config_hooks(){
 
13
  $page = filter_input(INPUT_GET, 'page');
14
  // if($page == 'simple_wp_membership_settings'){
15
- if(is_admin()){ // for frontend just load settings but dont try to render settings page.
16
  $tab = filter_input(INPUT_GET, 'tab');
17
- $tab = empty($tab)?filter_input(INPUT_POST, 'tab'):$tab;
18
  $this->current_tab = empty($tab) ? 1 : $tab;
19
- $this->tabs = array(1=> 'General Settings', 2=> 'Payment Settings',
20
- 3=> 'Email Settings', 4=> 'Tools', 5=>'Advanced Settings', 6=> 'Addons Settings');
21
  add_action('swpm-draw-tab', array(&$this, 'draw_tabs'));
22
  $method = 'tab_' . $this->current_tab;
23
- if (method_exists($this, $method)){
24
  $this->$method();
25
  }
26
  }
27
  }
 
28
  private function tab_1() {
29
-
30
  register_setting('swpm-settings-tab-1', 'swpm-settings', array(&$this, 'sanitize_tab_1'));
31
-
32
  //This settings section has no heading
33
- add_settings_section('swpm-general-post-submission-check', '',
34
- array(&$this, 'swpm_general_post_submit_check_callback'), 'simple_wp_membership_settings');
35
-
36
- add_settings_section('swpm-documentation', SwpmUtils::_('Plugin Documentation'),
37
- array(&$this, 'swpm_documentation_callback'), 'simple_wp_membership_settings');
38
- add_settings_section('general-settings', SwpmUtils::_('General Settings'),
39
- array(&$this, 'general_settings_callback'), 'simple_wp_membership_settings');
40
- add_settings_field('enable-free-membership', SwpmUtils::_('Enable Free Membership'),
41
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings',
42
- array('item' => 'enable-free-membership',
43
- 'message'=> SwpmUtils::_('Enable/disable registration for free membership level. When you enable this option, make sure to specify a free membership level ID in the field below.')));
44
- add_settings_field('free-membership-id', SwpmUtils::_('Free Membership Level ID'),
45
- array(&$this, 'textfield_small_callback'), 'simple_wp_membership_settings', 'general-settings',
46
- array('item' => 'free-membership-id',
47
- 'message'=> SwpmUtils::_('Assign free membership level ID')));
48
- add_settings_field('enable-moretag', SwpmUtils::_('Enable More Tag Protection'),
49
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings',
50
- array('item' => 'enable-moretag',
51
- 'message'=> SwpmUtils::_('Enables or disables "more" tag protection in the posts and pages. Anything after the More tag is protected. Anything before the more tag is teaser content.')));
52
- add_settings_field('hide-adminbar', SwpmUtils::_('Hide Adminbar'),
53
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings',
54
- array('item' => 'hide-adminbar',
55
- 'message'=>SwpmUtils::_('WordPress shows an admin toolbar to the logged in users of the site. Check this box if you want to hide that admin toolbar in the fronend of your site.')));
56
-
57
- add_settings_field('default-account-status', SwpmUtils::_('Default Account Status'),
58
- array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'general-settings',
59
- array('item' => 'default-account-status',
60
- 'options'=> SwpmUtils::get_account_state_options(),
61
- 'default'=>'active',
62
- 'message'=>SwpmUtils::_('Select the default account status for newly registered users. If you want to manually approve the members then you can set the status to "Pending".')));
63
- add_settings_field('allow-account-deletion', SwpmUtils::_('Allow Account Deletion'),
64
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings',
65
- array('item' => 'allow-account-deletion',
66
- 'options'=> SwpmUtils::get_account_state_options(),
67
- 'message'=>SwpmUtils::_('Allow users to delete their accounts.')));
68
- add_settings_field('delete-pending-account', SwpmUtils::_('Auto Delete Pending Account'),
69
- array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'general-settings',
70
- array('item' => 'delete-pending-account',
71
- 'options'=> array(0 => 'Do not delete', 1=>'Older than 1 month', 2=> 'Older than 2 months'),
72
- 'default'=>'0',
73
- 'message'=>SwpmUtils::_('Select how long you want to keep "pending" account.')));
74
- /*add_settings_field('protect-everything', BUtils::_('Protect Everything'),
75
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings',
76
- array('item' => 'protect-everything',
77
- 'message'=>BUtils::_('Check this box if you want to protect all posts/pages by default.')));*/
78
-
79
- add_settings_section('pages-settings', SwpmUtils::_('Pages Settings'),
80
- array(&$this, 'pages_settings_callback'), 'simple_wp_membership_settings');
81
- add_settings_field('login-page-url', SwpmUtils::_('Login Page URL'),
82
- array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings',
83
- array('item' => 'login-page-url',
84
- 'message'=>''));
85
- add_settings_field('registration-page-url', SwpmUtils::_('Registration Page URL'),
86
- array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings',
87
- array('item' => 'registration-page-url',
88
- 'message'=>''));
89
- add_settings_field('join-us-page-url', SwpmUtils::_('Join Us Page URL'),
90
- array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings',
91
- array('item' => 'join-us-page-url',
92
- 'message'=>''));
93
- add_settings_field('profile-page-url', SwpmUtils::_('Edit Profile Page URL'),
94
- array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings',
95
- array('item' => 'profile-page-url',
96
- 'message'=>''));
97
- add_settings_field('reset-page-url', SwpmUtils::_('Password Reset Page URL'),
98
- array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings',
99
- array('item' => 'reset-page-url',
100
- 'message'=>''));
101
-
102
- add_settings_section('debug-settings', SwpmUtils::_('Test & Debug Settings'),
103
- array(&$this, 'testndebug_settings_callback'), 'simple_wp_membership_settings');
104
-
105
  $debug_field_help_text = SwpmUtils::_('Check this option to enable debug logging.');
106
- $debug_field_help_text .= '<br />- View debug log file by clicking <a href="'.SIMPLE_WP_MEMBERSHIP_URL.'/log.txt" target="_blank">here</a>.';
107
  $debug_field_help_text .= '<br />- Reset debug log file by clicking <a href="admin.php?page=simple_wp_membership_settings&swmp_reset_log=1" target="_blank">here</a>.';
108
- add_settings_field('enable-debug', 'Enable Debug',
109
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'debug-settings',
110
- array('item' => 'enable-debug',
111
- 'message'=> $debug_field_help_text));
112
- add_settings_field('enable-sandbox-testing', SwpmUtils::_('Enable Sandbox Testing'),
113
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'debug-settings',
114
- array('item' => 'enable-sandbox-testing',
115
- 'message'=>SwpmUtils::_('Enable this option if you want to do sandbox payment testing.')));
116
-
117
  }
118
 
119
  private function tab_2() {
 
120
  }
121
 
122
  private function tab_3() {
123
  register_setting('swpm-settings-tab-3', 'swpm-settings', array(&$this, 'sanitize_tab_3'));
124
 
125
- add_settings_section('email-misc-settings', SwpmUtils::_('Email Misc. Settings'),
126
- array(&$this, 'email_misc_settings_callback'), 'simple_wp_membership_settings');
127
- add_settings_field('email-misc-from', SwpmUtils::_('From Email Address'),
128
- array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'email-misc-settings',
129
- array('item' => 'email-from',
130
- 'message'=>''));
131
-
132
- add_settings_section('reg-prompt-email-settings', SwpmUtils::_('Email Settings (Prompt to Complete Registration )'),
133
- array(&$this, 'reg_prompt_email_settings_callback'), 'simple_wp_membership_settings');
134
- add_settings_field('reg-prompt-complete-mail-subject', SwpmUtils::_('Email Subject'),
135
- array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'reg-prompt-email-settings',
136
- array('item' => 'reg-prompt-complete-mail-subject',
137
- 'message'=>''));
138
- add_settings_field('reg-prompt-complete-mail-body', SwpmUtils::_('Email Body'),
139
- array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'reg-prompt-email-settings',
140
- array('item' => 'reg-prompt-complete-mail-body',
141
- 'message'=>''));
142
-
143
- add_settings_section('reg-email-settings', SwpmUtils::_('Email Settings (Registration Complete)'),
144
- array(&$this, 'reg_email_settings_callback'), 'simple_wp_membership_settings');
145
- add_settings_field('reg-complete-mail-subject', SwpmUtils::_('Email Subject'),
146
- array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'reg-email-settings',
147
- array('item' => 'reg-complete-mail-subject',
148
- 'message'=>''));
149
- add_settings_field('reg-complete-mail-body', SwpmUtils::_('Email Body'),
150
- array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'reg-email-settings',
151
- array('item' => 'reg-complete-mail-body',
152
- 'message'=>''));
153
- add_settings_field('enable-admin-notification-after-reg', SwpmUtils::_('Send Notification To Admin'),
154
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'reg-email-settings',
155
- array('item' => 'enable-admin-notification-after-reg',
156
- 'message'=>''));
157
- add_settings_field('enable-notification-after-manual-user-add', SwpmUtils::_('Send Email to Member When Added via Admin Dashboard'),
158
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'reg-email-settings',
159
- array('item' => 'enable-notification-after-manual-user-add',
160
- 'message'=>''));
161
-
162
- add_settings_section('upgrade-email-settings', SwpmUtils::_(' Email Settings (Account Upgrade Notification)'),
163
- array(&$this, 'upgrade_email_settings_callback'), 'simple_wp_membership_settings');
164
- add_settings_field('upgrade-complete-mail-subject', SwpmUtils::_('Email Subject'),
165
- array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'upgrade-email-settings',
166
- array('item' => 'upgrade-complete-mail-subject',
167
- 'message'=>''));
168
- add_settings_field('upgrade-complete-mail-body', SwpmUtils::_('Email Body'),
169
- array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'upgrade-email-settings',
170
- array('item' => 'upgrade-complete-mail-body',
171
- 'message'=>''));
172
- }
173
-
174
- private function tab_4(){
175
- }
176
-
177
- private function tab_5(){
178
  register_setting('swpm-settings-tab-5', 'swpm-settings', array(&$this, 'sanitize_tab_5'));
179
 
180
- add_settings_section('advanced-settings', SwpmUtils::_('Advanced Settings'),
181
- array(&$this, 'advanced_settings_callback'), 'simple_wp_membership_settings');
182
-
183
- add_settings_field('enable-expired-account-login', SwpmUtils::_('Enable Expired Account Login'),
184
- array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'advanced-settings',
185
- array('item' => 'enable-expired-account-login',
186
- 'message'=>SwpmUtils::_("When enabled, expired members will be able to log into the system but won't be able to view any protected content. This allows them to easily renew their account by making another payment.")));
187
  }
188
-
189
- private function tab_6(){
 
190
  }
191
-
192
  public static function get_instance() {
193
  self::$_this = empty(self::$_this) ? new SwpmSettings() : self::$_this;
194
  return self::$_this;
195
  }
196
- public function selectbox_callback($args){
 
197
  $item = $args['item'];
198
  $options = $args['options'];
199
  $default = $args['default'];
200
- $msg = isset($args['message'])?$args['message']: '';
201
  $selected = esc_attr($this->get_value($item), $default);
202
  echo "<select name='swpm-settings[" . $item . "]' >";
203
- foreach($options as $key => $value){
204
- $is_selected = ($key == $selected)? 'selected="selected"': '';
205
- echo '<option ' . $is_selected . ' value="'. esc_attr($key) . '">' . esc_attr($value) . '</option>';
206
  }
207
  echo '</select>';
208
- echo '<br/><i>'.$msg.'</i>';
209
  }
 
210
  public function checkbox_callback($args) {
211
  $item = $args['item'];
212
- $msg = isset($args['message'])?$args['message']: '';
213
  $is = esc_attr($this->get_value($item));
214
  echo "<input type='checkbox' $is name='swpm-settings[" . $item . "]' value=\"checked='checked'\" />";
215
- echo '<br/><i>'.$msg.'</i>';
216
  }
217
 
218
  public function textarea_callback($args) {
219
  $item = $args['item'];
220
- $msg = isset($args['message'])?$args['message']: '';
221
  $text = esc_attr($this->get_value($item));
222
  echo "<textarea name='swpm-settings[" . $item . "]' rows='6' cols='60' >" . $text . "</textarea>";
223
- echo '<br/><i>'.$msg.'</i>';
224
  }
225
 
226
  public function textfield_small_callback($args) {
227
  $item = $args['item'];
228
- $msg = isset($args['message'])?$args['message']: '';
229
  $text = esc_attr($this->get_value($item));
230
  echo "<input type='text' name='swpm-settings[" . $item . "]' size='5' value='" . $text . "' />";
231
- echo '<br/><i>'.$msg.'</i>';
232
  }
233
 
234
  public function textfield_callback($args) {
235
  $item = $args['item'];
236
- $msg = isset($args['message'])?$args['message']: '';
237
  $text = esc_attr($this->get_value($item));
238
  echo "<input type='text' name='swpm-settings[" . $item . "]' size='50' value='" . $text . "' />";
239
- echo '<br/><i>'.$msg.'</i>';
240
  }
241
 
242
  public function textfield_long_callback($args) {
243
  $item = $args['item'];
244
- $msg = isset($args['message'])?$args['message']: '';
245
  $text = esc_attr($this->get_value($item));
246
  echo "<input type='text' name='swpm-settings[" . $item . "]' size='100' value='" . $text . "' />";
247
- echo '<br/><i>'.$msg.'</i>';
248
  }
249
 
250
  public function swpm_documentation_callback() {
251
  ?>
252
  <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
253
- <p>Visit the
254
- <a target="_blank" href="https://simple-membership-plugin.com/">Simple Membership Plugin Site</a>
255
- to read setup and configuration documentation. Please <a href="https://wordpress.org/support/view/plugin-reviews/simple-membership?filter=5" target="_blank">give us a rating</a> if you like the plugin.
256
- </p>
257
  </div>
258
  <?php
259
  }
260
-
261
- public function swpm_general_post_submit_check_callback(){
262
  //Log file reset handler
263
- if(isset($_REQUEST['swmp_reset_log'])){
264
- if(SwpmMiscUtils::reset_swmp_log_files()){
265
  echo '<div id="message" class="updated fade"><p>Debug log files have been reset!</p></div>';
266
- }
267
- else{
268
  echo '<div id="message" class="updated fade"><p>Debug log files could not be reset!</p></div>';
269
  }
270
  }
271
-
272
  //Show settings updated message
273
- if(isset($_REQUEST['settings-updated'])){
274
  echo '<div id="message" class="updated fade"><p>' . SwpmUtils::_('Settings updated!') . '</p></div>';
275
  }
276
  }
277
 
278
- public function general_settings_callback() {
279
  SwpmUtils::e('General Plugin Settings.');
280
  }
281
 
282
  public function pages_settings_callback() {
283
  SwpmUtils::e('Page Setup and URL Related settings.');
284
  }
285
- public function testndebug_settings_callback(){
 
286
  SwpmUtils::e('Testing and Debug Related Settings.');
287
  }
 
288
  public function reg_email_settings_callback() {
289
  SwpmUtils::e('This email will be sent to your users when they complete the registration and become a member.');
290
  }
291
- public function email_misc_settings_callback(){
 
 
 
 
 
292
  SwpmUtils::e('Settings in this section apply to all emails.');
293
  }
 
294
  public function upgrade_email_settings_callback() {
295
- SwpmUtils::e('This email will be sent to your users after account upgrade.');
296
  }
 
297
  public function reg_prompt_email_settings_callback() {
298
- SwpmUtils::e('This email will be sent to prompt user to complete registration.');
299
  }
300
- public function advanced_settings_callback(){
 
301
  SwpmUtils::e('This page allows you to configure some advanced features of the plugin.');
302
  }
303
-
304
  public function sanitize_tab_1($input) {
305
- if (empty($this->settings)){
306
  $this->settings = (array) get_option('swpm-settings');
307
  }
308
  $output = $this->settings;
309
  //general settings block
310
-
311
- $output['hide-adminbar'] = isset($input['hide-adminbar'])? esc_attr($input['hide-adminbar']) : "";
312
- $output['protect-everything'] = isset($input['protect-everything'])? esc_attr($input['protect-everything']) : "";
313
- $output['enable-free-membership'] = isset($input['enable-free-membership'])? esc_attr($input['enable-free-membership']) : "";
314
- $output['enable-moretag'] = isset($input['enable-moretag'])? esc_attr($input['enable-moretag']) : "";
315
- $output['enable-debug'] = isset($input['enable-debug'])? esc_attr($input['enable-debug']) : "";
316
- $output['enable-sandbox-testing'] = isset($input['enable-sandbox-testing'])? esc_attr($input['enable-sandbox-testing']) : "";
317
- $output['allow-account-deletion'] = isset($input['allow-account-deletion'])? esc_attr($input['allow-account-deletion']) : "";
318
-
319
  $output['free-membership-id'] = ($input['free-membership-id'] != 1) ? absint($input['free-membership-id']) : '';
320
  $output['login-page-url'] = esc_url($input['login-page-url']);
321
  $output['registration-page-url'] = esc_url($input['registration-page-url']);
@@ -327,36 +294,42 @@ class SwpmSettings {
327
  }
328
 
329
  public function sanitize_tab_3($input) {
330
- if (empty($this->settings)){
331
  $this->settings = (array) get_option('swpm-settings');
332
  }
333
  $output = $this->settings;
334
  $output['reg-complete-mail-subject'] = sanitize_text_field($input['reg-complete-mail-subject']);
335
  $output['reg-complete-mail-body'] = wp_kses_data(force_balance_tags($input['reg-complete-mail-body']));
336
 
 
 
 
 
337
  $output['upgrade-complete-mail-subject'] = sanitize_text_field($input['upgrade-complete-mail-subject']);
338
  $output['upgrade-complete-mail-body'] = wp_kses_data(force_balance_tags($input['upgrade-complete-mail-body']));
339
 
340
  $output['reg-prompt-complete-mail-subject'] = sanitize_text_field($input['reg-prompt-complete-mail-subject']);
341
  $output['reg-prompt-complete-mail-body'] = wp_kses_data(force_balance_tags($input['reg-prompt-complete-mail-body']));
342
  $output['email-from'] = trim($input['email-from']);
343
- $output['enable-admin-notification-after-reg'] = isset($input['enable-admin-notification-after-reg'])? esc_attr($input['enable-admin-notification-after-reg']) : "";
344
- $output['enable-notification-after-manual-user-add'] = isset($input['enable-notification-after-manual-user-add'])? esc_attr($input['enable-notification-after-manual-user-add']) : "";
345
-
 
346
  return $output;
347
  }
348
-
349
- public function sanitize_tab_5($input){
350
- if (empty($this->settings)){
351
  $this->settings = (array) get_option('swpm-settings');
352
  }
353
  $output = $this->settings;
354
- $output['enable-expired-account-login'] = isset($input['enable-expired-account-login'])? esc_attr($input['enable-expired-account-login']) : "";
355
-
356
  return $output;
357
  }
 
358
  public function get_value($key, $default = "") {
359
- if (isset($this->settings[$key])){
360
  return $this->settings[$key];
361
  }
362
  return $default;
@@ -374,22 +347,22 @@ class SwpmSettings {
374
  public function draw_tabs() {
375
  $current = $this->current_tab;
376
  ?>
377
- <h3 class="nav-tab-wrapper">
378
- <?php foreach ($this->tabs as $id=>$label):?>
379
- <a class="nav-tab <?php echo ($current == $id) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_settings&tab=<?php echo $id?>"><?php echo $label?></a>
380
- <?php endforeach;?>
381
- </h3>
382
  <?php
383
  }
384
 
385
  public function get_login_link() {
386
- $login = $this->get_value('login-page-url');
387
  $joinus = $this->get_value('join-us-page-url');
388
- if (empty ($login) || empty($joinus)){
389
  return '<span style="color:red;">Simple Membership is not configured correctly.'
390
- . 'Please contact <a href="mailto:' . get_option('admin_email'). '">Admin</a>';
391
  }
392
- return SwpmUtils::_('Please'). ' <a class="swpm-login-link" href="' . $login . '">' . SwpmUtils::_('Login') . '</a>. '. SwpmUtils::_('Not a Member?').' <a href="' . $joinus . '">'.SwpmUtils::_('Join Us').'</a>';
393
  }
394
 
395
  }
6
  private $settings;
7
  public $current_tab;
8
  private $tabs;
9
+
10
  private function __construct() {
11
  $this->settings = (array) get_option('swpm-settings');
12
  }
13
+
14
+ public function init_config_hooks() {
15
  $page = filter_input(INPUT_GET, 'page');
16
  // if($page == 'simple_wp_membership_settings'){
17
+ if (is_admin()) { // for frontend just load settings but dont try to render settings page.
18
  $tab = filter_input(INPUT_GET, 'tab');
19
+ $tab = empty($tab) ? filter_input(INPUT_POST, 'tab') : $tab;
20
  $this->current_tab = empty($tab) ? 1 : $tab;
21
+ $this->tabs = array(1 => 'General Settings', 2 => 'Payment Settings',
22
+ 3 => 'Email Settings', 4 => 'Tools', 5 => 'Advanced Settings', 6 => 'Addons Settings');
23
  add_action('swpm-draw-tab', array(&$this, 'draw_tabs'));
24
  $method = 'tab_' . $this->current_tab;
25
+ if (method_exists($this, $method)) {
26
  $this->$method();
27
  }
28
  }
29
  }
30
+
31
  private function tab_1() {
32
+
33
  register_setting('swpm-settings-tab-1', 'swpm-settings', array(&$this, 'sanitize_tab_1'));
34
+
35
  //This settings section has no heading
36
+ add_settings_section('swpm-general-post-submission-check', '', array(&$this, 'swpm_general_post_submit_check_callback'), 'simple_wp_membership_settings');
37
+
38
+ add_settings_section('swpm-documentation', SwpmUtils::_('Plugin Documentation'), array(&$this, 'swpm_documentation_callback'), 'simple_wp_membership_settings');
39
+ add_settings_section('general-settings', SwpmUtils::_('General Settings'), array(&$this, 'general_settings_callback'), 'simple_wp_membership_settings');
40
+ add_settings_field('enable-free-membership', SwpmUtils::_('Enable Free Membership'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'enable-free-membership',
41
+ 'message' => SwpmUtils::_('Enable/disable registration for free membership level. When you enable this option, make sure to specify a free membership level ID in the field below.')));
42
+ add_settings_field('free-membership-id', SwpmUtils::_('Free Membership Level ID'), array(&$this, 'textfield_small_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'free-membership-id',
43
+ 'message' => SwpmUtils::_('Assign free membership level ID')));
44
+ add_settings_field('enable-moretag', SwpmUtils::_('Enable More Tag Protection'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'enable-moretag',
45
+ 'message' => SwpmUtils::_('Enables or disables "more" tag protection in the posts and pages. Anything after the More tag is protected. Anything before the more tag is teaser content.')));
46
+ add_settings_field('hide-adminbar', SwpmUtils::_('Hide Adminbar'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'hide-adminbar',
47
+ 'message' => SwpmUtils::_('WordPress shows an admin toolbar to the logged in users of the site. Check this box if you want to hide that admin toolbar in the fronend of your site.')));
48
+
49
+ add_settings_field('default-account-status', SwpmUtils::_('Default Account Status'), array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'default-account-status',
50
+ 'options' => SwpmUtils::get_account_state_options(),
51
+ 'default' => 'active',
52
+ 'message' => SwpmUtils::_('Select the default account status for newly registered users. If you want to manually approve the members then you can set the status to "Pending".')));
53
+ add_settings_field('allow-account-deletion', SwpmUtils::_('Allow Account Deletion'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'allow-account-deletion',
54
+ 'options' => SwpmUtils::get_account_state_options(),
55
+ 'message' => SwpmUtils::_('Allow users to delete their accounts.')));
56
+ add_settings_field('delete-pending-account', SwpmUtils::_('Auto Delete Pending Account'), array(&$this, 'selectbox_callback'), 'simple_wp_membership_settings', 'general-settings', array('item' => 'delete-pending-account',
57
+ 'options' => array(0 => 'Do not delete', 1 => 'Older than 1 month', 2 => 'Older than 2 months'),
58
+ 'default' => '0',
59
+ 'message' => SwpmUtils::_('Select how long you want to keep "pending" account.')));
60
+ /* add_settings_field('protect-everything', BUtils::_('Protect Everything'),
61
+ array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'general-settings',
62
+ array('item' => 'protect-everything',
63
+ 'message'=>BUtils::_('Check this box if you want to protect all posts/pages by default.'))); */
64
+
65
+ add_settings_section('pages-settings', SwpmUtils::_('Pages Settings'), array(&$this, 'pages_settings_callback'), 'simple_wp_membership_settings');
66
+ add_settings_field('login-page-url', SwpmUtils::_('Login Page URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings', array('item' => 'login-page-url',
67
+ 'message' => ''));
68
+ add_settings_field('registration-page-url', SwpmUtils::_('Registration Page URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings', array('item' => 'registration-page-url',
69
+ 'message' => ''));
70
+ add_settings_field('join-us-page-url', SwpmUtils::_('Join Us Page URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings', array('item' => 'join-us-page-url',
71
+ 'message' => ''));
72
+ add_settings_field('profile-page-url', SwpmUtils::_('Edit Profile Page URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings', array('item' => 'profile-page-url',
73
+ 'message' => ''));
74
+ add_settings_field('reset-page-url', SwpmUtils::_('Password Reset Page URL'), array(&$this, 'textfield_long_callback'), 'simple_wp_membership_settings', 'pages-settings', array('item' => 'reset-page-url',
75
+ 'message' => ''));
76
+
77
+ add_settings_section('debug-settings', SwpmUtils::_('Test & Debug Settings'), array(&$this, 'testndebug_settings_callback'), 'simple_wp_membership_settings');
78
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  $debug_field_help_text = SwpmUtils::_('Check this option to enable debug logging.');
80
+ $debug_field_help_text .= '<br />- View debug log file by clicking <a href="' . SIMPLE_WP_MEMBERSHIP_URL . '/log.txt" target="_blank">here</a>.';
81
  $debug_field_help_text .= '<br />- Reset debug log file by clicking <a href="admin.php?page=simple_wp_membership_settings&swmp_reset_log=1" target="_blank">here</a>.';
82
+ add_settings_field('enable-debug', 'Enable Debug', array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'debug-settings', array('item' => 'enable-debug',
83
+ 'message' => $debug_field_help_text));
84
+ add_settings_field('enable-sandbox-testing', SwpmUtils::_('Enable Sandbox Testing'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'debug-settings', array('item' => 'enable-sandbox-testing',
85
+ 'message' => SwpmUtils::_('Enable this option if you want to do sandbox payment testing.')));
 
 
 
 
 
86
  }
87
 
88
  private function tab_2() {
89
+
90
  }
91
 
92
  private function tab_3() {
93
  register_setting('swpm-settings-tab-3', 'swpm-settings', array(&$this, 'sanitize_tab_3'));
94
 
95
+ add_settings_section('email-misc-settings', SwpmUtils::_('Email Misc. Settings'), array(&$this, 'email_misc_settings_callback'), 'simple_wp_membership_settings');
96
+ add_settings_field('email-misc-from', SwpmUtils::_('From Email Address'), array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'email-misc-settings', array('item' => 'email-from',
97
+ 'message' => 'This value will be used as the sender\'s address for the emails. Example value: Your Name &lt;sales@your-domain.com&gt;'));
98
+
99
+ add_settings_section('reg-prompt-email-settings', SwpmUtils::_('Email Settings (Prompt to Complete Registration )'), array(&$this, 'reg_prompt_email_settings_callback'), 'simple_wp_membership_settings');
100
+ add_settings_field('reg-prompt-complete-mail-subject', SwpmUtils::_('Email Subject'), array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'reg-prompt-email-settings', array('item' => 'reg-prompt-complete-mail-subject',
101
+ 'message' => ''));
102
+ add_settings_field('reg-prompt-complete-mail-body', SwpmUtils::_('Email Body'), array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'reg-prompt-email-settings', array('item' => 'reg-prompt-complete-mail-body',
103
+ 'message' => ''));
104
+
105
+ add_settings_section('reg-email-settings', SwpmUtils::_('Email Settings (Registration Complete)'), array(&$this, 'reg_email_settings_callback'), 'simple_wp_membership_settings');
106
+ add_settings_field('reg-complete-mail-subject', SwpmUtils::_('Email Subject'), array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'reg-email-settings', array('item' => 'reg-complete-mail-subject',
107
+ 'message' => ''));
108
+ add_settings_field('reg-complete-mail-body', SwpmUtils::_('Email Body'), array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'reg-email-settings', array('item' => 'reg-complete-mail-body',
109
+ 'message' => ''));
110
+ add_settings_field('enable-admin-notification-after-reg', SwpmUtils::_('Send Notification to Admin'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'reg-email-settings', array('item' => 'enable-admin-notification-after-reg',
111
+ 'message' => 'Enable this option if you want the admin to receive a notification when a member registers.'));
112
+ add_settings_field('admin-notification-email', SwpmUtils::_('Admin Email Address'), array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'reg-email-settings', array('item' => 'admin-notification-email',
113
+ 'message' => 'Enter the email address where you want the admin notification email to be sent to.'));
114
+ add_settings_field('enable-notification-after-manual-user-add', SwpmUtils::_('Send Email to Member When Added via Admin Dashboard'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'reg-email-settings', array('item' => 'enable-notification-after-manual-user-add',
115
+ 'message' => ''));
116
+
117
+ add_settings_section('reset-password-settings', SwpmUtils::_('Email Settings (Password Reset)'), array(&$this, 'reset_password_settings_callback'), 'simple_wp_membership_settings');
118
+ add_settings_field('reset-mail-subject', SwpmUtils::_('Email Subject'), array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'reset-password-settings', array('item' => 'reset-mail-subject',
119
+ 'message' => ''));
120
+ add_settings_field('reset-mail-body', SwpmUtils::_('Email Body'), array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'reset-password-settings', array('item' => 'reset-mail-body',
121
+ 'message' => ''));
122
+
123
+
124
+ add_settings_section('upgrade-email-settings', SwpmUtils::_(' Email Settings (Account Upgrade Notification)'), array(&$this, 'upgrade_email_settings_callback'), 'simple_wp_membership_settings');
125
+ add_settings_field('upgrade-complete-mail-subject', SwpmUtils::_('Email Subject'), array(&$this, 'textfield_callback'), 'simple_wp_membership_settings', 'upgrade-email-settings', array('item' => 'upgrade-complete-mail-subject',
126
+ 'message' => ''));
127
+ add_settings_field('upgrade-complete-mail-body', SwpmUtils::_('Email Body'), array(&$this, 'textarea_callback'), 'simple_wp_membership_settings', 'upgrade-email-settings', array('item' => 'upgrade-complete-mail-body',
128
+ 'message' => ''));
129
+ }
130
+
131
+ private function tab_4() {
132
+
133
+ }
134
+
135
+ private function tab_5() {
 
 
 
 
 
 
 
 
 
 
 
 
136
  register_setting('swpm-settings-tab-5', 'swpm-settings', array(&$this, 'sanitize_tab_5'));
137
 
138
+ add_settings_section('advanced-settings', SwpmUtils::_('Advanced Settings'), array(&$this, 'advanced_settings_callback'), 'simple_wp_membership_settings');
139
+
140
+ add_settings_field('enable-expired-account-login', SwpmUtils::_('Enable Expired Account Login'), array(&$this, 'checkbox_callback'), 'simple_wp_membership_settings', 'advanced-settings', array('item' => 'enable-expired-account-login',
141
+ 'message' => SwpmUtils::_("When enabled, expired members will be able to log into the system but won't be able to view any protected content. This allows them to easily renew their account by making another payment.")));
 
 
 
142
  }
143
+
144
+ private function tab_6() {
145
+
146
  }
147
+
148
  public static function get_instance() {
149
  self::$_this = empty(self::$_this) ? new SwpmSettings() : self::$_this;
150
  return self::$_this;
151
  }
152
+
153
+ public function selectbox_callback($args) {
154
  $item = $args['item'];
155
  $options = $args['options'];
156
  $default = $args['default'];
157
+ $msg = isset($args['message']) ? $args['message'] : '';
158
  $selected = esc_attr($this->get_value($item), $default);
159
  echo "<select name='swpm-settings[" . $item . "]' >";
160
+ foreach ($options as $key => $value) {
161
+ $is_selected = ($key == $selected) ? 'selected="selected"' : '';
162
+ echo '<option ' . $is_selected . ' value="' . esc_attr($key) . '">' . esc_attr($value) . '</option>';
163
  }
164
  echo '</select>';
165
+ echo '<br/><i>' . $msg . '</i>';
166
  }
167
+
168
  public function checkbox_callback($args) {
169
  $item = $args['item'];
170
+ $msg = isset($args['message']) ? $args['message'] : '';
171
  $is = esc_attr($this->get_value($item));
172
  echo "<input type='checkbox' $is name='swpm-settings[" . $item . "]' value=\"checked='checked'\" />";
173
+ echo '<br/><i>' . $msg . '</i>';
174
  }
175
 
176
  public function textarea_callback($args) {
177
  $item = $args['item'];
178
+ $msg = isset($args['message']) ? $args['message'] : '';
179
  $text = esc_attr($this->get_value($item));
180
  echo "<textarea name='swpm-settings[" . $item . "]' rows='6' cols='60' >" . $text . "</textarea>";
181
+ echo '<br/><i>' . $msg . '</i>';
182
  }
183
 
184
  public function textfield_small_callback($args) {
185
  $item = $args['item'];
186
+ $msg = isset($args['message']) ? $args['message'] : '';
187
  $text = esc_attr($this->get_value($item));
188
  echo "<input type='text' name='swpm-settings[" . $item . "]' size='5' value='" . $text . "' />";
189
+ echo '<br/><i>' . $msg . '</i>';
190
  }
191
 
192
  public function textfield_callback($args) {
193
  $item = $args['item'];
194
+ $msg = isset($args['message']) ? $args['message'] : '';
195
  $text = esc_attr($this->get_value($item));
196
  echo "<input type='text' name='swpm-settings[" . $item . "]' size='50' value='" . $text . "' />";
197
+ echo '<br/><i>' . $msg . '</i>';
198
  }
199
 
200
  public function textfield_long_callback($args) {
201
  $item = $args['item'];
202
+ $msg = isset($args['message']) ? $args['message'] : '';
203
  $text = esc_attr($this->get_value($item));
204
  echo "<input type='text' name='swpm-settings[" . $item . "]' size='100' value='" . $text . "' />";
205
+ echo '<br/><i>' . $msg . '</i>';
206
  }
207
 
208
  public function swpm_documentation_callback() {
209
  ?>
210
  <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
211
+ <p>Visit the
212
+ <a target="_blank" href="https://simple-membership-plugin.com/">Simple Membership Plugin Site</a>
213
+ to read setup and configuration documentation. Please <a href="https://wordpress.org/support/view/plugin-reviews/simple-membership?filter=5" target="_blank">give us a rating</a> if you like the plugin.
214
+ </p>
215
  </div>
216
  <?php
217
  }
218
+
219
+ public function swpm_general_post_submit_check_callback() {
220
  //Log file reset handler
221
+ if (isset($_REQUEST['swmp_reset_log'])) {
222
+ if (SwpmMiscUtils::reset_swmp_log_files()) {
223
  echo '<div id="message" class="updated fade"><p>Debug log files have been reset!</p></div>';
224
+ } else {
 
225
  echo '<div id="message" class="updated fade"><p>Debug log files could not be reset!</p></div>';
226
  }
227
  }
228
+
229
  //Show settings updated message
230
+ if (isset($_REQUEST['settings-updated'])) {
231
  echo '<div id="message" class="updated fade"><p>' . SwpmUtils::_('Settings updated!') . '</p></div>';
232
  }
233
  }
234
 
235
+ public function general_settings_callback() {
236
  SwpmUtils::e('General Plugin Settings.');
237
  }
238
 
239
  public function pages_settings_callback() {
240
  SwpmUtils::e('Page Setup and URL Related settings.');
241
  }
242
+
243
+ public function testndebug_settings_callback() {
244
  SwpmUtils::e('Testing and Debug Related Settings.');
245
  }
246
+
247
  public function reg_email_settings_callback() {
248
  SwpmUtils::e('This email will be sent to your users when they complete the registration and become a member.');
249
  }
250
+
251
+ public function reset_password_settings_callback() {
252
+ SwpmUtils::e('This email will be sent to your users when they use the password reset functionality.');
253
+ }
254
+
255
+ public function email_misc_settings_callback() {
256
  SwpmUtils::e('Settings in this section apply to all emails.');
257
  }
258
+
259
  public function upgrade_email_settings_callback() {
260
+ SwpmUtils::e('This email will be sent to your users after account upgrade (when an existing member pays for a new membership level).');
261
  }
262
+
263
  public function reg_prompt_email_settings_callback() {
264
+ SwpmUtils::e('This email will be sent to prompt users to complete registration after the payment.');
265
  }
266
+
267
+ public function advanced_settings_callback() {
268
  SwpmUtils::e('This page allows you to configure some advanced features of the plugin.');
269
  }
270
+
271
  public function sanitize_tab_1($input) {
272
+ if (empty($this->settings)) {
273
  $this->settings = (array) get_option('swpm-settings');
274
  }
275
  $output = $this->settings;
276
  //general settings block
277
+
278
+ $output['hide-adminbar'] = isset($input['hide-adminbar']) ? esc_attr($input['hide-adminbar']) : "";
279
+ $output['protect-everything'] = isset($input['protect-everything']) ? esc_attr($input['protect-everything']) : "";
280
+ $output['enable-free-membership'] = isset($input['enable-free-membership']) ? esc_attr($input['enable-free-membership']) : "";
281
+ $output['enable-moretag'] = isset($input['enable-moretag']) ? esc_attr($input['enable-moretag']) : "";
282
+ $output['enable-debug'] = isset($input['enable-debug']) ? esc_attr($input['enable-debug']) : "";
283
+ $output['enable-sandbox-testing'] = isset($input['enable-sandbox-testing']) ? esc_attr($input['enable-sandbox-testing']) : "";
284
+ $output['allow-account-deletion'] = isset($input['allow-account-deletion']) ? esc_attr($input['allow-account-deletion']) : "";
285
+
286
  $output['free-membership-id'] = ($input['free-membership-id'] != 1) ? absint($input['free-membership-id']) : '';
287
  $output['login-page-url'] = esc_url($input['login-page-url']);
288
  $output['registration-page-url'] = esc_url($input['registration-page-url']);
294
  }
295
 
296
  public function sanitize_tab_3($input) {
297
+ if (empty($this->settings)) {
298
  $this->settings = (array) get_option('swpm-settings');
299
  }
300
  $output = $this->settings;
301
  $output['reg-complete-mail-subject'] = sanitize_text_field($input['reg-complete-mail-subject']);
302
  $output['reg-complete-mail-body'] = wp_kses_data(force_balance_tags($input['reg-complete-mail-body']));
303
 
304
+ $output['reset-mail-subject'] = sanitize_text_field($input['reset-mail-subject']);
305
+ $output['reset-mail-body'] = wp_kses_data(force_balance_tags($input['reset-mail-body']));
306
+
307
+
308
  $output['upgrade-complete-mail-subject'] = sanitize_text_field($input['upgrade-complete-mail-subject']);
309
  $output['upgrade-complete-mail-body'] = wp_kses_data(force_balance_tags($input['upgrade-complete-mail-body']));
310
 
311
  $output['reg-prompt-complete-mail-subject'] = sanitize_text_field($input['reg-prompt-complete-mail-subject']);
312
  $output['reg-prompt-complete-mail-body'] = wp_kses_data(force_balance_tags($input['reg-prompt-complete-mail-body']));
313
  $output['email-from'] = trim($input['email-from']);
314
+ $output['enable-admin-notification-after-reg'] = isset($input['enable-admin-notification-after-reg']) ? esc_attr($input['enable-admin-notification-after-reg']) : "";
315
+ $output['admin-notification-email'] = sanitize_email($input['admin-notification-email']);
316
+ $output['enable-notification-after-manual-user-add'] = isset($input['enable-notification-after-manual-user-add']) ? esc_attr($input['enable-notification-after-manual-user-add']) : "";
317
+
318
  return $output;
319
  }
320
+
321
+ public function sanitize_tab_5($input) {
322
+ if (empty($this->settings)) {
323
  $this->settings = (array) get_option('swpm-settings');
324
  }
325
  $output = $this->settings;
326
+ $output['enable-expired-account-login'] = isset($input['enable-expired-account-login']) ? esc_attr($input['enable-expired-account-login']) : "";
327
+
328
  return $output;
329
  }
330
+
331
  public function get_value($key, $default = "") {
332
+ if (isset($this->settings[$key])) {
333
  return $this->settings[$key];
334
  }
335
  return $default;
347
  public function draw_tabs() {
348
  $current = $this->current_tab;
349
  ?>
350
+ <h2 class="nav-tab-wrapper">
351
+ <?php foreach ($this->tabs as $id => $label): ?>
352
+ <a class="nav-tab <?php echo ($current == $id) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_settings&tab=<?php echo $id ?>"><?php echo $label ?></a>
353
+ <?php endforeach; ?>
354
+ </h2>
355
  <?php
356
  }
357
 
358
  public function get_login_link() {
359
+ $login = $this->get_value('login-page-url');
360
  $joinus = $this->get_value('join-us-page-url');
361
+ if (empty($login) || empty($joinus)) {
362
  return '<span style="color:red;">Simple Membership is not configured correctly.'
363
+ . 'Please contact <a href="mailto:' . get_option('admin_email') . '">Admin</a>';
364
  }
365
+ return SwpmUtils::_('Please') . ' <a class="swpm-login-link" href="' . $login . '">' . SwpmUtils::_('Login') . '</a>. ' . SwpmUtils::_('Not a Member?') . ' <a href="' . $joinus . '">' . SwpmUtils::_('Join Us') . '</a>';
366
  }
367
 
368
  }
classes/shortcode-related/class.swpm-shortcodes-handler.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SwpmShortcodesHandler {
4
+
5
+ public function __construct() {
6
+ //Register all the shortcodes here
7
+ add_shortcode('swpm_payment_button', array(&$this, 'swpm_payment_button_sc'));
8
+ }
9
+
10
+ public function swpm_payment_button_sc($args) {
11
+ extract(shortcode_atts(array(
12
+ 'id' => '',
13
+ 'button_text' => '',
14
+ ), $args));
15
+
16
+ if(empty($id)){
17
+ return '<p style="color: red;">Error! You must specify a button ID with this shortcode. Check the usage documentation.</p>';
18
+ }
19
+
20
+ $button_id = $id;
21
+ $button = get_post($button_id); //Retrieve the CPT for this button
22
+ $button_type = get_post_meta($button_id, 'button_type', true);
23
+
24
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/payment-gateway/paypal_button_shortcode_view.php');
25
+
26
+ $button_code = '';
27
+ $button_code = apply_filters('swpm_payment_button_shortcode_for_'.$button_type, $button_code, $args);
28
+
29
+ $output = '';
30
+ $output .= '<div class="swpm-payment-button">'. $button_code .'</div>';
31
+
32
+ return $output;
33
+ }
34
+
35
+ }
css/swpm.common.css CHANGED
@@ -8,6 +8,9 @@
8
  .swpm-margin-bottom-10{
9
  margin-bottom: 10px;
10
  }
 
 
 
11
 
12
  .swpm-yellow-box{
13
  margin: 10px 0 15px;
8
  .swpm-margin-bottom-10{
9
  margin-bottom: 10px;
10
  }
11
+ .swpm-hidden{
12
+ display: none;
13
+ }
14
 
15
  .swpm-yellow-box{
16
  margin: 10px 0 15px;
ipn/swpm_handle_pp_ipn.php CHANGED
@@ -96,7 +96,7 @@ class swpm_paypal_ipn_handler {
96
 
97
  if (!empty($subsc_ref))
98
  {
99
- $this->debug_log('swpm integration is being used... creating member account... see the "subscription_handle_debug.log" file for details',true);
100
  $swpm_id = $customvariables['swpm_id'];
101
  swpm_handle_subsc_signup_stand_alone($this->ipn_data,$subsc_ref,$this->ipn_data['subscr_id'],$swpm_id);
102
  //Handle customized subscription signup
@@ -121,12 +121,12 @@ class swpm_paypal_ipn_handler {
121
  $mc_currency = $this->ipn_data['mc_currency'];
122
 
123
  $current_item = array(
124
- 'item_number' => $item_number,
125
- 'item_name' => $item_name,
126
- 'quantity' => $quantity,
127
- 'mc_gross' => $mc_gross,
128
- 'mc_currency' => $mc_currency,
129
- );
130
 
131
  array_push($cart_items, $current_item);
132
  }
96
 
97
  if (!empty($subsc_ref))
98
  {
99
+ $this->debug_log('swpm integration is being used... creating member account...',true);
100
  $swpm_id = $customvariables['swpm_id'];
101
  swpm_handle_subsc_signup_stand_alone($this->ipn_data,$subsc_ref,$this->ipn_data['subscr_id'],$swpm_id);
102
  //Handle customized subscription signup
121
  $mc_currency = $this->ipn_data['mc_currency'];
122
 
123
  $current_item = array(
124
+ 'item_number' => $item_number,
125
+ 'item_name' => $item_name,
126
+ 'quantity' => $quantity,
127
+ 'mc_gross' => $mc_gross,
128
+ 'mc_currency' => $mc_currency,
129
+ );
130
 
131
  array_push($cart_items, $current_item);
132
  }
ipn/swpm_handle_subsc_ipn.php CHANGED
@@ -47,7 +47,7 @@ function swpm_handle_subsc_signup_stand_alone($ipn_data,$subsc_ref,$unique_ref,$
47
  }
48
  $old_membership_level = $resultset->membership_level;
49
 
50
- swpm_debug_log_subsc("Not using secondary membership level feature... upgrading the current membership level.",true);
51
  $updatedb = $wpdb->prepare("UPDATE $members_table_name SET account_state=%s, membership_level=%d,subscription_starts=%s,subscr_id=%s WHERE member_id=%d", $account_state, $membership_level, $subscription_starts, $subscr_id, $swpm_id);
52
  $results = $wpdb->query($updatedb);
53
  do_action('swpm_membership_changed', array('member_id'=>$swpm_id, 'from_level'=>$old_membership_level, 'to_level'=>$membership_level));
47
  }
48
  $old_membership_level = $resultset->membership_level;
49
 
50
+ swpm_debug_log_subsc("Upgrading the current membership level (".$old_membership_level.") of this member to the newly paid level (".$membership_level.")", true);
51
  $updatedb = $wpdb->prepare("UPDATE $members_table_name SET account_state=%s, membership_level=%d,subscription_starts=%s,subscr_id=%s WHERE member_id=%d", $account_state, $membership_level, $subscription_starts, $subscr_id, $swpm_id);
52
  $results = $wpdb->query($updatedb);
53
  do_action('swpm_membership_changed', array('member_id'=>$swpm_id, 'from_level'=>$old_membership_level, 'to_level'=>$membership_level));
languages/swpm-sv_SE.mo CHANGED
Binary file
languages/swpm-sv_SE.po CHANGED
@@ -1,708 +1,919 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: simple membership\n"
4
- "POT-Creation-Date: 2014-08-28 19:28+1000\n"
5
- "PO-Revision-Date: 2014-10-17 09:59+0100\n"
6
- "Last-Translator: Geson Perry <gp@echad.se>\n"
7
  "Language-Team: \n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.6.10\n"
12
  "X-Poedit-KeywordsList: __;_e\n"
13
  "X-Poedit-Basepath: .\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "Language: sv\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
- #: classes/class.bAccessControl.php:23 classes/class.bAccessControl.php:40
 
 
 
 
 
 
 
 
19
  msgid "You are not allowed to view this content"
20
- msgstr "Du är inte tillåten att se detta innehåll"
21
 
22
- #: classes/class.bAccessControl.php:26 classes/class.bAccessControl.php:43
23
- msgid "You need to login to view this content. "
24
- msgstr "Du behöver logga in för att se innehållet"
25
 
26
- #: classes/class.bAdminRegistration.php:48
27
- #: classes/class.bFrontRegistration.php:64
 
 
 
 
28
  msgid "Registration Successful."
29
- msgstr "Registreringen är fullförd"
30
 
31
- #: classes/class.bAdminRegistration.php:53
32
- #: classes/class.bAdminRegistration.php:73
33
- #: classes/class.bMembershipLevel.php:36 classes/class.bMembershipLevel.php:54
 
34
  msgid "Please correct the following:"
35
- msgstr "Vänligen korrigera följande:"
36
 
37
- #: classes/class.bAjax.php:16 classes/class.bAjax.php:28
 
38
  msgid "Aready taken"
39
- msgstr "Är redan tagen"
40
 
41
- #: classes/class.bAjax.php:29
42
  msgid "Available"
43
- msgstr "Tillgänglig"
44
 
45
- #: classes/class.bAuth.php:48 classes/class.bFrontRegistration.php:179
 
46
  msgid "User Not Found."
47
- msgstr "Användaren finns inte."
48
 
49
- #: classes/class.bAuth.php:55
50
  msgid "Password Empty or Invalid."
51
- msgstr "Lösenordet är tomt eller felaktigt."
52
 
53
- #: classes/class.bAuth.php:79
54
  msgid "Account is inactive."
55
- msgstr "Kontot är inaktivt."
 
 
 
 
56
 
57
- #: classes/class.bAuth.php:89
58
  msgid "You are logged in as:"
59
  msgstr "Du är inloggad som:"
60
 
61
- #: classes/class.bAuth.php:128
62
  msgid "Logged Out Successfully."
63
- msgstr "Du är nu utloggad."
64
 
65
- #: classes/class.bAuth.php:170
66
  msgid "Session Expired."
67
- msgstr "Sessionen har utgått."
68
 
69
- #: classes/class.bAuth.php:179
70
  msgid "Invalid User Name"
71
- msgstr "Ogiltigt Användarnamn"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
- #: classes/class.bAuth.php:187
74
- msgid "Bad Cookie Hash"
75
- msgstr "Felaktig Cookie Hash"
76
 
77
- #: classes/class.bForm.php:26
 
 
 
 
 
 
 
 
 
 
 
 
78
  msgid ""
79
  "Wordpress account exists with given user name. But given email doesn't match."
80
  msgstr ""
81
- "Wordpress-kontot finns med tanke på användarnamnet. Men e-posten matchar "
82
- "inte."
83
 
84
- #: classes/class.bForm.php:31
85
  msgid ""
86
  "Wordpress account exists with given email. But given user name doesn't match."
87
  msgstr ""
88
- "Wordpress-kontot finns med given e-post. Men matchar inte med tanke på "
89
- "användarnamnet."
90
 
91
- #: classes/class.bForm.php:40
92
  msgid "User name is required"
93
  msgstr "Användarnamn krävs"
94
 
95
- #: classes/class.bForm.php:49
 
 
 
 
96
  msgid "User name already exists."
97
- msgstr "Användarnamnet finns redan."
98
 
99
- #: classes/class.bForm.php:72
100
  msgid "Password is required"
101
  msgstr "Lösenord krävs"
102
 
103
- #: classes/class.bForm.php:79
104
  msgid "Password mismatch"
105
- msgstr "Lösenordet matchar inte"
106
 
107
- #: classes/class.bForm.php:95
108
  msgid "Email is required"
109
- msgstr "E-post krävs"
110
 
111
- #: classes/class.bForm.php:99
112
  msgid "Email is invalid"
113
- msgstr "E-post är ogiltlig"
114
 
115
- #: classes/class.bForm.php:112
116
  msgid "Email is already used."
117
- msgstr "E-post adressen används redan."
118
 
119
- #: classes/class.bForm.php:178
120
  msgid "Member since field is invalid"
121
- msgstr "Medlem sedan fältet är ogiltigt"
122
 
123
- #: classes/class.bForm.php:189
124
- msgid "Subscription starts field is invalid"
125
- msgstr "Prenumeration startar fältet är ogiltigt"
126
 
127
- #: classes/class.bForm.php:199
128
  msgid "Gender field is invalid"
129
- msgstr "Kön Fältet är ogiltigt"
130
 
131
- #: classes/class.bForm.php:210
132
  msgid "Account state field is invalid"
133
- msgstr "Kontots tillstånds fält är ogiltigt"
 
 
 
 
134
 
135
- #: classes/class.bFrontRegistration.php:64 classes/class.bSettings.php:326
 
 
 
 
 
136
  msgid "Please"
137
  msgstr "Vänligen"
138
 
139
- #: classes/class.bFrontRegistration.php:64 classes/class.bSettings.php:326
140
- #: views/login.php:21
 
141
  msgid "Login"
142
  msgstr "Logga in"
143
 
144
- #: classes/class.bFrontRegistration.php:79
145
- #: classes/class.bFrontRegistration.php:158
146
  msgid "Please correct the following"
147
- msgstr "Vänligen korrigera följande"
148
 
149
- #: classes/class.bFrontRegistration.php:92
150
  msgid "Membership Level Couldn't be found."
151
- msgstr "Medlemskapsnivå kunde inte hittas."
152
 
153
- #: classes/class.bFrontRegistration.php:168
154
  msgid "Email Address Not Valid."
155
- msgstr "E-postadress ogiltig."
156
 
157
- #: classes/class.bFrontRegistration.php:199
158
  msgid "New password has been sent to your email address."
159
- msgstr "Nytt lösenord har skickats till din e-postadress."
 
 
 
 
160
 
161
- #: classes/class.bLevelForm.php:31
162
- msgid "Subscriptoin duration must be > 0."
163
- msgstr "Prenumerationens längd måste vara > 0."
164
 
165
- #: classes/class.bMembers.php:7
166
  msgid "Member"
167
  msgstr "Medlem"
168
 
169
- #: classes/class.bMembers.php:8 classes/class.simple-wp-membership.php:467
 
170
  msgid "Members"
171
  msgstr "Medlemmar"
172
 
173
- #: classes/class.bMembers.php:16 classes/class.bMembershipLevels.php:16
174
- msgid "ID"
175
- msgstr "ID"
176
-
177
- #: classes/class.bMembers.php:17 views/add.php:5 views/edit.php:4
178
- #: views/login.php:5
179
  msgid "User Name"
180
  msgstr "Användarnamn"
181
 
182
- #: classes/class.bMembers.php:18 views/add.php:21
183
- #: views/admin_member_form_common_part.php:2 views/edit.php:20
 
 
184
  msgid "First Name"
185
  msgstr "Förnamn"
186
 
187
- #: classes/class.bMembers.php:19 views/add.php:25
188
- #: views/admin_member_form_common_part.php:6 views/edit.php:24
 
 
189
  msgid "Last Name"
190
  msgstr "Efternamn"
191
 
192
- #: classes/class.bMembers.php:20 views/add.php:9 views/edit.php:8
 
193
  msgid "Email"
194
- msgstr "E-post"
195
 
196
- #: classes/class.bMembers.php:21 classes/class.bMembershipLevels.php:8
197
- #: classes/class.bMembershipLevels.php:17 views/add.php:64
198
- #: views/admin_member_form_common_part.php:55 views/edit.php:52
199
- msgid "Membership Level"
200
- msgstr "Medlemsnivå"
201
-
202
- #: classes/class.bMembers.php:22 views/admin_member_form_common_part.php:78
203
- msgid "Subscription Starts"
204
- msgstr "Prenumerationen startar"
205
 
206
- #: classes/class.bMembers.php:23
207
  msgid "Account State"
208
- msgstr "Tillstånd på kontot"
209
 
210
- #: classes/class.bMembers.php:35 classes/class.bMembershipLevels.php:29
 
211
  msgid "Delete"
212
- msgstr "Ta bort"
213
 
214
- #: classes/class.bMembers.php:100
215
  msgid "No Member found."
216
- msgstr "Ingen medlem funnen."
217
 
218
- #: classes/class.bMembershipLevel.php:31
219
  msgid "Membership Level Creation Successful."
220
- msgstr "Skapande av Medlemsnivå lyckades."
221
 
222
- #: classes/class.bMembershipLevel.php:50
223
  msgid "Updated Successfully."
224
- msgstr "Uppdatering klar."
225
-
226
- #: classes/class.bMembershipLevels.php:9
227
- #: classes/class.simple-wp-membership.php:469
228
- msgid "Membership Levels"
229
- msgstr "Medlemsnivåer"
230
 
231
- #: classes/class.bMembershipLevels.php:18
232
  msgid "Role"
233
- msgstr "Roll"
234
 
235
- #: classes/class.bMembershipLevels.php:19
236
- msgid "Subscription Valid For"
237
- msgstr "Prenumerationen gäller"
238
 
239
- #: classes/class.bSettings.php:28
240
  msgid "Plugin Documentation"
241
- msgstr "Plugin dokumentation"
242
 
243
- #: classes/class.bSettings.php:30
244
  msgid "General Settings"
245
- msgstr "Generella inställningar"
246
 
247
- #: classes/class.bSettings.php:32
248
  msgid "Enable Free Membership"
249
- msgstr "Aktivera gratis medlemskap"
250
 
251
- #: classes/class.bSettings.php:35
252
  msgid "Enable/disable registration for free membership level"
253
- msgstr "Aktivera / inaktivera registrering för gratis medlemsnivå"
254
 
255
- #: classes/class.bSettings.php:36
256
  msgid "Free Membership Level ID"
257
- msgstr "Gratis medlemsnivå ID"
258
 
259
- #: classes/class.bSettings.php:39
260
  msgid "Assign free membership level ID"
261
- msgstr "Tilldela gratis medlemskap nivå ID"
 
 
 
 
262
 
263
- #: classes/class.bSettings.php:40
 
 
 
 
 
 
 
 
 
264
  msgid "Hide Adminbar"
265
  msgstr "Göm Adminbar"
266
 
267
- #: classes/class.bSettings.php:43
268
  msgid ""
269
  "WordPress shows an admin toolbar to the logged in users of the site. Check "
270
  "this box if you want to hide that admin toolbar in the fronend of your site."
271
  msgstr ""
272
- "Wordpress visar admin verktygsfältet för inloggade användare på webbplatsen. "
273
- "Markera den här rutan om du vill dölja admin verktygsfältet på din webbplats."
 
 
 
 
274
 
275
- #: classes/class.bSettings.php:45
 
 
 
 
 
 
 
 
 
276
  msgid "Pages Settings"
277
- msgstr "Sidinställningar"
278
 
279
- #: classes/class.bSettings.php:47
280
  msgid "Login Page URL"
281
- msgstr "Login sidans URL"
282
 
283
- #: classes/class.bSettings.php:51
284
  msgid "Registration Page URL"
285
- msgstr "Registreringssidans URL"
286
 
287
- #: classes/class.bSettings.php:55
288
  msgid "Join Us Page URL"
289
- msgstr " med oss sidans URL"
290
 
291
- #: classes/class.bSettings.php:59
292
  msgid "Edit Profile Page URL"
293
- msgstr "Ändra profilsidans URL"
294
 
295
- #: classes/class.bSettings.php:63
296
  msgid "Password Reset Page URL"
297
- msgstr "Återställ lösenordssidans URL"
298
 
299
- #: classes/class.bSettings.php:68
300
  msgid "Test & Debug Settings"
301
- msgstr "Test & Debug inställningar"
302
 
303
- #: classes/class.bSettings.php:74
304
  msgid "Enable Sandbox Testing"
305
- msgstr "Aktivera Sandbox test"
306
 
307
- #: classes/class.bSettings.php:77
308
  msgid "Enable this option if you want to do sandbox payment testing."
309
- msgstr "Aktivera det här alternativet om du vill testa Sandbox betalning."
310
 
311
- #: classes/class.bSettings.php:90
312
  msgid "Email Misc. Settings"
313
- msgstr "Diverse E-post inställningar"
314
 
315
- #: classes/class.bSettings.php:92
316
  msgid "From Email Address"
317
- msgstr "Från E-post adress"
318
 
319
- #: classes/class.bSettings.php:97
320
  msgid "Email Settings (Prompt to Complete Registration )"
321
- msgstr "E-postinställningar (Uppmana att slutföra registreringen)"
322
 
323
- #: classes/class.bSettings.php:99 classes/class.bSettings.php:110
324
- #: classes/class.bSettings.php:129
 
325
  msgid "Email Subject"
326
- msgstr "E-post ämne"
327
 
328
- #: classes/class.bSettings.php:103 classes/class.bSettings.php:114
329
- #: classes/class.bSettings.php:133
 
330
  msgid "Email Body"
331
- msgstr "E-post meddelande"
332
 
333
- #: classes/class.bSettings.php:108
334
  msgid "Email Settings (Registration Complete)"
335
- msgstr "E-post inställningar (Registrering avklarad)"
336
 
337
- #: classes/class.bSettings.php:118
338
  msgid "Send Notification To Admin"
339
- msgstr "Skicka ett meddelande till Admin"
340
 
341
- #: classes/class.bSettings.php:122
342
  msgid "Send Email to Member When Added via Admin Dashboard"
343
- msgstr "Skicka e-post till medlem när de är tillagda via Admin dashboard"
344
 
345
- #: classes/class.bSettings.php:127
346
  msgid " Email Settings (Account Upgrade Notification)"
347
- msgstr "E-postinställningar (Kontouppgraderings meddelande)"
348
 
349
- #: classes/class.bSettings.php:326
350
  msgid "Not a Member?"
351
- msgstr "Inte medlem?"
352
 
353
- #: classes/class.bSettings.php:326 views/login.php:30
 
354
  msgid "Join Us"
355
- msgstr " med oss"
356
 
357
- #: classes/class.bUtils.php:32 views/admin_member_form_common_part.php:66
358
  msgid "Active"
359
  msgstr "Aktiv"
360
 
361
- #: classes/class.bUtils.php:33 views/admin_member_form_common_part.php:67
362
  msgid "Inactive"
363
  msgstr "Inaktiv"
364
 
365
- #: classes/class.bUtils.php:34 views/admin_member_form_common_part.php:68
366
  msgid "Pending"
367
- msgstr "Väntar"
368
 
369
- #: classes/class.bUtils.php:35 views/admin_member_form_common_part.php:69
370
  msgid "Expired"
371
- msgstr "Förfallen"
372
 
373
- #: classes/class.bUtils.php:225
374
  msgid "Never"
375
  msgstr "Aldrig"
376
 
377
- #: classes/class.miscUtils.php:51
378
  msgid "Registration"
379
  msgstr "Registrering"
380
 
381
- #: classes/class.miscUtils.php:74
382
  msgid "Member Login"
383
- msgstr "Login för medlemmar"
384
 
385
- #: classes/class.miscUtils.php:97
386
  msgid "Profile"
387
  msgstr "Profil"
388
 
389
- #: classes/class.miscUtils.php:120
390
  msgid "Password Reset"
391
- msgstr "Återställ lösenord"
392
 
393
- #: classes/class.simple-wp-membership.php:178
394
  msgid "You are not logged in."
395
- msgstr "Du är inte inloggad."
396
 
397
- #: classes/class.simple-wp-membership.php:209
398
  msgid "Simple WP Membership Protection"
399
- msgstr "Simple WP Membership skydd"
400
 
401
- #: classes/class.simple-wp-membership.php:222
402
  msgid "Simple Membership Protection options"
403
- msgstr "Simple Membership Protection alternativ"
404
 
405
- #: classes/class.simple-wp-membership.php:238
406
  msgid "Do you want to protect this content?"
407
- msgstr "Vill du skydda innehållet?"
408
 
409
- #: classes/class.simple-wp-membership.php:243
410
  msgid "Select the membership level that can access this content:"
411
- msgstr "Välj den medlemsnivå som kan komma åt det här innehållet:"
412
-
413
- #: classes/class.simple-wp-membership.php:375
414
- msgid "Display SWPM Login."
415
- msgstr "Visa SWPM Login."
416
-
417
- #: classes/class.simple-wp-membership.php:377
418
- msgid "SWPM Login"
419
- msgstr "SWPM Login"
420
 
421
- #: classes/class.simple-wp-membership.php:464
422
  msgid "WP Membership"
423
  msgstr "WP medlemskap"
424
 
425
- #: classes/class.simple-wp-membership.php:471
426
  msgid "Settings"
427
  msgstr "Inställningar"
428
 
429
- #: views/add.php:13 views/admin_member_form_common_part.php:45
430
- #: views/edit.php:12 views/login.php:11
 
 
 
 
 
431
  msgid "Password"
432
  msgstr "Lösenord"
433
 
434
- #: views/add.php:17 views/edit.php:16
435
  msgid "Repeat Password"
436
- msgstr "Upprepa lösenord"
437
-
438
- #: views/add.php:29 views/admin_member_form_common_part.php:10
439
- msgid "Gender"
440
- msgstr "Kön"
441
-
442
- #: views/add.php:36 views/admin_member_form_common_part.php:17
443
- #: views/edit.php:28
444
- msgid "Phone"
445
- msgstr "Telefon"
446
-
447
- #: views/add.php:40 views/admin_member_form_common_part.php:21
448
- #: views/edit.php:32
449
- msgid "Street"
450
- msgstr "Gata"
451
-
452
- #: views/add.php:44 views/admin_member_form_common_part.php:25
453
- #: views/edit.php:36
454
- msgid "City"
455
- msgstr "Stad"
456
-
457
- #: views/add.php:48 views/admin_member_form_common_part.php:29
458
- #: views/edit.php:40
459
- msgid "State"
460
- msgstr "Stat"
461
-
462
- #: views/add.php:52 views/admin_member_form_common_part.php:33
463
- #: views/edit.php:44
464
- msgid "Zipcode"
465
- msgstr "Poastnummer"
466
 
467
- #: views/add.php:56 views/admin_member_form_common_part.php:37
468
- #: views/edit.php:48
469
- msgid "Country"
470
- msgstr "Land"
471
-
472
- #: views/add.php:60 views/admin_member_form_common_part.php:41
473
- msgid "Company"
474
- msgstr "Företag"
475
-
476
- #: views/add.php:71
477
  msgid "Register"
478
- msgstr "Registrera"
479
 
480
- #: views/admin_add.php:6
481
  msgid "Add Member"
482
  msgstr "Lägg till medlem"
483
 
484
- #: views/admin_add.php:7
485
  msgid "Create a brand new user and add it to this site."
486
- msgstr "Skapa en helt ny användare och lägga till den här webbplatsen."
487
 
488
- #: views/admin_add.php:11
489
  msgid "User name"
490
  msgstr "Användarnamn"
491
 
492
- #: views/admin_add.php:11 views/admin_add.php:15 views/admin_add_level.php:11
493
- #: views/admin_add_level.php:15 views/admin_add_level.php:19
494
- #: views/admin_edit.php:9 views/admin_edit.php:13
495
- #: views/admin_edit_level.php:10 views/admin_edit_level.php:14
496
- #: views/admin_edit_level.php:18
 
 
 
 
 
497
  msgid "(required)"
498
  msgstr "(krävs)"
499
 
500
- #: views/admin_add.php:15 views/admin_edit.php:13
 
501
  msgid "E-mail"
502
- msgstr "E.post"
 
 
 
 
 
 
 
 
 
503
 
504
- #: views/admin_add.php:19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  msgid "Add New Member "
506
  msgstr "Lägg till ny medlem"
507
 
508
- #: views/admin_add_level.php:6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  msgid "Create new membership level."
510
- msgstr "Skapa ny medlemsnivå."
511
 
512
- #: views/admin_add_level.php:11 views/admin_edit_level.php:10
 
513
  msgid "Membership Level Name"
514
- msgstr "Namn på medlemsnivå"
515
 
516
- #: views/admin_add_level.php:15 views/admin_edit_level.php:14
 
517
  msgid "Default WordPress Role"
518
- msgstr "Standard Wordpress roll"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
 
520
- #: views/admin_add_level.php:19 views/admin_edit_level.php:18
521
- msgid "Subscription Duration"
522
- msgstr "Längd prenumeration"
 
 
 
 
 
 
523
 
524
- #: views/admin_add_level.php:26 views/admin_edit_level.php:27
525
- msgid "No Expiry"
526
- msgstr "Ingen utgång"
 
 
 
 
 
 
527
 
528
- #: views/admin_add_level.php:55
 
 
 
 
 
 
 
 
529
  msgid "Add New Membership Level "
530
- msgstr "Lägg till ny medlemsnivå"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
 
532
- #: views/admin_edit.php:5
533
  msgid "Edit Member"
534
- msgstr "Ändra medlem"
535
 
536
- #: views/admin_edit.php:6
537
  msgid "Edit existing member details."
538
- msgstr "Ändra existerande medlemsdetaljer"
539
 
540
- #: views/admin_edit.php:9
 
541
  msgid "Username"
542
- msgstr "Användarnamn"
 
 
 
 
543
 
544
- #: views/admin_edit.php:18
 
 
 
 
545
  msgid "Edit User "
546
- msgstr "Ändra användare"
547
 
548
- #: views/admin_edit_level.php:5
549
  msgid "Edit membership level"
550
- msgstr "Ändra medlemsnivå"
551
 
552
- #: views/admin_edit_level.php:6
553
  msgid "Edit membership level."
554
- msgstr "Ändra medlemsnivå."
555
 
556
- #: views/admin_edit_level.php:54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  msgid "Edit Membership Level "
558
- msgstr "Ändra medlemsnivå"
559
 
560
- #: views/admin_members.php:2
561
  msgid "Simple WP Membership::Members"
562
- msgstr "Simple WP Membership::Medlemmar"
563
 
564
- #: views/admin_members.php:3 views/admin_members.php:19
565
- #: views/admin_membership_levels.php:21
 
566
  msgid "Add New"
567
- msgstr "Lägg till ny"
568
 
569
- #: views/admin_members.php:9 views/admin_membership_levels.php:11
 
570
  msgid "search"
571
- msgstr "sök"
572
 
573
- #: views/admin_membership_levels.php:3
574
  msgid "Simple WP Membership::Membership Levels"
575
- msgstr "Simple WP Membership::Medlemsnivåer"
576
 
577
- #: views/admin_membership_level_menu.php:2
578
  msgid "Membership level"
579
- msgstr "Medlemsnivå"
580
 
581
- #: views/admin_membership_level_menu.php:3
582
  msgid "Manage Content Production"
583
- msgstr "Hantera innehållsproduktion"
584
 
585
- #: views/admin_membership_manage.php:17
 
 
 
 
586
  msgid "Example Content Protection Settings"
587
- msgstr "Exempel på skyddsinställningar av innehåll"
588
 
589
- #: views/admin_member_form_common_part.php:45
590
- msgid "(twice, required)"
591
- msgstr "(två gånger, krävs)"
592
 
593
- #: views/admin_member_form_common_part.php:50
594
- msgid "Strength indicator"
595
- msgstr "Indikator för styrka"
 
596
 
597
- #: views/admin_member_form_common_part.php:51
598
- msgid ""
599
- "Hint: The password should be at least seven characters long. To make it "
600
- "stronger, use upper and lower case letters, numbers and symbols like ! \" ? "
601
- "$ % ^ &amp; )."
602
- msgstr ""
603
- "Tips: Lösenordet ska vara minst sju tecken långt. För att göra det starkare, "
604
- "använd stora och små bokstäver, siffror och symboler som! ? \"$% ^ & Amp;)."
605
 
606
- #: views/admin_member_form_common_part.php:64 views/loggedin.php:7
607
- #: views/login_widget_logged.php:6
608
- msgid "Account Status"
609
- msgstr "Tillstånd på kontot"
610
 
611
- #: views/admin_member_form_common_part.php:74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  msgid "Member Since"
613
  msgstr "Medlem sedan"
614
 
615
- #: views/admin_payment_settings.php:2 views/admin_settings.php:2
616
- #: views/admin_tools_settings.php:2
617
- msgid "Simple WP Membership::Settings"
618
- msgstr "Simple WP Membership::Inställningar"
619
-
620
- #: views/admin_payment_settings.php:33
621
  msgid "PayPal Integration Settings"
622
- msgstr "PayPal integrationsinställningar"
623
 
624
- #: views/admin_payment_settings.php:36
625
  msgid "Generate the \"Advanced Variables\" Code for your PayPal button"
626
- msgstr "Generera \"Avancerade variabler \" Kod för din PayPal-knapp"
627
 
628
- #: views/admin_payment_settings.php:39
629
  msgid "Enter the Membership Level ID"
630
- msgstr "Ange medlemsnivå ID"
631
 
632
- #: views/admin_payment_settings.php:41
633
  msgid "Generate Code"
634
- msgstr "Skapa kod"
635
 
636
- #: views/admin_tools_settings.php:9
637
  msgid "Generate a Registration Completion link"
638
- msgstr "Skapa en Registrering klar länk"
639
 
640
- #: views/admin_tools_settings.php:12
641
  msgid ""
642
  "You can manually generate a registration completion link here and give it to "
643
  "your customer if they have missed the email that was automatically sent out "
644
  "to them after the payment."
645
  msgstr ""
646
- "Du kan manuellt skapa en registrerings slutförande länk här och ge den till "
647
- "din kund om de har missat den e-post som automatiskt skickades ut till dem "
648
- "efter betalningen."
649
 
650
- #: views/admin_tools_settings.php:17
651
  msgid "Generate Registration Completion Link"
652
- msgstr "Skapa en Registrering klar länk"
653
 
654
- #: views/admin_tools_settings.php:20
655
  msgid "OR"
656
- msgstr "ELLER"
657
 
658
- #: views/admin_tools_settings.php:21
659
  msgid "For All Pending Registrations"
660
- msgstr "För alla väntande registreringar"
661
 
662
- #: views/admin_tools_settings.php:24
663
  msgid "Registration Completion Links Will Appear Below:"
664
- msgstr "Registrering klar länk visas nedan:"
665
 
666
- #: views/admin_tools_settings.php:31
667
  msgid "Send Registration Reminder Email too"
668
- msgstr "Skicka registrerings påminnelse via E-post till"
669
 
670
- #: views/admin_tools_settings.php:34
671
  msgid "Submit"
672
  msgstr "Skicka"
673
 
674
- #: views/edit.php:58
675
  msgid "Update"
676
  msgstr "Uppdatera"
677
 
678
- #: views/forgot_password.php:5
679
  msgid "Email Address"
680
- msgstr "E-post adress"
681
 
682
- #: views/forgot_password.php:12
683
  msgid "Reset Password"
684
  msgstr "Återställ lösenord"
685
 
686
- #: views/loggedin.php:3 views/login_widget_logged.php:3
687
  msgid "Logged in as"
688
  msgstr "Inloggad som"
689
 
690
- #: views/loggedin.php:11 views/login_widget_logged.php:9
691
  msgid "Membership"
692
  msgstr "Medlemskap"
693
 
694
- #: views/loggedin.php:15 views/login_widget_logged.php:12
695
  msgid "Account Expiry"
696
- msgstr "Utgång för konto"
697
 
698
- #: views/loggedin.php:19 views/login_widget_logged.php:16
699
  msgid "Logout"
700
  msgstr "Logga ut"
701
 
702
- #: views/login.php:17
703
  msgid "Remember Me"
704
  msgstr "Kom ihåg mig"
705
 
706
- #: views/login.php:26
707
  msgid "Forgot Password"
708
- msgstr "Glömt lösenordet"
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Simple Membership\n"
4
+ "POT-Creation-Date: 2015-06-10 22:20+0100\n"
5
+ "PO-Revision-Date: 2015-06-16 14:41+0100\n"
6
+ "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.8.1\n"
12
  "X-Poedit-KeywordsList: __;_e\n"
13
  "X-Poedit-Basepath: .\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "Language: sv\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
+ #: simple-membership/classes/class.bAccessControl.php:21
19
+ #: simple-membership/classes/class.bAccessControl.php:28
20
+ #: simple-membership/classes/class.bAccessControl.php:48
21
+ msgid "You need to login to view this content. "
22
+ msgstr "Du måste logga in för att se detta innehåll."
23
+
24
+ #: simple-membership/classes/class.bAccessControl.php:35
25
+ #: simple-membership/classes/class.bAccessControl.php:39
26
+ #: simple-membership/classes/class.bAccessControl.php:54
27
  msgid "You are not allowed to view this content"
28
+ msgstr "Du får inte att se detta innehåll"
29
 
30
+ #: simple-membership/classes/class.bAccessControl.php:72
31
+ msgid "You do no have permission to view rest of the content"
32
+ msgstr "Du har inte behörighet att läsa resten av innehållet"
33
 
34
+ #: simple-membership/classes/class.bAccessControl.php:76
35
+ #: simple-membership/classes/class.bAccessControl.php:94
36
+ msgid "You need to login to view the rest of the content. "
37
+ msgstr "Du måste logga in för att läsa resten av innehållet."
38
+
39
+ #: simple-membership/classes/class.bAdminRegistration.php:49
40
  msgid "Registration Successful."
41
+ msgstr "Registreringen lyckades!"
42
 
43
+ #: simple-membership/classes/class.bAdminRegistration.php:54
44
+ #: simple-membership/classes/class.bAdminRegistration.php:89
45
+ #: simple-membership/classes/class.bMembershipLevel.php:42
46
+ #: simple-membership/classes/class.bMembershipLevel.php:60
47
  msgid "Please correct the following:"
48
+ msgstr "Vänligen rätta till följande:"
49
 
50
+ #: simple-membership/classes/class.bAjax.php:17
51
+ #: simple-membership/classes/class.bAjax.php:28
52
  msgid "Aready taken"
53
+ msgstr "Upptaget"
54
 
55
+ #: simple-membership/classes/class.bAjax.php:29
56
  msgid "Available"
57
+ msgstr "Tillgängligt"
58
 
59
+ #: simple-membership/classes/class.bAuth.php:46
60
+ #: simple-membership/classes/class.bFrontRegistration.php:173
61
  msgid "User Not Found."
62
+ msgstr "Användare hittades inte."
63
 
64
+ #: simple-membership/classes/class.bAuth.php:53
65
  msgid "Password Empty or Invalid."
66
+ msgstr "Lösenordet är tomt eller ogiltigt."
67
 
68
+ #: simple-membership/classes/class.bAuth.php:76
69
  msgid "Account is inactive."
70
+ msgstr "Användarkontot är ej aktivt."
71
+
72
+ #: simple-membership/classes/class.bAuth.php:93
73
+ msgid "Account has expired."
74
+ msgstr "Användarkontot är gammalt."
75
 
76
+ #: simple-membership/classes/class.bAuth.php:100
77
  msgid "You are logged in as:"
78
  msgstr "Du är inloggad som:"
79
 
80
+ #: simple-membership/classes/class.bAuth.php:139
81
  msgid "Logged Out Successfully."
82
+ msgstr "Lyckad utloggning."
83
 
84
+ #: simple-membership/classes/class.bAuth.php:186
85
  msgid "Session Expired."
86
+ msgstr "Slut sessionen"
87
 
88
+ #: simple-membership/classes/class.bAuth.php:194
89
  msgid "Invalid User Name"
90
+ msgstr "Ogiltigt användarnamn"
91
+
92
+ #: simple-membership/classes/class.bAuth.php:202
93
+ msgid "Sorry! Something went wrong"
94
+ msgstr "Nåt blev fel!"
95
+
96
+ #: simple-membership/classes/class.bCategoryList.php:15
97
+ #: simple-membership/classes/class.bMembers.php:21
98
+ #: simple-membership/classes/class.bMembershipLevels.php:8
99
+ #: simple-membership/classes/class.bMembershipLevels.php:17
100
+ #: simple-membership/views/add.php:30
101
+ #: simple-membership/views/admin_member_form_common_part.php:2
102
+ #: simple-membership/views/edit.php:52
103
+ msgid "Membership Level"
104
+ msgstr "Medlemskapsnivå"
105
+
106
+ #: simple-membership/classes/class.bCategoryList.php:16
107
+ #: simple-membership/classes/class.bMembershipLevels.php:9
108
+ #: simple-membership/classes/class.simple-wp-membership.php:464
109
+ msgid "Membership Levels"
110
+ msgstr "Medlemskapsnivåer"
111
+
112
+ #: simple-membership/classes/class.bCategoryList.php:29
113
+ #: simple-membership/classes/class.bMembers.php:16
114
+ #: simple-membership/classes/class.bMembershipLevels.php:16
115
+ msgid "ID"
116
+ msgstr "ID"
117
 
118
+ #: simple-membership/classes/class.bCategoryList.php:30
119
+ msgid "Name"
120
+ msgstr "Namn"
121
 
122
+ #: simple-membership/classes/class.bCategoryList.php:31
123
+ msgid "Description"
124
+ msgstr "Beskrivning"
125
+
126
+ #: simple-membership/classes/class.bCategoryList.php:32
127
+ msgid "Count"
128
+ msgstr "Antal"
129
+
130
+ #: simple-membership/classes/class.bCategoryList.php:63
131
+ msgid "Updated! "
132
+ msgstr "Uppdaterad!"
133
+
134
+ #: simple-membership/classes/class.bForm.php:26
135
  msgid ""
136
  "Wordpress account exists with given user name. But given email doesn't match."
137
  msgstr ""
138
+ "Wordpressanvändare finns med detta användarnamn. Men mejladressen är fel."
 
139
 
140
+ #: simple-membership/classes/class.bForm.php:31
141
  msgid ""
142
  "Wordpress account exists with given email. But given user name doesn't match."
143
  msgstr ""
144
+ "Wordpressanvändare finns med detta mejladressen. Men användarnamnet är fel."
 
145
 
146
+ #: simple-membership/classes/class.bForm.php:40
147
  msgid "User name is required"
148
  msgstr "Användarnamn krävs"
149
 
150
+ #: simple-membership/classes/class.bForm.php:44
151
+ msgid "User name contains invalid character"
152
+ msgstr "Användarnamn innehåller ogiltiga tecken"
153
+
154
+ #: simple-membership/classes/class.bForm.php:52
155
  msgid "User name already exists."
156
+ msgstr "Användarnamnet finns redan"
157
 
158
+ #: simple-membership/classes/class.bForm.php:75
159
  msgid "Password is required"
160
  msgstr "Lösenord krävs"
161
 
162
+ #: simple-membership/classes/class.bForm.php:82
163
  msgid "Password mismatch"
164
+ msgstr "Löserord matchar inte"
165
 
166
+ #: simple-membership/classes/class.bForm.php:98
167
  msgid "Email is required"
168
+ msgstr "Mejladress krävs"
169
 
170
+ #: simple-membership/classes/class.bForm.php:102
171
  msgid "Email is invalid"
172
+ msgstr "Ogiltig mejladress"
173
 
174
+ #: simple-membership/classes/class.bForm.php:118
175
  msgid "Email is already used."
176
+ msgstr "Mejladressen används redan"
177
 
178
+ #: simple-membership/classes/class.bForm.php:184
179
  msgid "Member since field is invalid"
180
+ msgstr "Fältet för medlem sedan är ogiltigt"
181
 
182
+ #: simple-membership/classes/class.bForm.php:195
183
+ msgid "Access starts field is invalid"
184
+ msgstr "Åtkomst börjar fältet är ogiltigt"
185
 
186
+ #: simple-membership/classes/class.bForm.php:205
187
  msgid "Gender field is invalid"
188
+ msgstr "Könfältet är ogiltigt"
189
 
190
+ #: simple-membership/classes/class.bForm.php:216
191
  msgid "Account state field is invalid"
192
+ msgstr "Konto status fältet är ogiltigt"
193
+
194
+ #: simple-membership/classes/class.bForm.php:223
195
+ msgid "Invalid membership level"
196
+ msgstr "Ogiltig medlemskapsnivå"
197
 
198
+ #: simple-membership/classes/class.bFrontRegistration.php:61
199
+ msgid "Registration Successful. "
200
+ msgstr "Registreringen lyckades!"
201
+
202
+ #: simple-membership/classes/class.bFrontRegistration.php:61
203
+ #: simple-membership/classes/class.bSettings.php:367
204
  msgid "Please"
205
  msgstr "Vänligen"
206
 
207
+ #: simple-membership/classes/class.bFrontRegistration.php:61
208
+ #: simple-membership/classes/class.bSettings.php:367
209
+ #: simple-membership/views/login.php:21
210
  msgid "Login"
211
  msgstr "Logga in"
212
 
213
+ #: simple-membership/classes/class.bFrontRegistration.php:72
214
+ #: simple-membership/classes/class.bFrontRegistration.php:152
215
  msgid "Please correct the following"
216
+ msgstr "Vänligen rätta till följande:"
217
 
218
+ #: simple-membership/classes/class.bFrontRegistration.php:106
219
  msgid "Membership Level Couldn't be found."
220
+ msgstr "Medlemsskapsnivå kunde inte hittas"
221
 
222
+ #: simple-membership/classes/class.bFrontRegistration.php:162
223
  msgid "Email Address Not Valid."
224
+ msgstr "Ogiltig mejladress"
225
 
226
+ #: simple-membership/classes/class.bFrontRegistration.php:193
227
  msgid "New password has been sent to your email address."
228
+ msgstr "Ett nytt lösenord har skickats till din mejladress"
229
+
230
+ #: simple-membership/classes/class.bLevelForm.php:47
231
+ msgid "Date format is not valid."
232
+ msgstr "Datumformatet är ogiltigt"
233
 
234
+ #: simple-membership/classes/class.bLevelForm.php:54
235
+ msgid "Access duration must be > 0."
236
+ msgstr "Åtkomsttiden måste vara > 0"
237
 
238
+ #: simple-membership/classes/class.bMembers.php:7
239
  msgid "Member"
240
  msgstr "Medlem"
241
 
242
+ #: simple-membership/classes/class.bMembers.php:8
243
+ #: simple-membership/classes/class.simple-wp-membership.php:462
244
  msgid "Members"
245
  msgstr "Medlemmar"
246
 
247
+ #: simple-membership/classes/class.bMembers.php:17
248
+ #: simple-membership/views/add.php:6 simple-membership/views/edit.php:4
 
 
 
 
249
  msgid "User Name"
250
  msgstr "Användarnamn"
251
 
252
+ #: simple-membership/classes/class.bMembers.php:18
253
+ #: simple-membership/views/add.php:22
254
+ #: simple-membership/views/admin_member_form_common_part.php:15
255
+ #: simple-membership/views/edit.php:20
256
  msgid "First Name"
257
  msgstr "Förnamn"
258
 
259
+ #: simple-membership/classes/class.bMembers.php:19
260
+ #: simple-membership/views/add.php:26
261
+ #: simple-membership/views/admin_member_form_common_part.php:19
262
+ #: simple-membership/views/edit.php:24
263
  msgid "Last Name"
264
  msgstr "Efternamn"
265
 
266
+ #: simple-membership/classes/class.bMembers.php:20
267
+ #: simple-membership/views/add.php:10 simple-membership/views/edit.php:8
268
  msgid "Email"
269
+ msgstr "Mejladress"
270
 
271
+ #: simple-membership/classes/class.bMembers.php:22
272
+ #: simple-membership/views/admin_member_form_common_part.php:11
273
+ msgid "Access Starts"
274
+ msgstr "Åtkomst börjar"
 
 
 
 
 
275
 
276
+ #: simple-membership/classes/class.bMembers.php:23
277
  msgid "Account State"
278
+ msgstr "Konto status"
279
 
280
+ #: simple-membership/classes/class.bMembers.php:35
281
+ #: simple-membership/classes/class.bMembershipLevels.php:29
282
  msgid "Delete"
283
+ msgstr "Radera"
284
 
285
+ #: simple-membership/classes/class.bMembers.php:101
286
  msgid "No Member found."
287
+ msgstr "Medlem ej hittad"
288
 
289
+ #: simple-membership/classes/class.bMembershipLevel.php:37
290
  msgid "Membership Level Creation Successful."
291
+ msgstr "Ny medlemsskapsnivå har skapats"
292
 
293
+ #: simple-membership/classes/class.bMembershipLevel.php:56
294
  msgid "Updated Successfully."
295
+ msgstr "Uppdateringen lyckades"
 
 
 
 
 
296
 
297
+ #: simple-membership/classes/class.bMembershipLevels.php:18
298
  msgid "Role"
299
+ msgstr "Uppgift"
300
 
301
+ #: simple-membership/classes/class.bMembershipLevels.php:19
302
+ msgid "Access Valid For/Until"
303
+ msgstr "Åtkomst giltig till"
304
 
305
+ #: simple-membership/classes/class.bSettings.php:30
306
  msgid "Plugin Documentation"
307
+ msgstr "Dokumentation för plugin"
308
 
309
+ #: simple-membership/classes/class.bSettings.php:32
310
  msgid "General Settings"
311
+ msgstr "Allmänna inställningar"
312
 
313
+ #: simple-membership/classes/class.bSettings.php:34
314
  msgid "Enable Free Membership"
315
+ msgstr "Möjliggör gratis medlemskapsnivå"
316
 
317
+ #: simple-membership/classes/class.bSettings.php:37
318
  msgid "Enable/disable registration for free membership level"
319
+ msgstr "Möjliggör/möjliggör ej registrering för gratis medlemsskapsnivå"
320
 
321
+ #: simple-membership/classes/class.bSettings.php:38
322
  msgid "Free Membership Level ID"
323
+ msgstr "Gratis medlemskapsnivå ID"
324
 
325
+ #: simple-membership/classes/class.bSettings.php:41
326
  msgid "Assign free membership level ID"
327
+ msgstr "Tilldela gratis medlemskapsnivå ID "
328
+
329
+ #: simple-membership/classes/class.bSettings.php:42
330
+ msgid "Enable More Tag Protection"
331
+ msgstr "Möjliggör More Tag skydd"
332
 
333
+ #: simple-membership/classes/class.bSettings.php:45
334
+ msgid ""
335
+ "Enables or disables \"more\" tag protection in the posts and pages. Anything "
336
+ "after the More tag is protected. Anything before the more tag is teaser "
337
+ "content."
338
+ msgstr ""
339
+ "Möjliggör eller möjliggör ej \"more\" tag skydd hos posts och pages. Allt "
340
+ "efter More tag är skyddat. Allt innan More tag är teaser innehåll"
341
+
342
+ #: simple-membership/classes/class.bSettings.php:46
343
  msgid "Hide Adminbar"
344
  msgstr "Göm Adminbar"
345
 
346
+ #: simple-membership/classes/class.bSettings.php:49
347
  msgid ""
348
  "WordPress shows an admin toolbar to the logged in users of the site. Check "
349
  "this box if you want to hide that admin toolbar in the fronend of your site."
350
  msgstr ""
351
+ "Wordpress visar en admin bar för inloggade användare på sidan. Bocka av "
352
+ "checkboxen om du vill gömma admin barenframsidan av din sida."
353
+
354
+ #: simple-membership/classes/class.bSettings.php:51
355
+ msgid "Default Account Status"
356
+ msgstr "Standard kontostatus"
357
 
358
+ #: simple-membership/classes/class.bSettings.php:56
359
+ msgid ""
360
+ "Select the default account status for newly registered users. If you want to "
361
+ "manually approve the members then you can set the status to \"Pending\"."
362
+ msgstr ""
363
+ "Välj standard kontostatusen för de nyaste registrerade användarna. Om du "
364
+ "vill godkänna medlemmarna manuellt så kan du sätta statusen till \"avvaktande"
365
+ "\""
366
+
367
+ #: simple-membership/classes/class.bSettings.php:62
368
  msgid "Pages Settings"
369
+ msgstr "Sidoinställningar"
370
 
371
+ #: simple-membership/classes/class.bSettings.php:64
372
  msgid "Login Page URL"
373
+ msgstr "Inloggningssida URL"
374
 
375
+ #: simple-membership/classes/class.bSettings.php:68
376
  msgid "Registration Page URL"
377
+ msgstr "Registreringssida URL"
378
 
379
+ #: simple-membership/classes/class.bSettings.php:72
380
  msgid "Join Us Page URL"
381
+ msgstr "Bli medlemsida URL"
382
 
383
+ #: simple-membership/classes/class.bSettings.php:76
384
  msgid "Edit Profile Page URL"
385
+ msgstr "Profilredigeringssida URL"
386
 
387
+ #: simple-membership/classes/class.bSettings.php:80
388
  msgid "Password Reset Page URL"
389
+ msgstr "Sida för återställning av lösenord"
390
 
391
+ #: simple-membership/classes/class.bSettings.php:85
392
  msgid "Test & Debug Settings"
393
+ msgstr "Inställningar för test och rättelser"
394
 
395
+ #: simple-membership/classes/class.bSettings.php:91
396
  msgid "Enable Sandbox Testing"
397
+ msgstr "Möjliggör Sandbox testing"
398
 
399
+ #: simple-membership/classes/class.bSettings.php:94
400
  msgid "Enable this option if you want to do sandbox payment testing."
401
+ msgstr "Möjliggör detta om du vill ha sandbox payment testing"
402
 
403
+ #: simple-membership/classes/class.bSettings.php:104
404
  msgid "Email Misc. Settings"
405
+ msgstr "Inställningar för mejl misc "
406
 
407
+ #: simple-membership/classes/class.bSettings.php:106
408
  msgid "From Email Address"
409
+ msgstr "Från mejladressen"
410
 
411
+ #: simple-membership/classes/class.bSettings.php:111
412
  msgid "Email Settings (Prompt to Complete Registration )"
413
+ msgstr "Inställningar för mejl (prompt to complete registration)"
414
 
415
+ #: simple-membership/classes/class.bSettings.php:113
416
+ #: simple-membership/classes/class.bSettings.php:124
417
+ #: simple-membership/classes/class.bSettings.php:143
418
  msgid "Email Subject"
419
+ msgstr "E-ämne"
420
 
421
+ #: simple-membership/classes/class.bSettings.php:117
422
+ #: simple-membership/classes/class.bSettings.php:128
423
+ #: simple-membership/classes/class.bSettings.php:147
424
  msgid "Email Body"
425
+ msgstr "E-postmeddelande"
426
 
427
+ #: simple-membership/classes/class.bSettings.php:122
428
  msgid "Email Settings (Registration Complete)"
429
+ msgstr "Inställningar för mejl (lyckad registrering)"
430
 
431
+ #: simple-membership/classes/class.bSettings.php:132
432
  msgid "Send Notification To Admin"
433
+ msgstr "Skicka meddelande till Admin"
434
 
435
+ #: simple-membership/classes/class.bSettings.php:136
436
  msgid "Send Email to Member When Added via Admin Dashboard"
437
+ msgstr "Skicka mejl till medlem när hen är tillagd via Admin dashboard"
438
 
439
+ #: simple-membership/classes/class.bSettings.php:141
440
  msgid " Email Settings (Account Upgrade Notification)"
441
+ msgstr "Inställningar för mejl (anmälan av kontouppgradering)"
442
 
443
+ #: simple-membership/classes/class.bSettings.php:367
444
  msgid "Not a Member?"
445
+ msgstr "Du är inte medlem?"
446
 
447
+ #: simple-membership/classes/class.bSettings.php:367
448
+ #: simple-membership/views/login.php:27
449
  msgid "Join Us"
450
+ msgstr "Bli medlem"
451
 
452
+ #: simple-membership/classes/class.bUtils.php:63
453
  msgid "Active"
454
  msgstr "Aktiv"
455
 
456
+ #: simple-membership/classes/class.bUtils.php:64
457
  msgid "Inactive"
458
  msgstr "Inaktiv"
459
 
460
+ #: simple-membership/classes/class.bUtils.php:65
461
  msgid "Pending"
462
+ msgstr "Avvaktande"
463
 
464
+ #: simple-membership/classes/class.bUtils.php:66
465
  msgid "Expired"
466
+ msgstr "Upphöra"
467
 
468
+ #: simple-membership/classes/class.bUtils.php:251
469
  msgid "Never"
470
  msgstr "Aldrig"
471
 
472
+ #: simple-membership/classes/class.miscUtils.php:51
473
  msgid "Registration"
474
  msgstr "Registrering"
475
 
476
+ #: simple-membership/classes/class.miscUtils.php:74
477
  msgid "Member Login"
478
+ msgstr "Logga in"
479
 
480
+ #: simple-membership/classes/class.miscUtils.php:97
481
  msgid "Profile"
482
  msgstr "Profil"
483
 
484
+ #: simple-membership/classes/class.miscUtils.php:120
485
  msgid "Password Reset"
486
+ msgstr "Återställning av lösenord"
487
 
488
+ #: simple-membership/classes/class.simple-wp-membership.php:184
489
  msgid "You are not logged in."
490
+ msgstr "Du är ej inloggad"
491
 
492
+ #: simple-membership/classes/class.simple-wp-membership.php:215
493
  msgid "Simple WP Membership Protection"
494
+ msgstr "Simple WP Membership-skydd"
495
 
496
+ #: simple-membership/classes/class.simple-wp-membership.php:228
497
  msgid "Simple Membership Protection options"
498
+ msgstr "Alternativ för Simple WP Membership-skydd"
499
 
500
+ #: simple-membership/classes/class.simple-wp-membership.php:244
501
  msgid "Do you want to protect this content?"
502
+ msgstr "Will du skydda detta innehåll?"
503
 
504
+ #: simple-membership/classes/class.simple-wp-membership.php:249
505
  msgid "Select the membership level that can access this content:"
506
+ msgstr "Välj vilken medlemskapsnivå som ska kunna läsa detta innehåll"
 
 
 
 
 
 
 
 
507
 
508
+ #: simple-membership/classes/class.simple-wp-membership.php:459
509
  msgid "WP Membership"
510
  msgstr "WP medlemskap"
511
 
512
+ #: simple-membership/classes/class.simple-wp-membership.php:466
513
  msgid "Settings"
514
  msgstr "Inställningar"
515
 
516
+ #: simple-membership/classes/class.simple-wp-membership.php:468
517
+ msgid "Add-ons"
518
+ msgstr "Add-ons"
519
+
520
+ #: simple-membership/views/add.php:14 simple-membership/views/admin_add.php:19
521
+ #: simple-membership/views/admin_edit.php:17
522
+ #: simple-membership/views/edit.php:12 simple-membership/views/login.php:11
523
  msgid "Password"
524
  msgstr "Lösenord"
525
 
526
+ #: simple-membership/views/add.php:18 simple-membership/views/edit.php:16
527
  msgid "Repeat Password"
528
+ msgstr "Repetera lösenord"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
 
530
+ #: simple-membership/views/add.php:37
 
 
 
 
 
 
 
 
 
531
  msgid "Register"
532
+ msgstr "Register"
533
 
534
+ #: simple-membership/views/admin_add.php:6
535
  msgid "Add Member"
536
  msgstr "Lägg till medlem"
537
 
538
+ #: simple-membership/views/admin_add.php:7
539
  msgid "Create a brand new user and add it to this site."
540
+ msgstr "Skapa en helt ny användare och lägg til denna användare till sidan"
541
 
542
+ #: simple-membership/views/admin_add.php:11
543
  msgid "User name"
544
  msgstr "Användarnamn"
545
 
546
+ #: simple-membership/views/admin_add.php:11
547
+ #: simple-membership/views/admin_add.php:15
548
+ #: simple-membership/views/admin_add_level.php:11
549
+ #: simple-membership/views/admin_add_level.php:15
550
+ #: simple-membership/views/admin_add_level.php:19
551
+ #: simple-membership/views/admin_edit.php:9
552
+ #: simple-membership/views/admin_edit.php:13
553
+ #: simple-membership/views/admin_edit_level.php:10
554
+ #: simple-membership/views/admin_edit_level.php:14
555
+ #: simple-membership/views/admin_edit_level.php:18
556
  msgid "(required)"
557
  msgstr "(krävs)"
558
 
559
+ #: simple-membership/views/admin_add.php:15
560
+ #: simple-membership/views/admin_edit.php:13
561
  msgid "E-mail"
562
+ msgstr "E-mejl"
563
+
564
+ #: simple-membership/views/admin_add.php:19
565
+ msgid "(twice, required)"
566
+ msgstr "(återigen, det krävs)"
567
+
568
+ #: simple-membership/views/admin_add.php:24
569
+ #: simple-membership/views/admin_edit.php:21
570
+ msgid "Strength indicator"
571
+ msgstr "Säkerhetsnivå"
572
 
573
+ #: simple-membership/views/admin_add.php:25
574
+ #: simple-membership/views/admin_edit.php:22
575
+ msgid ""
576
+ "Hint: The password should be at least seven characters long. To make it "
577
+ "stronger, use upper and lower case letters, numbers and symbols like ! \" ? "
578
+ "$ % ^ &amp; )."
579
+ msgstr "Obs: Lösenordet borde vara minst sju bokstäver."
580
+
581
+ #: simple-membership/views/admin_add.php:29
582
+ #: simple-membership/views/admin_edit.php:26
583
+ #: simple-membership/views/loggedin.php:7
584
+ msgid "Account Status"
585
+ msgstr "Kontostatus"
586
+
587
+ #: simple-membership/views/admin_add.php:36
588
  msgid "Add New Member "
589
  msgstr "Lägg till ny medlem"
590
 
591
+ #: simple-membership/views/admin_addon_settings.php:2
592
+ #: simple-membership/views/admin_payment_settings.php:2
593
+ #: simple-membership/views/admin_settings.php:2
594
+ #: simple-membership/views/admin_tools_settings.php:2
595
+ msgid "Simple WP Membership::Settings"
596
+ msgstr "Inställningar för Simple WP Membership"
597
+
598
+ #: simple-membership/views/admin_addon_settings.php:7
599
+ msgid ""
600
+ "Some of the simple membership plugin's addon settings and options will be "
601
+ "displayed here (if you have them)"
602
+ msgstr ""
603
+ "Vissa av simple membership plugins addons inställningar och alternativ "
604
+ "kommer visas här (om du har dom)"
605
+
606
+ #: simple-membership/views/admin_add_level.php:6
607
  msgid "Create new membership level."
608
+ msgstr "Lägg till ny medlemskapsnivå"
609
 
610
+ #: simple-membership/views/admin_add_level.php:11
611
+ #: simple-membership/views/admin_edit_level.php:10
612
  msgid "Membership Level Name"
613
+ msgstr "Namn på medlemskapsnivå"
614
 
615
+ #: simple-membership/views/admin_add_level.php:15
616
+ #: simple-membership/views/admin_edit_level.php:14
617
  msgid "Default WordPress Role"
618
+ msgstr "Standard Wordpress role"
619
+
620
+ #: simple-membership/views/admin_add_level.php:19
621
+ #: simple-membership/views/admin_edit_level.php:18
622
+ msgid "Access Duration"
623
+ msgstr "Tid för inloggning"
624
+
625
+ #: simple-membership/views/admin_add_level.php:22
626
+ msgid "No Expiry (Access for this level will not expire until cancelled"
627
+ msgstr ""
628
+
629
+ #: simple-membership/views/admin_add_level.php:23
630
+ #: simple-membership/views/admin_add_level.php:25
631
+ #: simple-membership/views/admin_add_level.php:27
632
+ #: simple-membership/views/admin_add_level.php:29
633
+ #: simple-membership/views/admin_edit_level.php:22
634
+ #: simple-membership/views/admin_edit_level.php:25
635
+ #: simple-membership/views/admin_edit_level.php:28
636
+ #: simple-membership/views/admin_edit_level.php:31
637
+ msgid "Expire After"
638
+ msgstr ""
639
+
640
+ #: simple-membership/views/admin_add_level.php:24
641
+ #: simple-membership/views/admin_edit_level.php:23
642
+ msgid "Days (Access expires after given number of days)"
643
+ msgstr ""
644
+
645
+ #: simple-membership/views/admin_add_level.php:26
646
+ msgid "Weeks (Access expires after given number of weeks"
647
+ msgstr ""
648
 
649
+ #: simple-membership/views/admin_add_level.php:28
650
+ #: simple-membership/views/admin_edit_level.php:29
651
+ msgid "Months (Access expires after given number of months)"
652
+ msgstr ""
653
+
654
+ #: simple-membership/views/admin_add_level.php:30
655
+ #: simple-membership/views/admin_edit_level.php:32
656
+ msgid "Years (Access expires after given number of years)"
657
+ msgstr ""
658
 
659
+ #: simple-membership/views/admin_add_level.php:31
660
+ #: simple-membership/views/admin_edit_level.php:34
661
+ msgid "Fixed Date Expiry"
662
+ msgstr ""
663
+
664
+ #: simple-membership/views/admin_add_level.php:32
665
+ #: simple-membership/views/admin_edit_level.php:35
666
+ msgid "(Access expires on a fixed date)"
667
+ msgstr ""
668
 
669
+ #: simple-membership/views/admin_add_level.php:36
670
+ msgid "Access to older posts."
671
+ msgstr ""
672
+
673
+ #: simple-membership/views/admin_add_level.php:39
674
+ msgid "Only allow access to posts published after the user's join date."
675
+ msgstr ""
676
+
677
+ #: simple-membership/views/admin_add_level.php:45
678
  msgid "Add New Membership Level "
679
+ msgstr ""
680
+
681
+ #: simple-membership/views/admin_add_ons_page.php:6
682
+ msgid "Simple WP Membership::Add-ons"
683
+ msgstr ""
684
+
685
+ #: simple-membership/views/admin_category_list.php:2
686
+ msgid "Simple WP Membership::Categories"
687
+ msgstr ""
688
+
689
+ #: simple-membership/views/admin_category_list.php:7
690
+ msgid ""
691
+ "First of all, globally protect the category on your site by selecting "
692
+ "\"General Protection\" from the drop-down box below and then select the "
693
+ "categories that should be protected from non-logged in users."
694
+ msgstr ""
695
+
696
+ #: simple-membership/views/admin_category_list.php:10
697
+ msgid ""
698
+ "Next, select an existing membership level from the drop-down box below and "
699
+ "then select the categories you want to grant access to (for that particular "
700
+ "membership level)."
701
+ msgstr ""
702
 
703
+ #: simple-membership/views/admin_edit.php:5
704
  msgid "Edit Member"
705
+ msgstr ""
706
 
707
+ #: simple-membership/views/admin_edit.php:6
708
  msgid "Edit existing member details."
709
+ msgstr ""
710
 
711
+ #: simple-membership/views/admin_edit.php:9
712
+ #: simple-membership/views/login.php:5
713
  msgid "Username"
714
+ msgstr ""
715
+
716
+ #: simple-membership/views/admin_edit.php:17
717
+ msgid "(twice, leave empty to retain old password)"
718
+ msgstr ""
719
 
720
+ #: simple-membership/views/admin_edit.php:33
721
+ msgid "Notify User"
722
+ msgstr ""
723
+
724
+ #: simple-membership/views/admin_edit.php:40
725
  msgid "Edit User "
726
+ msgstr ""
727
 
728
+ #: simple-membership/views/admin_edit_level.php:5
729
  msgid "Edit membership level"
730
+ msgstr ""
731
 
732
+ #: simple-membership/views/admin_edit_level.php:6
733
  msgid "Edit membership level."
734
+ msgstr ""
735
 
736
+ #: simple-membership/views/admin_edit_level.php:21
737
+ msgid "No Expiry (Access for this level will not expire until cancelled)"
738
+ msgstr ""
739
+
740
+ #: simple-membership/views/admin_edit_level.php:26
741
+ msgid "Weeks (Access expires after given number of weeks)"
742
+ msgstr ""
743
+
744
+ #: simple-membership/views/admin_edit_level.php:40
745
+ msgid "Protect Older Posts (optional)"
746
+ msgstr ""
747
+
748
+ #: simple-membership/views/admin_edit_level.php:43
749
+ msgid ""
750
+ "Only allow access to protected posts published after the members's join date."
751
+ msgstr ""
752
+
753
+ #: simple-membership/views/admin_edit_level.php:51
754
  msgid "Edit Membership Level "
755
+ msgstr ""
756
 
757
+ #: simple-membership/views/admin_members.php:2
758
  msgid "Simple WP Membership::Members"
759
+ msgstr ""
760
 
761
+ #: simple-membership/views/admin_members.php:3
762
+ #: simple-membership/views/admin_members.php:19
763
+ #: simple-membership/views/admin_membership_levels.php:20
764
  msgid "Add New"
765
+ msgstr ""
766
 
767
+ #: simple-membership/views/admin_members.php:9
768
+ #: simple-membership/views/admin_membership_levels.php:10
769
  msgid "search"
770
+ msgstr ""
771
 
772
+ #: simple-membership/views/admin_membership_levels.php:2
773
  msgid "Simple WP Membership::Membership Levels"
774
+ msgstr ""
775
 
776
+ #: simple-membership/views/admin_membership_level_menu.php:2
777
  msgid "Membership level"
778
+ msgstr ""
779
 
780
+ #: simple-membership/views/admin_membership_level_menu.php:3
781
  msgid "Manage Content Production"
782
+ msgstr ""
783
 
784
+ #: simple-membership/views/admin_membership_level_menu.php:4
785
+ msgid "Category Protection"
786
+ msgstr ""
787
+
788
+ #: simple-membership/views/admin_membership_manage.php:17
789
  msgid "Example Content Protection Settings"
790
+ msgstr ""
791
 
792
+ #: simple-membership/views/admin_member_form_common_part.php:23
793
+ msgid "Gender"
794
+ msgstr "Kön"
795
 
796
+ #: simple-membership/views/admin_member_form_common_part.php:30
797
+ #: simple-membership/views/edit.php:28
798
+ msgid "Phone"
799
+ msgstr "Telefonnummer"
800
 
801
+ #: simple-membership/views/admin_member_form_common_part.php:34
802
+ #: simple-membership/views/edit.php:32
803
+ msgid "Street"
804
+ msgstr "Gata"
 
 
 
 
805
 
806
+ #: simple-membership/views/admin_member_form_common_part.php:38
807
+ #: simple-membership/views/edit.php:36
808
+ msgid "City"
809
+ msgstr "Stad"
810
 
811
+ #: simple-membership/views/admin_member_form_common_part.php:42
812
+ #: simple-membership/views/edit.php:40
813
+ msgid "State"
814
+ msgstr "Landskap"
815
+
816
+ #: simple-membership/views/admin_member_form_common_part.php:46
817
+ #: simple-membership/views/edit.php:44
818
+ msgid "Zipcode"
819
+ msgstr "Postnummer"
820
+
821
+ #: simple-membership/views/admin_member_form_common_part.php:50
822
+ #: simple-membership/views/edit.php:48
823
+ msgid "Country"
824
+ msgstr "Land"
825
+
826
+ #: simple-membership/views/admin_member_form_common_part.php:54
827
+ msgid "Company"
828
+ msgstr "Företag"
829
+
830
+ #: simple-membership/views/admin_member_form_common_part.php:58
831
  msgid "Member Since"
832
  msgstr "Medlem sedan"
833
 
834
+ #: simple-membership/views/admin_payment_settings.php:33
 
 
 
 
 
835
  msgid "PayPal Integration Settings"
836
+ msgstr ""
837
 
838
+ #: simple-membership/views/admin_payment_settings.php:36
839
  msgid "Generate the \"Advanced Variables\" Code for your PayPal button"
840
+ msgstr ""
841
 
842
+ #: simple-membership/views/admin_payment_settings.php:39
843
  msgid "Enter the Membership Level ID"
844
+ msgstr ""
845
 
846
+ #: simple-membership/views/admin_payment_settings.php:41
847
  msgid "Generate Code"
848
+ msgstr ""
849
 
850
+ #: simple-membership/views/admin_tools_settings.php:9
851
  msgid "Generate a Registration Completion link"
852
+ msgstr ""
853
 
854
+ #: simple-membership/views/admin_tools_settings.php:12
855
  msgid ""
856
  "You can manually generate a registration completion link here and give it to "
857
  "your customer if they have missed the email that was automatically sent out "
858
  "to them after the payment."
859
  msgstr ""
 
 
 
860
 
861
+ #: simple-membership/views/admin_tools_settings.php:17
862
  msgid "Generate Registration Completion Link"
863
+ msgstr "Skapa fullbordad registreringslänk"
864
 
865
+ #: simple-membership/views/admin_tools_settings.php:20
866
  msgid "OR"
867
+ msgstr ""
868
 
869
+ #: simple-membership/views/admin_tools_settings.php:21
870
  msgid "For All Pending Registrations"
871
+ msgstr "För alla avvaktande registreringar"
872
 
873
+ #: simple-membership/views/admin_tools_settings.php:24
874
  msgid "Registration Completion Links Will Appear Below:"
875
+ msgstr "Fullbordad registreringslänk ses nedan"
876
 
877
+ #: simple-membership/views/admin_tools_settings.php:31
878
  msgid "Send Registration Reminder Email too"
879
+ msgstr "Skicka registreringspåminnelse via mejl till"
880
 
881
+ #: simple-membership/views/admin_tools_settings.php:34
882
  msgid "Submit"
883
  msgstr "Skicka"
884
 
885
+ #: simple-membership/views/edit.php:58
886
  msgid "Update"
887
  msgstr "Uppdatera"
888
 
889
+ #: simple-membership/views/forgot_password.php:5
890
  msgid "Email Address"
891
+ msgstr "Mejladress"
892
 
893
+ #: simple-membership/views/forgot_password.php:12
894
  msgid "Reset Password"
895
  msgstr "Återställ lösenord"
896
 
897
+ #: simple-membership/views/loggedin.php:3
898
  msgid "Logged in as"
899
  msgstr "Inloggad som"
900
 
901
+ #: simple-membership/views/loggedin.php:11
902
  msgid "Membership"
903
  msgstr "Medlemskap"
904
 
905
+ #: simple-membership/views/loggedin.php:15
906
  msgid "Account Expiry"
907
+ msgstr "Utgånget konto"
908
 
909
+ #: simple-membership/views/loggedin.php:19
910
  msgid "Logout"
911
  msgstr "Logga ut"
912
 
913
+ #: simple-membership/views/login.php:18
914
  msgid "Remember Me"
915
  msgstr "Kom ihåg mig"
916
 
917
+ #: simple-membership/views/login.php:24
918
  msgid "Forgot Password"
919
+ msgstr "Glömt lösenordet?"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://simple-membership-plugin.com/
4
  Tags: member, members, members only, membership, memberships, register, WordPress membership plugin, content, content protection, paypal, restrict, restrict access, Restrict content, admin, access control, subscription, teaser, protection, profile, login, login page,
5
  Requires at least: 3.3
6
  Tested up to: 4.2
7
- Stable tag: 2.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -85,6 +85,8 @@ The following language translations are already available:
85
  * Romanian
86
  * Danish
87
  * Lithuanian
 
 
88
 
89
  You can translate the plugin using the language [translation documentation](https://simple-membership-plugin.com/translate-simple-membership-plugin/).
90
 
@@ -106,6 +108,20 @@ https://simple-membership-plugin.com/
106
 
107
  == Changelog ==
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  = 2.2.7 =
110
  - Added Japanese language translation to the plugin. The translation was submitted by Mana.
111
  - Added Serbian language translation to the plugin. The translation was submitted by Zoran Milijanovic.
4
  Tags: member, members, members only, membership, memberships, register, WordPress membership plugin, content, content protection, paypal, restrict, restrict access, Restrict content, admin, access control, subscription, teaser, protection, profile, login, login page,
5
  Requires at least: 3.3
6
  Tested up to: 4.2
7
+ Stable tag: 2.2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
85
  * Romanian
86
  * Danish
87
  * Lithuanian
88
+ * Serbian
89
+ * Japanese
90
 
91
  You can translate the plugin using the language [translation documentation](https://simple-membership-plugin.com/translate-simple-membership-plugin/).
92
 
108
 
109
  == Changelog ==
110
 
111
+ = 2.2.9 =
112
+ - Added a new feature to customize the password reset email.
113
+ - Added a new feature to customize the admin notification email address.
114
+ - Improved the help text for a few of the email settings fields.
115
+ - Updated the message that gets displayed after a member updates the profile.
116
+
117
+ = 2.2.8 =
118
+ - Updated the swedish language translation file.
119
+ - Code refactoring: moved all the init hook tasks to a separate class.
120
+ - Increased the size of admin nav tab menu items so they are easy to see.
121
+ - Made all the admin menu title size consistent accross all the menus.
122
+ - Updated the admin menu dashicon icon to a nicer looking one.
123
+ - You can now create and configure PayPal buy now button for membership payment from the payments menu.
124
+
125
  = 2.2.7 =
126
  - Added Japanese language translation to the plugin. The translation was submitted by Mana.
127
  - Added Serbian language translation to the plugin. The translation was submitted by Zoran Milijanovic.
simple-wp-membership.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
- Version: v2.2.7
5
  Plugin URI: https://simple-membership-plugin.com/
6
  Author: smp7, wp.insider
7
  Author URI: https://simple-membership-plugin.com/
@@ -17,7 +17,7 @@ include_once('classes/class.simple-wp-membership.php');
17
  include_once('classes/class.swpm-cronjob.php');
18
  include_once('swpm-compat.php');
19
 
20
- define('SIMPLE_WP_MEMBERSHIP_VER', '2.2.7');
21
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.2');
22
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
23
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');
1
  <?php
2
  /*
3
  Plugin Name: Simple WordPress Membership
4
+ Version: v2.2.9
5
  Plugin URI: https://simple-membership-plugin.com/
6
  Author: smp7, wp.insider
7
  Author URI: https://simple-membership-plugin.com/
17
  include_once('classes/class.swpm-cronjob.php');
18
  include_once('swpm-compat.php');
19
 
20
+ define('SIMPLE_WP_MEMBERSHIP_VER', '2.2.9');
21
  define('SIMPLE_WP_MEMBERSHIP_DB_VER', '1.2');
22
  define('SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL', home_url());
23
  define('SIMPLE_WP_MEMBERSHIP_PATH', dirname(__FILE__) . '/');
views/admin_addon_settings.php CHANGED
@@ -1,14 +1,15 @@
1
- <?php screen_icon( 'options-general' );?>
2
- <h1><?php echo SwpmUtils::_('Simple WP Membership::Settings')?></h1>
3
  <div class="wrap">
4
- <?php do_action("swpm-draw-tab"); ?>
5
-
 
 
 
6
  <p>
7
- <?php echo SwpmUtils::_("Some of the simple membership plugin's addon settings and options will be displayed here (if you have them)")?>
8
  </p>
9
  <form action="" method="POST">
10
- <input type="hidden" name="tab" value="<?php echo $current_tab;?>" />
11
- <?php do_action('swpm_addon_settings_section');?>
12
  <?php submit_button('Save Changes', 'primary', 'swpm-addon-settings'); ?>
13
  </form>
14
  </div><!-- end of wrap -->
 
 
1
  <div class="wrap">
2
+
3
+ <h2><?php echo SwpmUtils::_('Simple WP Membership::Settings') ?></h2>
4
+
5
+ <?php do_action("swpm-draw-tab"); ?>
6
+
7
  <p>
8
+ <?php echo SwpmUtils::_("Some of the simple membership plugin's addon settings and options will be displayed here (if you have them)") ?>
9
  </p>
10
  <form action="" method="POST">
11
+ <input type="hidden" name="tab" value="<?php echo $current_tab; ?>" />
12
+ <?php do_action('swpm_addon_settings_section'); ?>
13
  <?php submit_button('Save Changes', 'primary', 'swpm-addon-settings'); ?>
14
  </form>
15
  </div><!-- end of wrap -->
views/admin_members.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="wrap">
2
- <h2><?php screen_icon('users'); ?><?php echo SwpmUtils::_('Simple WP Membership::Members') ?>
3
  <a href="admin.php?page=simple_wp_membership&member_action=add" class="add-new-h2"><?php echo SwpmUtils::_('Add New'); ?></a></h2>
4
  <form method="post">
5
  <p class="search-box">
1
  <div class="wrap">
2
+ <h2><?php echo SwpmUtils::_('Simple WP Membership::Members') ?>
3
  <a href="admin.php?page=simple_wp_membership&member_action=add" class="add-new-h2"><?php echo SwpmUtils::_('Add New'); ?></a></h2>
4
  <form method="post">
5
  <p class="search-box">
views/admin_membership_level_menu.php CHANGED
@@ -1,5 +1,5 @@
1
- <h3 class="nav-tab-wrapper">
2
  <a class="nav-tab <?php echo ($selected==1) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_levels"><?php echo SwpmUtils::_('Membership level') ?></a>
3
  <a class="nav-tab <?php echo ($selected==2) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_levels&level_action=manage"><?php echo SwpmUtils::_('Manage Content Production') ?></a>
4
  <a class="nav-tab <?php echo ($selected==3) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_levels&level_action=category_list"><?php echo SwpmUtils::_('Category Protection') ?></a>
5
- </h3>
1
+ <h2 class="nav-tab-wrapper">
2
  <a class="nav-tab <?php echo ($selected==1) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_levels"><?php echo SwpmUtils::_('Membership level') ?></a>
3
  <a class="nav-tab <?php echo ($selected==2) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_levels&level_action=manage"><?php echo SwpmUtils::_('Manage Content Production') ?></a>
4
  <a class="nav-tab <?php echo ($selected==3) ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_levels&level_action=category_list"><?php echo SwpmUtils::_('Category Protection') ?></a>
5
+ </h2>
views/admin_membership_levels.php CHANGED
@@ -1,7 +1,9 @@
1
  <div class="wrap">
2
- <h2><?php screen_icon('users'); ?><?php echo SwpmUtils::_('Simple WP Membership::Membership Levels') ?>
3
  <a href="admin.php?page=simple_wp_membership_levels&level_action=add" class="add-new-h2"><?php echo esc_html_x('Add New', 'Level'); ?></a></h2>
 
4
  <?php include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_membership_level_menu.php'); ?>
 
5
  <form method="post">
6
  <p class="search-box">
7
  <label class="screen-reader-text" for="search_id-search-input">
1
  <div class="wrap">
2
+ <h2><?php echo SwpmUtils::_('Simple WP Membership::Membership Levels') ?>
3
  <a href="admin.php?page=simple_wp_membership_levels&level_action=add" class="add-new-h2"><?php echo esc_html_x('Add New', 'Level'); ?></a></h2>
4
+
5
  <?php include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/admin_membership_level_menu.php'); ?>
6
+
7
  <form method="post">
8
  <p class="search-box">
9
  <label class="screen-reader-text" for="search_id-search-input">
views/admin_membership_manage.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="wrap">
2
- <h2><?php screen_icon( 'users' );?>Simple WP Membership::Manage Protection</h2>
3
  <?php include_once(SIMPLE_WP_MEMBERSHIP_PATH.'views/admin_membership_level_menu.php');?>
4
 
5
  <div id="poststuff"><div id="post-body">
1
  <div class="wrap">
2
+ <h2>Simple WP Membership::Manage Protection</h2>
3
  <?php include_once(SIMPLE_WP_MEMBERSHIP_PATH.'views/admin_membership_level_menu.php');?>
4
 
5
  <div id="poststuff"><div id="post-body">
views/admin_settings.php CHANGED
@@ -1,11 +1,12 @@
1
- <?php screen_icon( 'options-general' );?>
2
- <h1><?php echo SwpmUtils::_('Simple WP Membership::Settings') ?></h1>
3
- <div class="wrap">
4
- <?php do_action("swpm-draw-tab"); ?>
5
- <form action="options.php" method="POST">
6
- <input type="hidden" name="tab" value="<?php echo $current_tab;?>" />
7
- <?php settings_fields( 'swpm-settings-tab-' . $current_tab ); ?>
8
- <?php do_settings_sections( 'simple_wp_membership_settings' ); ?>
9
- <?php submit_button(); ?>
10
- </form>
11
- </div>
 
1
+ <div class="wrap">
2
+
3
+ <h2><?php echo SwpmUtils::_('Simple WP Membership::Settings') ?></h2>
4
+
5
+ <?php do_action("swpm-draw-tab"); ?>
6
+ <form action="options.php" method="POST">
7
+ <input type="hidden" name="tab" value="<?php echo $current_tab; ?>" />
8
+ <?php settings_fields('swpm-settings-tab-' . $current_tab); ?>
9
+ <?php do_settings_sections('simple_wp_membership_settings'); ?>
10
+ <?php submit_button(); ?>
11
+ </form>
12
+ </div>
views/admin_tools_settings.php CHANGED
@@ -1,42 +1,42 @@
1
- <?php screen_icon( 'options-general' );?>
2
- <h1><?php echo SwpmUtils::_('Simple WP Membership::Settings')?></h1>
3
  <div class="wrap">
4
 
5
- <?php do_action("swpm-draw-tab"); ?>
6
 
7
- <div id="poststuff"><div id="post-body">
8
- <div class="postbox">
9
- <h3><label for="title"><?php echo SwpmUtils::_('Generate a Registration Completion link')?></label></h3>
10
- <div class="inside">
11
 
12
- <p><strong><?php echo SwpmUtils::_('You can manually generate a registration completion link here and give it to your customer if they have missed the email that was automatically sent out to them after the payment.')?></strong></p>
 
 
 
13
 
14
- <form action="" method="post">
15
- <table>
16
- <tr>
17
- <?php echo SwpmUtils::_('Generate Registration Completion Link')?>
18
- <br /><input type="radio" value="one" name="swpm_link_for" />For a Particular Member ID
19
- <input type="text" name="member_id" size="5" value="" />
20
- <br /> <strong> <?php echo SwpmUtils::_('OR')?> </strong>
21
- <br /><input type="radio" checked="checked" value="all" name="swpm_link_for" /> <?php echo SwpmUtils::_('For All Pending Registrations')?>
22
- </tr>
23
- <tr>
24
- <td><?php echo SwpmUtils::_('Registration Completion Links Will Appear Below:')?><br/>
25
- <?php foreach ($links as $key=>$link):?>
26
- <input type="text" size="100" readonly="readonly" name="link[<?php echo $key?>]" value="<?php echo $link;?>"/><br/>
27
- <?php endforeach;?>
28
- </td>
29
- </tr>
30
- <tr>
31
- <td><?php echo SwpmUtils::_('Send Registration Reminder Email too')?> <input type="checkbox" value="checked" name="swpm_reminder_email"></td>
32
- </tr>
33
- <tr>
34
- <td><input type="submit" name="submit" class="button-primary" value="<?php echo SwpmUtils::_('Submit')?>" /></td>
35
- </tr>
36
- </table>
37
- </form>
38
 
39
- </div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- </div></div><!-- end of poststuff and post-body -->
 
 
42
  </div><!-- end of wrap -->
 
 
1
  <div class="wrap">
2
 
3
+ <h2><?php echo SwpmUtils::_('Simple WP Membership::Settings') ?></h2>
4
 
5
+ <?php do_action("swpm-draw-tab"); ?>
 
 
 
6
 
7
+ <div id="poststuff"><div id="post-body">
8
+ <div class="postbox">
9
+ <h3><label for="title"><?php echo SwpmUtils::_('Generate a Registration Completion link') ?></label></h3>
10
+ <div class="inside">
11
 
12
+ <p><strong><?php echo SwpmUtils::_('You can manually generate a registration completion link here and give it to your customer if they have missed the email that was automatically sent out to them after the payment.') ?></strong></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ <form action="" method="post">
15
+ <table>
16
+ <tr>
17
+ <?php echo SwpmUtils::_('Generate Registration Completion Link') ?>
18
+ <br /><input type="radio" value="one" name="swpm_link_for" />For a Particular Member ID
19
+ <input type="text" name="member_id" size="5" value="" />
20
+ <br /> <strong> <?php echo SwpmUtils::_('OR') ?> </strong>
21
+ <br /><input type="radio" checked="checked" value="all" name="swpm_link_for" /> <?php echo SwpmUtils::_('For All Pending Registrations') ?>
22
+ </tr>
23
+ <tr>
24
+ <td><?php echo SwpmUtils::_('Registration Completion Links Will Appear Below:') ?><br/>
25
+ <?php foreach ($links as $key => $link): ?>
26
+ <input type="text" size="100" readonly="readonly" name="link[<?php echo $key ?>]" value="<?php echo $link; ?>"/><br/>
27
+ <?php endforeach; ?>
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <td><?php echo SwpmUtils::_('Send Registration Reminder Email too') ?> <input type="checkbox" value="checked" name="swpm_reminder_email"></td>
32
+ </tr>
33
+ <tr>
34
+ <td><input type="submit" name="submit" class="button-primary" value="<?php echo SwpmUtils::_('Submit') ?>" /></td>
35
+ </tr>
36
+ </table>
37
+ </form>
38
 
39
+ </div></div>
40
+
41
+ </div></div><!-- end of poststuff and post-body -->
42
  </div><!-- end of wrap -->
views/payments/admin_all_payment_transactions.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Renders the all payment transactions
3
+ ?>
4
+
5
+ <div style="background: #DDDDDD;border: 1px solid #CCCCCC;color: #383838;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
6
+ <p>
7
+ <?php echo SwpmUtils::_('All the payments/transactions of your members are recorded here.'); ?>
8
+ </p>
9
+ </div>
10
+
11
+ <div class="postbox">
12
+ <h3><label for="title">Search Transaction</label></h3>
13
+ <div class="inside">
14
+ <?php echo SwpmUtils::_('Search for a transaction by using email or name'); ?>
15
+ <br /><br />
16
+ <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
17
+ <input name="swpm_txn_search" type="text" size="40" value="<?php echo isset($_POST['swpm_txn_search']) ? $_POST['swpm_txn_search'] : ''; ?>"/>
18
+ <input type="submit" name="swpm_txn_search_btn" class="button" value="<?php echo SwpmUtils::_('Search'); ?>" />
19
+ </form>
20
+ </div></div>
21
+
22
+ <?php
23
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'classes/admin-includes/class.swpm-payments-list-table.php');
24
+ //Create an instance of our package class...
25
+ $payments_list_table = new SWPMPaymentsListTable();
26
+
27
+ //Check if an action was performed
28
+ if (isset($_REQUEST['action'])) { //Do list table form row action tasks
29
+ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete_txn') { //Delete link was clicked for a row in list table
30
+ $record_id = strip_tags($_REQUEST['id']);
31
+ $payments_list_table->delete_record($record_id);
32
+ $success_msg = '<div id="message" class="updated"><p><strong>';
33
+ $success_msg .= SwpmUtils::_('The selected entry was deleted!');
34
+ $success_msg .= '</strong></p></div>';
35
+ echo $success_msg;
36
+ }
37
+ }
38
+
39
+ //Fetch, prepare, sort, and filter our data...
40
+ $payments_list_table->prepare_items();
41
+ ?>
42
+ <form id="tables-filter" method="get" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
43
+ <!-- For plugins, we also need to ensure that the form posts back to our current page -->
44
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
45
+ <!-- Now we can render the completed list table -->
46
+ <?php $payments_list_table->display(); ?>
47
+ </form>
views/payments/admin_create_payment_buttons.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Render the create new payment button tab
3
+
4
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/payment-gateway/admin_paypal_buy_now_button.php');
5
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/payment-gateway/admin_paypal_subscription_button.php');
6
+
7
+ do_action('swpm_create_new_button_process_submission');//Addons can use this hook to save the data after the form submit then redirect to the "edit" interface of that newly created button.
8
+
9
+ ?>
10
+
11
+ <div style="background: #DDDDDD;border: 1px solid #CCCCCC;color: #383838;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
12
+ <p>
13
+ <?php echo SwpmUtils::_('You can create new payment button for your memberships using this interface.'); ?>
14
+ </p>
15
+ </div>
16
+
17
+ <?php
18
+ if (!isset($_REQUEST['swpm_button_type_selected'])) {
19
+ //Button type hasn't been selected. Show the selection option.
20
+ ?>
21
+ <div class="postbox">
22
+ <h3><label for="title"><?php echo SwpmUtils::_('Select Payment Button Type'); ?></label></h3>
23
+ <div class="inside">
24
+ <form action="" method="post">
25
+ <input type="radio" name="button_type" value="pp_buy_now" checked>PayPal Buy Now
26
+ <br />
27
+ <input type="radio" name="button_type" value="pp_subscription">PayPal Subscription
28
+ <br />
29
+ <?php
30
+ apply_filters('swpm_new_button_select_button_type', '');
31
+ ?>
32
+
33
+ <br />
34
+ <input type="submit" name="swpm_button_type_selected" class="button-primary" value="<?php echo SwpmUtils::_('Next'); ?>" />
35
+ </form>
36
+
37
+ </div>
38
+ </div><!-- end of .postbox -->
39
+ <?php
40
+ } else {
41
+ //Button type has been selected. Show the payment button configuration option.
42
+ //Fire the action hook. The addons can render the payment button configuration option as appropriate.
43
+ $button_type = strip_tags($_REQUEST['button_type']);
44
+ do_action('swpm_create_new_button_for_'.$button_type);
45
+ //The payment addons will create the button from then redirect to the "edit" interface of that button after save.
46
+
47
+ }
48
+ ?>
views/payments/admin_edit_payment_buttons.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Render the edit payment button tab
3
+
4
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/payment-gateway/admin_paypal_buy_now_button.php');
5
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'views/payments/payment-gateway/admin_paypal_subscription_button.php');
6
+
7
+ do_action('swpm_edit_payment_button_process_submission'); //Addons can use this hook to save the data after the form submit.
8
+ ?>
9
+
10
+ <div style="background: #DDDDDD;border: 1px solid #CCCCCC;color: #383838;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
11
+ <p>
12
+ <?php echo SwpmUtils::_('You can edit a payment button using this interface.'); ?>
13
+ </p>
14
+ </div>
15
+
16
+ <?php
17
+ //Fire the action hook. The addons can render the payment button edit interface
18
+ //Button type (button_type) and Button id (button_id) must be present in the REQUEST
19
+ $button_type = strip_tags($_REQUEST['button_type']);
20
+ $button_id = strip_tags($_REQUEST['button_id']);
21
+ do_action('swpm_edit_payment_button_for_' . $button_type, $button_id);
22
+
views/payments/admin_payment_buttons.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Render the all payment buttons tab
3
+ ?>
4
+
5
+ <div style="background: #DDDDDD;border: 1px solid #CCCCCC;color: #383838;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
6
+ <p>
7
+ <?php echo SwpmUtils::_('All the membership buttons that you created in the plugin are displayed here.'); ?>
8
+ </p>
9
+ </div>
10
+
11
+ <?php
12
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . 'classes/admin-includes/class.swpm-payment-buttons-list-table.php');
13
+ //Create an instance of our package class...
14
+ $payments_buttons_table = new SwpmPaymentButtonsListTable();
15
+
16
+ //Fetch, prepare, sort, and filter our data...
17
+ $payments_buttons_table->prepare_items();
18
+
19
+ ?>
20
+
21
+ <form id="swpm-payment-buttons-filter" method="post" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
22
+
23
+ <input type="hidden" name="page" value="" />
24
+ <!-- Now we can render the completed list table -->
25
+ <?php $payments_buttons_table->display(); ?>
26
+ </form>
27
+
28
+ <p>
29
+ <a href="admin.php?page=simple_wp_membership_payments&tab=create_new_button" class="button">Create New Button</a>
30
+ </p>
views/payments/admin_payment_settings.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+
3
+ <h2><?php echo SwpmUtils::_('Simple WP Membership::Settings') ?></h2>
4
+
5
+ <?php do_action("swpm-draw-tab"); ?>
6
+
7
+ <div id="poststuff"><div id="post-body">
8
+
9
+ <?php
10
+ global $wpdb;
11
+
12
+ if (isset($_POST['swpm_generate_adv_code'])) {
13
+ $paypal_ipn_url = SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL . '/?swpm_process_ipn=1';
14
+ $mem_level = trim($_POST['swpm_paypal_adv_member_level']);
15
+ $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "swpm_membership_tbl WHERE id !=1 AND id =%d", $mem_level);
16
+ $membership_level_resultset = $wpdb->get_row($query);
17
+ if ($membership_level_resultset) {
18
+ $pp_av_code = 'notify_url=' . $paypal_ipn_url . '<br /> ' . 'custom=subsc_ref=' . $mem_level;
19
+ echo '<div id="message" class="updated fade"><p>';
20
+ echo '<strong>Paste the code below in the "Add advanced variables" field of your PayPal button for membership level ' . $mem_level . '</strong>';
21
+ echo '<br /><br /><code>' . $pp_av_code . '</code>';
22
+ echo '</p></div>';
23
+ } else {
24
+ echo '<div id="message" class="updated fade"><p><strong>';
25
+ SwpmUtils::e('Error! The membership level ID (' . $mem_level . ') you specified is incorrect. Please check this value again.');
26
+ echo '</strong></p></div>';
27
+ }
28
+ }
29
+ ?>
30
+ <div class="postbox">
31
+ <h3><label for="title"><?php echo SwpmUtils::_('PayPal Integration Settings') ?></label></h3>
32
+ <div class="inside">
33
+
34
+ <p><strong><?php echo SwpmUtils::_('Generate the "Advanced Variables" Code for your PayPal button') ?></strong></p>
35
+
36
+ <form action="" method="post">
37
+ <?php echo SwpmUtils::_('Enter the Membership Level ID') ?>
38
+ <input type="text" value="" size="4" name="swpm_paypal_adv_member_level">
39
+ <input type="submit" value="<?php echo SwpmUtils::_('Generate Code') ?>" class="button-primary" name="swpm_generate_adv_code">
40
+ </form>
41
+
42
+ </div></div>
43
+
44
+ </div></div><!-- end of poststuff and post-body -->
45
+ </div><!-- end of wrap -->
views/payments/admin_payments_page.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $output = '';
3
+
4
+ $tab = isset($_GET['tab']) ? $_GET['tab'] : '';
5
+ ?>
6
+
7
+ <div class="wrap">
8
+
9
+ <h2><?php echo SwpmUtils::_('Simple Membership::Payments') ?></h2>
10
+
11
+ <div id="poststuff"><div id="post-body">
12
+
13
+ <h2 class="nav-tab-wrapper">
14
+ <a class="nav-tab <?php echo ($tab == '') ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_payments">Transactions</a>
15
+ <a class="nav-tab <?php echo ($tab == 'payment_buttons') ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_payments&tab=payment_buttons">Manage Payment Buttons</a>
16
+ <a class="nav-tab <?php echo ($tab == 'create_new_button') ? 'nav-tab-active' : ''; ?>" href="admin.php?page=simple_wp_membership_payments&tab=create_new_button">Create New Button</a>
17
+
18
+ <?php
19
+ if($tab == 'edit_button' ){//Only show the "edit button" tab when a button is being edited.
20
+ echo '<a class="nav-tab nav-tab-active" href="#">Edit Button</a>';
21
+ }
22
+ ?>
23
+ </h2>
24
+
25
+ <?php
26
+ switch ($tab) {
27
+ case 'payment_buttons':
28
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . '/views/payments/admin_payment_buttons.php');
29
+ break;
30
+ case 'create_new_button':
31
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . '/views/payments/admin_create_payment_buttons.php');
32
+ break;
33
+ case 'edit_button':
34
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . '/views/payments/admin_edit_payment_buttons.php');
35
+ break;
36
+ case 'all_txns':
37
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . '/views/payments/admin_all_payment_transactions.php');
38
+ break;
39
+ default:
40
+ include_once(SIMPLE_WP_MEMBERSHIP_PATH . '/views/payments/admin_all_payment_transactions.php');
41
+ break;
42
+ }
43
+ ?>
44
+
45
+ </div></div><!-- end of poststuff and post-body -->
46
+ </div><!-- end of .wrap -->
views/payments/payment-gateway/admin_paypal_buy_now_button.php ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* * ***************************************************************
3
+ * Render the new PayPal Buy now payment button creation interface
4
+ * ************************************************************** */
5
+ add_action('swpm_create_new_button_for_pp_buy_now', 'swpm_create_new_pp_buy_now_button');
6
+
7
+ function swpm_create_new_pp_buy_now_button() {
8
+ ?>
9
+
10
+ <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
11
+ <p>View the
12
+ <a target="_blank" href="https://simple-membership-plugin.com/create-paypal-buy-now-button-inside-the-simple-membership-plugin/">documentation</a>
13
+ to learn how to create a PayPal Buy Now payment button and use it.
14
+ </p>
15
+ </div>
16
+
17
+ <div class="postbox">
18
+ <h3><label for="title"><?php echo SwpmUtils::_('PayPal Buy Now Button Configuration'); ?></label></h3>
19
+ <div class="inside">
20
+
21
+ <form id="pp_button_config_form" method="post">
22
+ <input type="hidden" name="button_type" value="<?php echo strip_tags($_REQUEST['button_type']); ?>">
23
+ <input type="hidden" name="swpm_button_type_selected" value="1">
24
+
25
+ <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
26
+
27
+ <tr valign="top">
28
+ <th scope="row"><?php echo SwpmUtils::_('Button Title'); ?></th>
29
+ <td>
30
+ <input type="text" size="50" name="button_name" value="" required />
31
+ <p class="description">Give this membership payment button a name. Example: Gold membership payment</p>
32
+ </td>
33
+ </tr>
34
+
35
+ <tr valign="top">
36
+ <th scope="row"><?php echo SwpmUtils::_('Membership Level'); ?></th>
37
+ <td>
38
+ <select id="membership_level_id" name="membership_level_id">
39
+ <?php echo SwpmUtils::membership_level_dropdown(); ?>
40
+ </select>
41
+ <p class="description">Select the membership level this payment button is for.</p>
42
+ </td>
43
+ </tr>
44
+
45
+ <tr valign="top">
46
+ <th scope="row"><?php echo SwpmUtils::_('Payment Amount'); ?></th>
47
+ <td>
48
+ <input type="text" size="6" name="payment_amount" value="" required />
49
+ <p class="description">Enter payment amount. Example values: 10.00 or 19.50 or 299.95 etc (do not put currency symbol).</p>
50
+ </td>
51
+ </tr>
52
+
53
+ <tr valign="top">
54
+ <th scope="row"><?php echo SwpmUtils::_('Payment Currency'); ?></th>
55
+ <td>
56
+ <select id="payment_currency" name="payment_currency">
57
+ <option selected="selected" value="USD">US Dollars ($)</option>
58
+ <option value="EUR">Euros (€)</option>
59
+ <option value="GBP">Pounds Sterling (£)</option>
60
+ <option value="AUD">Australian Dollars ($)</option>
61
+ <option value="BRL">Brazilian Real (R$)</option>
62
+ <option value="CAD">Canadian Dollars ($)</option>
63
+ <option value="CNY">Chinese Yuan</option>
64
+ <option value="CZK">Czech Koruna</option>
65
+ <option value="DKK">Danish Krone</option>
66
+ <option value="HKD">Hong Kong Dollar ($)</option>
67
+ <option value="HUF">Hungarian Forint</option>
68
+ <option value="INR">Indian Rupee</option>
69
+ <option value="IDR">Indonesia Rupiah</option>
70
+ <option value="ILS">Israeli Shekel</option>
71
+ <option value="JPY">Japanese Yen (¥)</option>
72
+ <option value="MYR">Malaysian Ringgits</option>
73
+ <option value="MXN">Mexican Peso ($)</option>
74
+ <option value="NZD">New Zealand Dollar ($)</option>
75
+ <option value="NOK">Norwegian Krone</option>
76
+ <option value="PHP">Philippine Pesos</option>
77
+ <option value="PLN">Polish Zloty</option>
78
+ <option value="SGD">Singapore Dollar ($)</option>
79
+ <option value="ZAR">South African Rand (R)</option>
80
+ <option value="KRW">South Korean Won</option>
81
+ <option value="SEK">Swedish Krona</option>
82
+ <option value="CHF">Swiss Franc</option>
83
+ <option value="TWD">Taiwan New Dollars</option>
84
+ <option value="THB">Thai Baht</option>
85
+ <option value="TRY">Turkish Lira</option>
86
+ <option value="VND">Vietnamese Dong</option>
87
+ </select>
88
+ <p class="description">Select the currency for this payment button.</p>
89
+ </td>
90
+ </tr>
91
+
92
+ <tr valign="top">
93
+ <th scope="row"><?php echo SwpmUtils::_('Return URL'); ?></th>
94
+ <td>
95
+ <input type="text" size="100" name="return_url" value="" />
96
+ <p class="description">This is the URL the user will be redirected to after a successful payment. Enter the URL of your Thank You page here.</p>
97
+ </td>
98
+ </tr>
99
+
100
+ <tr valign="top">
101
+ <th scope="row"><?php echo SwpmUtils::_('PayPal Email'); ?></th>
102
+ <td>
103
+ <input type="text" size="50" name="paypal_email" value="" required />
104
+ <p class="description">Enter your PayPal email address. The payment will go to this PayPal account.</p>
105
+ </td>
106
+ </tr>
107
+
108
+ <tr valign="top">
109
+ <th scope="row"><?php echo SwpmUtils::_('Button Image URL'); ?></th>
110
+ <td>
111
+ <input type="text" size="100" name="button_image_url" value="" />
112
+ <p class="description">If you want to customize the look of the button using an image then enter the URL of the image.</p>
113
+ </td>
114
+ </tr>
115
+
116
+ </table>
117
+
118
+ <p class="submit">
119
+ <input type="submit" name="swpm_pp_buy_now_save_submit" class="button-primary" value="<?php echo SwpmUtils::_('Save Payment Data'); ?>" >
120
+ </p>
121
+
122
+ </form>
123
+
124
+ </div>
125
+ </div>
126
+ <?php
127
+ }
128
+
129
+ /*
130
+ * Process submission and save the new PayPal Buy now payment button data
131
+ */
132
+ add_action('swpm_create_new_button_process_submission', 'swpm_save_new_pp_buy_now_button_data');
133
+
134
+ function swpm_save_new_pp_buy_now_button_data() {
135
+ if (isset($_REQUEST['swpm_pp_buy_now_save_submit'])) {
136
+ //This is a PayPal buy now button save event. Process the submission.
137
+ //TODO - Do some basic validation check??
138
+ //Save the button data
139
+ $button_id = wp_insert_post(
140
+ array(
141
+ 'post_title' => strip_tags($_REQUEST['button_name']),
142
+ 'post_type' => 'swpm_payment_button',
143
+ 'post_content' => '',
144
+ 'post_status' => 'publish'
145
+ )
146
+ );
147
+
148
+ $button_type = strip_tags($_REQUEST['button_type']);
149
+ add_post_meta($button_id, 'button_type', $button_type);
150
+ add_post_meta($button_id, 'membership_level_id', strip_tags($_REQUEST['membership_level_id']));
151
+ add_post_meta($button_id, 'payment_amount', trim(strip_tags($_REQUEST['payment_amount'])));
152
+ add_post_meta($button_id, 'payment_currency', strip_tags($_REQUEST['payment_currency']));
153
+ add_post_meta($button_id, 'return_url', trim(strip_tags($_REQUEST['return_url'])));
154
+ add_post_meta($button_id, 'paypal_email', trim(strip_tags($_REQUEST['paypal_email'])));
155
+ add_post_meta($button_id, 'button_image_url', trim(strip_tags($_REQUEST['button_image_url'])));
156
+
157
+ //Redirect to the edit interface of this button with $button_id
158
+ //$url = admin_url() . 'admin.php?page=simple_wp_membership_payments&tab=edit_button&button_id=' . $button_id . '&button_type=' . $button_type;
159
+ //Redirect to the manager payment buttons interface
160
+ $url = admin_url() . 'admin.php?page=simple_wp_membership_payments&tab=payment_buttons';
161
+ SwpmMiscUtils::redirect_to_url($url);
162
+ }
163
+ }
164
+
165
+ /* * **********************************************************************
166
+ * End of new PayPal Buy now payment button stuff
167
+ * ********************************************************************** */
168
+
169
+
170
+ /* * ***************************************************************
171
+ * Render edit PayPal Buy now payment button interface
172
+ * ************************************************************** */
173
+ add_action('swpm_edit_payment_button_for_pp_buy_now', 'swpm_edit_pp_buy_now_button');
174
+
175
+ function swpm_edit_pp_buy_now_button() {
176
+
177
+ //Retrieve the payment button data and present it for editing.
178
+
179
+ $button_id = strip_tags($_REQUEST['button_id']);
180
+ $button_type = strip_tags($_REQUEST['button_type']);
181
+
182
+ $button = get_post($button_id); //Retrieve the CPT for this button
183
+
184
+ $membership_level_id = get_post_meta($button_id, 'membership_level_id', true);
185
+ $payment_amount = get_post_meta($button_id, 'payment_amount', true);
186
+ $payment_currency = get_post_meta($button_id, 'payment_currency', true);
187
+ $return_url = get_post_meta($button_id, 'return_url', true);
188
+ $paypal_email = get_post_meta($button_id, 'paypal_email', true);
189
+ $button_image_url = get_post_meta($button_id, 'button_image_url', true);
190
+ ?>
191
+ <div class="postbox">
192
+ <h3><label for="title"><?php echo SwpmUtils::_('PayPal Buy Now Button Configuration'); ?></label></h3>
193
+ <div class="inside">
194
+
195
+ <form id="pp_button_config_form" method="post">
196
+ <input type="hidden" name="button_type" value="<?php echo $button_type; ?>">
197
+
198
+ <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
199
+
200
+ <tr valign="top">
201
+ <th scope="row"><?php echo SwpmUtils::_('Button ID'); ?></th>
202
+ <td>
203
+ <input type="text" size="10" name="button_id" value="<?php echo $button_id; ?>" readonly required />
204
+ <p class="description">This is the ID of this payment button. It is automatically generated for you and it cannot be changed.</p>
205
+ </td>
206
+ </tr>
207
+
208
+ <tr valign="top">
209
+ <th scope="row"><?php echo SwpmUtils::_('Button Title'); ?></th>
210
+ <td>
211
+ <input type="text" size="50" name="button_name" value="<?php echo $button->post_title; ?>" required />
212
+ <p class="description">Give this membership payment button a name. Example: Gold membership payment</p>
213
+ </td>
214
+ </tr>
215
+
216
+ <tr valign="top">
217
+ <th scope="row"><?php echo SwpmUtils::_('Membership Level'); ?></th>
218
+ <td>
219
+ <select id="membership_level_id" name="membership_level_id">
220
+ <?php echo SwpmUtils::membership_level_dropdown($membership_level_id); ?>
221
+ </select>
222
+ <p class="description">Select the membership level this payment button is for.</p>
223
+ </td>
224
+ </tr>
225
+
226
+ <tr valign="top">
227
+ <th scope="row"><?php echo SwpmUtils::_('Payment Amount'); ?></th>
228
+ <td>
229
+ <input type="text" size="6" name="payment_amount" value="<?php echo $payment_amount; ?>" required />
230
+ <p class="description">Enter payment amount. Example values: 10.00 or 19.50 or 299.95 etc (do not put currency symbol).</p>
231
+ </td>
232
+ </tr>
233
+
234
+ <tr valign="top">
235
+ <th scope="row"><?php echo SwpmUtils::_('Payment Currency'); ?></th>
236
+ <td>
237
+ <select id="payment_currency" name="payment_currency">
238
+ <option value="USD" <?php echo ($payment_currency == 'USD') ? 'selected="selected"' : ''; ?>>US Dollars ($)</option>
239
+ <option value="EUR" <?php echo ($payment_currency == 'EUR') ? 'selected="selected"' : ''; ?>>Euros (€)</option>
240
+ <option value="GBP" <?php echo ($payment_currency == 'GBP') ? 'selected="selected"' : ''; ?>>Pounds Sterling (£)</option>
241
+ <option value="AUD" <?php echo ($payment_currency == 'AUD') ? 'selected="selected"' : ''; ?>>Australian Dollars ($)</option>
242
+ <option value="BRL" <?php echo ($payment_currency == 'BRL') ? 'selected="selected"' : ''; ?>>Brazilian Real (R$)</option>
243
+ <option value="CAD" <?php echo ($payment_currency == 'CAD') ? 'selected="selected"' : ''; ?>>Canadian Dollars ($)</option>
244
+ <option value="CNY" <?php echo ($payment_currency == 'CNY') ? 'selected="selected"' : ''; ?>>Chinese Yuan</option>
245
+ <option value="CZK" <?php echo ($payment_currency == 'CZK') ? 'selected="selected"' : ''; ?>>Czech Koruna</option>
246
+ <option value="DKK" <?php echo ($payment_currency == 'DKK') ? 'selected="selected"' : ''; ?>>Danish Krone</option>
247
+ <option value="HKD" <?php echo ($payment_currency == 'HKD') ? 'selected="selected"' : ''; ?>>Hong Kong Dollar ($)</option>
248
+ <option value="HUF" <?php echo ($payment_currency == 'HUF') ? 'selected="selected"' : ''; ?>>Hungarian Forint</option>
249
+ <option value="INR" <?php echo ($payment_currency == 'INR') ? 'selected="selected"' : ''; ?>>Indian Rupee</option>
250
+ <option value="IDR" <?php echo ($payment_currency == 'IDR') ? 'selected="selected"' : ''; ?>>Indonesia Rupiah</option>
251
+ <option value="ILS" <?php echo ($payment_currency == 'ILS') ? 'selected="selected"' : ''; ?>>Israeli Shekel</option>
252
+ <option value="JPY" <?php echo ($payment_currency == 'JPY') ? 'selected="selected"' : ''; ?>>Japanese Yen (¥)</option>
253
+ <option value="MYR" <?php echo ($payment_currency == 'MYR') ? 'selected="selected"' : ''; ?>>Malaysian Ringgits</option>
254
+ <option value="MXN" <?php echo ($payment_currency == 'MXN') ? 'selected="selected"' : ''; ?>>Mexican Peso ($)</option>
255
+ <option value="NZD" <?php echo ($payment_currency == 'NZD') ? 'selected="selected"' : ''; ?>>New Zealand Dollar ($)</option>
256
+ <option value="NOK" <?php echo ($payment_currency == 'NOK') ? 'selected="selected"' : ''; ?>>Norwegian Krone</option>
257
+ <option value="PHP" <?php echo ($payment_currency == 'PHP') ? 'selected="selected"' : ''; ?>>Philippine Pesos</option>
258
+ <option value="PLN" <?php echo ($payment_currency == 'PLN') ? 'selected="selected"' : ''; ?>>Polish Zloty</option>
259
+ <option value="SGD" <?php echo ($payment_currency == 'SGD') ? 'selected="selected"' : ''; ?>>Singapore Dollar ($)</option>
260
+ <option value="ZAR" <?php echo ($payment_currency == 'ZAR') ? 'selected="selected"' : ''; ?>>South African Rand (R)</option>
261
+ <option value="KRW" <?php echo ($payment_currency == 'KRW') ? 'selected="selected"' : ''; ?>>South Korean Won</option>
262
+ <option value="SEK" <?php echo ($payment_currency == 'SEK') ? 'selected="selected"' : ''; ?>>Swedish Krona</option>
263
+ <option value="CHF" <?php echo ($payment_currency == 'CHF') ? 'selected="selected"' : ''; ?>>Swiss Franc</option>
264
+ <option value="TWD" <?php echo ($payment_currency == 'TWD') ? 'selected="selected"' : ''; ?>>Taiwan New Dollars</option>
265
+ <option value="THB" <?php echo ($payment_currency == 'THB') ? 'selected="selected"' : ''; ?>>Thai Baht</option>
266
+ <option value="TRY" <?php echo ($payment_currency == 'TRY') ? 'selected="selected"' : ''; ?>>Turkish Lira</option>
267
+ <option value="VND" <?php echo ($payment_currency == 'VND') ? 'selected="selected"' : ''; ?>>Vietnamese Dong</option>
268
+ </select>
269
+ <p class="description">Select the currency for this payment button.</p>
270
+ </td>
271
+ </tr>
272
+
273
+ <tr valign="top">
274
+ <th scope="row"><?php echo SwpmUtils::_('Return URL'); ?></th>
275
+ <td>
276
+ <input type="text" size="100" name="return_url" value="<?php echo $return_url; ?>" />
277
+ <p class="description">This is the URL the user will be redirected to after a successful payment. Enter the URL of your Thank You page here.</p>
278
+ </td>
279
+ </tr>
280
+
281
+ <tr valign="top">
282
+ <th scope="row"><?php echo SwpmUtils::_('PayPal Email'); ?></th>
283
+ <td>
284
+ <input type="text" size="50" name="paypal_email" value="<?php echo $paypal_email; ?>" required />
285
+ <p class="description">Enter your PayPal email address. The payment will go to this PayPal account.</p>
286
+ </td>
287
+ </tr>
288
+
289
+ <tr valign="top">
290
+ <th scope="row"><?php echo SwpmUtils::_('Button Image URL'); ?></th>
291
+ <td>
292
+ <input type="text" size="100" name="button_image_url" value="<?php echo $button_image_url; ?>" />
293
+ <p class="description">If you want to customize the look of the button using an image then enter the URL of the image.</p>
294
+ </td>
295
+ </tr>
296
+
297
+ </table>
298
+
299
+ <p class="submit">
300
+ <input type="submit" name="swpm_pp_buy_now_edit_submit" class="button-primary" value="<?php echo SwpmUtils::_('Save Payment Data'); ?>" >
301
+ </p>
302
+
303
+ </form>
304
+
305
+ </div>
306
+ </div>
307
+ <?php
308
+ }
309
+
310
+ /*
311
+ * Process submission and save the edited PayPal Buy now payment button data
312
+ */
313
+ add_action('swpm_edit_payment_button_process_submission', 'swpm_edit_pp_buy_now_button_data');
314
+
315
+ function swpm_edit_pp_buy_now_button_data() {
316
+ if (isset($_REQUEST['swpm_pp_buy_now_edit_submit'])) {
317
+ //This is a PayPal buy now button edit event. Process the submission.
318
+ //TODO - Do some basic validation check?
319
+ //Update and Save the edited payment button data
320
+ $button_id = strip_tags($_REQUEST['button_id']);
321
+ $button_type = strip_tags($_REQUEST['button_type']);
322
+ $button_name = strip_tags($_REQUEST['button_name']);
323
+
324
+ $button_post = array(
325
+ 'ID' => $button_id,
326
+ 'post_title' => $button_name,
327
+ 'post_type' => 'swpm_payment_button',
328
+ );
329
+ wp_update_post($button_post);
330
+
331
+ update_post_meta($button_id, 'button_type', $button_type);
332
+ update_post_meta($button_id, 'membership_level_id', strip_tags($_REQUEST['membership_level_id']));
333
+ update_post_meta($button_id, 'payment_amount', trim(strip_tags($_REQUEST['payment_amount'])));
334
+ update_post_meta($button_id, 'payment_currency', strip_tags($_REQUEST['payment_currency']));
335
+ update_post_meta($button_id, 'return_url', trim(strip_tags($_REQUEST['return_url'])));
336
+ update_post_meta($button_id, 'paypal_email', trim(strip_tags($_REQUEST['paypal_email'])));
337
+ update_post_meta($button_id, 'button_image_url', trim(strip_tags($_REQUEST['button_image_url'])));
338
+
339
+ echo '<div id="message" class="updated fade"><p>Payment button data successfully updated!</p></div>';
340
+ }
341
+ }
342
+
343
+ /************************************************************************
344
+ * End of edit PayPal Buy now payment button stuff
345
+ ************************************************************************/
views/payments/payment-gateway/admin_paypal_subscription_button.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* * ***************************************************************
3
+ * Render the new PayPal Subscription payment button creation interface
4
+ * ************************************************************** */
5
+ add_action('swpm_create_new_button_for_pp_subscription', 'swpm_create_new_pp_subscription_button');
6
+
7
+ function swpm_create_new_pp_subscription_button() {
8
+ ?>
9
+ <div class="postbox">
10
+ <h3><label for="title"><?php echo SwpmUtils::_('PayPal Subscription Button Configuration'); ?></label></h3>
11
+ <div class="inside">
12
+
13
+ <?php
14
+ //TODO - Need to work on the subscription button fields
15
+ echo '<p>This feature will be coming in the next version of the plugin.</p>';
16
+ echo '</div></div>';
17
+ return;
18
+ ?>
19
+ <form id="pp_button_config_form" method="post">
20
+ <input type="hidden" name="button_type" value="<?php echo strip_tags($_REQUEST['button_type']); ?>">
21
+ <input type="hidden" name="swpm_button_type_selected" value="1">
22
+
23
+ <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
24
+
25
+ <tr valign="top">
26
+ <th scope="row"><?php echo SwpmUtils::_('Button Title'); ?></th>
27
+ <td>
28
+ <input type="text" size="50" name="button_name" value="" required />
29
+ <p class="description">Give this membership payment button a name. Example: Gold membership payment</p>
30
+ </td>
31
+ </tr>
32
+
33
+ <tr valign="top">
34
+ <th scope="row"><?php echo SwpmUtils::_('Membership Level'); ?></th>
35
+ <td>
36
+ <select id="membership_level_id" name="membership_level_id">
37
+ <?php echo SwpmUtils::membership_level_dropdown(); ?>
38
+ </select>
39
+ <p class="description">Select the membership level this payment button is for.</p>
40
+ </td>
41
+ </tr>
42
+
43
+ <tr valign="top">
44
+ <th scope="row"><?php echo SwpmUtils::_('Payment Amount'); ?></th>
45
+ <td>
46
+ <input type="text" size="6" name="payment_amount" value="" required />
47
+ <p class="description">Enter payment amount. Example values: 10.00 or 19.50 or 299.95 etc (do not put currency symbol).</p>
48
+ </td>
49
+ </tr>
50
+
51
+ <tr valign="top">
52
+ <th scope="row"><?php echo SwpmUtils::_('Payment Currency'); ?></th>
53
+ <td>
54
+ <select id="payment_currency" name="payment_currency">
55
+ <option selected="selected" value="USD">US Dollars ($)</option>
56
+ <option value="EUR">Euros (€)</option>
57
+ <option value="GBP">Pounds Sterling (£)</option>
58
+ <option value="AUD">Australian Dollars ($)</option>
59
+ <option value="BRL">Brazilian Real (R$)</option>
60
+ <option value="CAD">Canadian Dollars ($)</option>
61
+ <option value="CNY">Chinese Yuan</option>
62
+ <option value="CZK">Czech Koruna</option>
63
+ <option value="DKK">Danish Krone</option>
64
+ <option value="HKD">Hong Kong Dollar ($)</option>
65
+ <option value="HUF">Hungarian Forint</option>
66
+ <option value="INR">Indian Rupee</option>
67
+ <option value="IDR">Indonesia Rupiah</option>
68
+ <option value="ILS">Israeli Shekel</option>
69
+ <option value="JPY">Japanese Yen (¥)</option>
70
+ <option value="MYR">Malaysian Ringgits</option>
71
+ <option value="MXN">Mexican Peso ($)</option>
72
+ <option value="NZD">New Zealand Dollar ($)</option>
73
+ <option value="NOK">Norwegian Krone</option>
74
+ <option value="PHP">Philippine Pesos</option>
75
+ <option value="PLN">Polish Zloty</option>
76
+ <option value="SGD">Singapore Dollar ($)</option>
77
+ <option value="ZAR">South African Rand (R)</option>
78
+ <option value="KRW">South Korean Won</option>
79
+ <option value="SEK">Swedish Krona</option>
80
+ <option value="CHF">Swiss Franc</option>
81
+ <option value="TWD">Taiwan New Dollars</option>
82
+ <option value="THB">Thai Baht</option>
83
+ <option value="TRY">Turkish Lira</option>
84
+ <option value="VND">Vietnamese Dong</option>
85
+ </select>
86
+ <p class="description">Select the currency for this payment button.</p>
87
+ </td>
88
+ </tr>
89
+
90
+ <tr valign="top">
91
+ <th scope="row"><?php echo SwpmUtils::_('Return URL'); ?></th>
92
+ <td>
93
+ <input type="text" size="100" name="return_url" value="" />
94
+ <p class="description">This is the URL the user will be redirected to after a successful payment. Enter the URL of your Thank You page here.</p>
95
+ </td>
96
+ </tr>
97
+
98
+ <tr valign="top">
99
+ <th scope="row"><?php echo SwpmUtils::_('PayPal Email'); ?></th>
100
+ <td>
101
+ <input type="text" size="50" name="paypal_email" value="" required />
102
+ <p class="description">Enter your PayPal email address. The payment will go to this PayPal account.</p>
103
+ </td>
104
+ </tr>
105
+
106
+ <tr valign="top">
107
+ <th scope="row"><?php echo SwpmUtils::_('Button Image URL'); ?></th>
108
+ <td>
109
+ <input type="text" size="100" name="button_image_url" value="" />
110
+ <p class="description">If you want to customize the look of the button using an image then enter the URL of the image.</p>
111
+ </td>
112
+ </tr>
113
+
114
+ </table>
115
+
116
+ <p class="submit">
117
+ <input type="submit" name="swpm_pp_subscription_save_submit" class="button-primary" value="<?php echo SwpmUtils::_('Save Payment Data'); ?>" >
118
+ </p>
119
+
120
+ </form>
121
+
122
+ </div>
123
+ </div>
124
+ <?php
125
+ }
126
+
127
+ /*
128
+ * Process submission and save the new PayPal Subscription payment button data
129
+ */
130
+ add_action('swpm_create_new_button_process_submission', 'swpm_save_new_pp_subscription_button_data');
131
+
132
+ function swpm_save_new_pp_subscription_button_data() {
133
+ if (isset($_REQUEST['swpm_pp_subscription_save_submit'])) {
134
+ //This is a PayPal subscription button save event. Process the submission.
135
+ //TODO - Do some basic validation check??
136
+
137
+
138
+ //TODO Save the button data
139
+ // $button_id = wp_insert_post(
140
+ // array(
141
+ // 'post_title' => strip_tags($_REQUEST['button_name']),
142
+ // 'post_type' => 'swpm_payment_button',
143
+ // 'post_content' => '',
144
+ // 'post_status' => 'publish'
145
+ // )
146
+ // );
147
+ //
148
+ // $button_type = strip_tags($_REQUEST['button_type']);
149
+ // add_post_meta($button_id, 'button_type', $button_type);
150
+ // add_post_meta($button_id, 'membership_level_id', strip_tags($_REQUEST['membership_level_id']));
151
+ // add_post_meta($button_id, 'payment_amount', trim(strip_tags($_REQUEST['payment_amount'])));
152
+ // add_post_meta($button_id, 'payment_currency', strip_tags($_REQUEST['payment_currency']));
153
+ // add_post_meta($button_id, 'return_url', trim(strip_tags($_REQUEST['return_url'])));
154
+ // add_post_meta($button_id, 'paypal_email', trim(strip_tags($_REQUEST['paypal_email'])));
155
+ // add_post_meta($button_id, 'button_image_url', trim(strip_tags($_REQUEST['button_image_url'])));
156
+ //
157
+ // //Redirect to the edit interface of this button with $button_id
158
+ // $url = admin_url() . 'admin.php?page=simple_wp_membership_payments&tab=edit_button&button_id=' . $button_id . '&button_type=' . $button_type;
159
+ // SwpmMiscUtils::redirect_to_url($url);
160
+ }
161
+ }
162
+
163
+ /* * **********************************************************************
164
+ * End of new PayPal subscription payment button stuff
165
+ * ********************************************************************** */
views/payments/payment-gateway/paypal_button_shortcode_view.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_filter('swpm_payment_button_shortcode_for_pp_buy_now', 'swpm_render_pp_buy_now_button_sc_output', 10, 2);
4
+
5
+ function swpm_render_pp_buy_now_button_sc_output($button_code, $args) {
6
+
7
+ $button_id = isset($args['id']) ? $args['id'] : '';
8
+ if (empty($button_id)) {
9
+ return '<p style="color: red;">Error! swpm_render_pp_buy_now_button_sc_output() function requires the button ID value to be passed to it.</p>';
10
+ }
11
+
12
+ $settings = SwpmSettings::get_instance();
13
+ $button_cpt = get_post($button_id); //Retrieve the CPT for this button
14
+
15
+ $membership_level_id = get_post_meta($button_id, 'membership_level_id', true);
16
+ $paypal_email = get_post_meta($button_id, 'paypal_email', true);
17
+ $payment_amount = get_post_meta($button_id, 'payment_amount', true);
18
+ if(!is_numeric($payment_amount)){
19
+ return '<p style="color: red;">Error! The payment amount value of the button must be a numeric number. Example: 49.50 </p>';
20
+ }
21
+ $payment_amount = round($payment_amount, 2);//round the amount to 2 decimal place.
22
+ $payment_currency = get_post_meta($button_id, 'payment_currency', true);
23
+
24
+ $sandbox_enabled = $settings->get_value('enable-sandbox-testing');
25
+ $notify_url = SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL . '/?swpm_process_ipn=1';
26
+ $return_url = get_post_meta($button_id, 'return_url', true);
27
+ if(empty($return_url)){
28
+ $return_url = SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL;
29
+ }
30
+ $cancel_url = SIMPLE_WP_MEMBERSHIP_SITE_HOME_URL;
31
+
32
+ $custom_field_value = 'subsc_ref=' . $membership_level_id;
33
+ $user_ip = $_SERVER['REMOTE_ADDR'];
34
+ $custom_field_value .= '&user_ip='.$user_ip;
35
+ if(SwpmMemberUtils::is_member_logged_in()){
36
+ $custom_field_value .= '&swpm_id='.SwpmMemberUtils::get_logged_in_members_id();
37
+ }
38
+ $custom_field_value = apply_filters('swpm_custom_field_value_filter', $custom_field_value);
39
+
40
+ /* === PayPal Buy Now Button Form === */
41
+ $output = '';
42
+ $output .= '<div class="swpm-button-wrapper swpm-pp-buy-now-wrapper">';
43
+ if ($sandbox_enabled) {
44
+ $output .= '<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">';
45
+ } else {
46
+ $output .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">';
47
+ }
48
+
49
+ $output .= '<input type="hidden" name="cmd" value="_xclick" />';
50
+ $output .= '<input type="hidden" name="charset" value="utf-8" />';
51
+ $output .= '<input type="hidden" name="bn" value="TipsandTricks_SP" />';
52
+ $output .= '<input type="hidden" name="business" value="' . $paypal_email . '" />';
53
+ $output .= '<input type="hidden" name="amount" value="'.$payment_amount.'" />';
54
+ $output .= '<input type="hidden" name="currency_code" value="'.$payment_currency.'" />';
55
+ $output .= '<input type="hidden" name="item_number" value="'.$button_id.'" />';
56
+ $output .= '<input type="hidden" name="item_name" value="' . htmlspecialchars($button_cpt->post_title) . '" />';
57
+
58
+ $output .= '<input type="hidden" name="no_shipping" value="1" />';//Do not prompt for an address
59
+
60
+ $output .= '<input type="hidden" name="notify_url" value="' . $notify_url . '" />';
61
+ $output .= '<input type="hidden" name="return" value="' . $return_url . '" />';
62
+ $output .= '<input type="hidden" name="cancel_return" value="' . $cancel_url . '" />';
63
+
64
+ $output .= '<input type="hidden" name="custom" value="' . $custom_field_value . '" />';
65
+
66
+ $button_image_url = get_post_meta($button_id, 'button_image_url', true);
67
+ if (!empty($button_image_url)) {
68
+ $output .= '<input type="image" src="' . $button_image_url . '" class="swpm-buy-now-button-submit" alt="' . SwpmUtils::_('Buy Now') . '"/>';
69
+ } else {
70
+ $button_text = (isset($args['button_text']))? $args['button_text'] : SwpmUtils::_('Buy Now');
71
+ $output .= '<input type="submit" class="swpm-buy-now-button-submit" value="' . $button_text . '" />';
72
+ }
73
+
74
+ $output .= '</div>'; //End .swpm_button_wrapper
75
+
76
+ return $output;
77
+ }