Coder Social home page Coder Social logo

strangerstudios / pmpro-multiple-memberships-per-user Goto Github PK

View Code? Open in Web Editor NEW
32.0 11.0 36.0 309 KB

Allow users to checkout for and hold multiple memberships at the same time when using Paid Memberships Pro.

Home Page: https://www.paidmembershipspro.com/add-ons/multiple-memberships-per-user/

PHP 83.06% CSS 3.70% JavaScript 13.24%
wordpress-plugin wordpress paid-memberships-pro strangerstudios-product

pmpro-multiple-memberships-per-user's Introduction

=== Paid Memberships Pro: Multiple Memberships per User ===
Contributors: strangerstudios
Tags: pmpro, paid memberships pro, members, memberships, mmpu
Requires at least: 5.2
Tested up to: 6.2
Stable tag: 0.8.4

Updates the core Paid Memberships Pro plugin to allow users to have multiple memberships at the same time.

== Description ==

IMPORTANT: This plugin is considered to be in "beta" status. Use at your own risk. In particular, almost all of the
other PMPro add ons that adjust the checkout process, membership pricing, user subscriptions, or perform actions when
users change membership levels will NOT currently work as you might expect with this plugin active.

Specifically, most PMPro add ons assume that users will only have one membership level at a time and
don't "know what to do" when users have multiple levels or cancel multiple levels at once. We will be updating
our add ons over time to support MMPU and will add notices here and on our website when we do.

== Installation ==

1. Upload the `pmpro-multiple-memberships-per-user` folder to the `/wp-content/plugins/` directory.
1. Activate the plugin through the 'Plugins' menu in WordPress.

== Changelog ==
= 0.8.4 - 2023-06-14 =
* BUG FIX: Added additional check to prevent JavaScript from loading on pages other than the checkout page.
* REFACTOR: Added version to Checkout page template to avoid outdated template warnings in PMPro v2.11+

= 0.8.3 - 2023-01-10 =
* ENHANCEMENT: Moved "Group" setting on "Edit Level" page to the "General Information" section.
* BUG FIX: Fixed issue where the "Group" setting was not being saved when creating a new level.
* BUG FIX: Fixed dragging and dropping levels on the "Levels" settings page.
* BUG FIX: Fixed issue where admin checkout emails would not be sent.

= 0.8.2 - 2022-12-02 =
* BUG FIX/ENHANCEMENT: Fixed cases where the wrong text domain was used, which should improve localization efforts.
* BUG FIX/ENHANCEMENT: Fixed notices on the confirmation page.
* BUG FIX/ENHANCEMENT: Fixed warning on the checkout page when no level was passed in.
* BUG FIX/ENHANCEMENT: Added back functionality for the "Send the user an email about this change" and "Cancel this user's subscription at the gateway" checkboxes when removing their membership level via the WP admin. There are still issues RE what's expected email-wise when changing many levels from the edit user page.
* BUG FIX/ENHANCEMENT: Updated to use the new cache system for pmpro_getAllLevels, which improves performance of some pages.
* BUG FIX: Fixed issue where checkout would fail when requiring billing fields at checkout with Stripe.
* BUG FIX: Fixed issue where levels were not showing up correctly when adding/editing/copying from the Memberships -> Settings -> Levels page in the dashboard.
* BUG FIX: Fixed issues where our template parsing REGEX was breaking JavaScript with some themes.

= 0.8.1 - 2021-09-24 =
* BUG FIX: Now showing the TOS consent history on the edit user page. This was hidden before when MMPU was active. (Thanks @femiyb on GitHub)
* BUG FIX: Fixed issues with using recaptcha while MMPU is active. (Thanks, Mehran Aziz)

= 0.8 - 2021-02-25 =
* FEATURE: Now supporting non-Stripe/Braintree gateways. You cannot checkout for multiple levels at once with these gateways, but you can checkout for one level at a time and have MMPU.
* ENHANCEMENT: Added a pmprommpu_disable_mmpu_levels_page filter. Set the callback to return true to use the default PMPro levels page template instead.
* BUG FIX/ENHANCEMENT: If only checking out for 1 level, the default level cost text and expiration functions are used. This avoids issues with some PMPro Add ons that affect the cost text.
* BUG FIX/ENHANCEMENT: Fixed the wording of the Save button in the edit group modal.
* BUG FIX: Fixed JS code that squeezes the Add Group button into place on the level settings page.
* BUG FIX: Fixed issues when selecting multiple levels from the MMPU levels page.

= 0.7 - 2020-09-01 =
* BUG FIX: Setting jQuery Migrate as a dependency to avoid issues with WP 5.5+.
* BUG FIX/ENHANCEMENT: The Members List table columns now show all levels and level ids.

= 0.6.5 - 2020-05-29 =
* BUG FIX: Fixed issues with cancelling individual levels.
* BUG FIX: Deleting the user levels cache after a user's levels are updated on the edit user page.
* BUG FIX/ENHANCEMENT: Added the "pmpro_after_membership_level_profile_fields" hook. Core PMPro has this and other add ons and code rely on it. (Thanks, Frank Fava)
* BUG FIX/ENHANCEMENT: Localized strings in JavaScript files and updated French translations.

= 0.6.4 - 2020-05-01 =
* BUG FIX: Fixed issue where expiration dates weren't set correctly when using PMPro WooCommerce.
* BUG FIX: Fixed a fatal error when PMPro was not activated.
* BUG FIX: Avoiding warnings when no level param is set on the checkout page.
* ENHANCEMENT: Adding a 0 to the front of the version number to avoid issues with version control tags/etc.

= .6.3 - 2019-11-22 =
* BUG FIX: Fixed issue where dates could save incorrectly with WP 5.3+.

= .6.2 - 2019-10-18 =
* BUG FIX: No filter pmpro_require_billing so payment fields will show up if the first level passed into the checkout page is free. We still need an update in core PMPro check the pmpro_require_billing filter instead of just the first level when deciding to enqueue gateway JavaScript.

= .6.1 - 2019-09-16 =
* BUG FIX: The TOS field will autocheck if it was checked before form submission. Also showing a second message box at the bottom of the form now.

= .6 - 2019-09-13 =
* BUG FIX/ENHANCEMENT: Checkout page updated to use table-free layout and support PMPro v2.1.
* BUG FIX: Now correctly sending the checkout_free_admin email for free checkouts.
* BUG FIX: Avoiding warnings during checkout due to how variables are not cast in PHP 7.1.

= .5.1 =
* BUG FIX: Fixed bug when setting expiration dates for new levels added on the profile page.

= .5 =
* BUG FIX: Fixed fatal errors when running PMPro 2.0+.
* BUG FIX: Fixed fatal errors when PMPro is deactivated.
* BUG FIX/ENHANCEMENT: Added a check for "orphaned" levels with no group. If found, they are inserted into the first available group.
* ENHANCEMENT: Updated membership levels table styles to match PMPro 2.0.
* NOTE: There are known issues with dragging levels from one group to another. We are working on a fix. You can still edit a level's group by editing the level.

= .4.1 =
* BUG FIX: Updated pmprommpu_get_levels_from_latest_checkout() in a couple places to also consider orders with "pending" status. This fixes issues with MMPU and the Pay by Check addon.

= .4 =
* NOTE: Skipped up to version .4 to match version increments from before we added the readme.
* BUG FIX: Fixed some warnings.
* BUG FIX: pmprommpu_addMembershipLevel() now accepts level arrays as well as objects.
* BUG FIX: Removed unnecessary backticks from SQL that would break the query on some MySQL setups.
* BUG FIX: Fixed broken delete button.

= .1.1 =
* BUG/FIX: Fixed warnings when adding a level to a user through the edit user page in the dashboard.

= .1 =
* First version.

pmpro-multiple-memberships-per-user's People

Contributors

andrewlimaza avatar dchenk avatar dparker1005 avatar eighty20results avatar femiyb avatar github-actions[bot] avatar ideadude avatar ipokkel avatar jarrydlong avatar kimcoleman avatar mehranaziz avatar messica avatar mircobabini avatar pbrocks avatar sjolshagen avatar square-lines avatar stcox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pmpro-multiple-memberships-per-user's Issues

Conflict with WooCommerce

Hello!

Installed MMPU and WooCommerce and once I visit the checkout page the AJAX from WooCommerce to update orders, calculate taxes, change address, change payment methods... is not working. Also some styles didn't load properly in WooCoommerce pages.

I deactivated all plugins and reactivated only PMPro (1.9.4.4) + MMPU (.4) + WooCommerce (3.3.5) and confirmed.

Could you guys check please?

Direct link to level

Hi,
When linking directly to a level (as in https:/.../?level=3 ) it creates an error.log with rows like

--
PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/includes/overrides.php on line 211

Request: Make the add-on translatable

The plugin currently uses the old Paid Memberships Pro translation domain slugs and has 2 different slugs for MMPU specific strings. This needs to be cleaned up before the plugin transitions to a releasable version. The plugin should also be made translatable.

Get total price of some orders

Hi everybody,
I have a custom gateway, And there is little problem there.
When i wanna to pay with that gateway, It only loads 1 price of last membership.
Because that plugin has something called $Amount = intval($morder->subtotal);
and $morder = new MemberOrder($oid);.
So how can i define to load subtotal of all orders?

I checked this problem even with 2 different groups, Noting different.

My gateway codes is attached :
index.php.zip

Thanks!

PHP Fatal error: Class 'MemberOrder' not found

Hello!

We use Paid Memberships Pro v1.9.5.3 on WordPress Multisite, activated to a Single Network Site. We tried to use the Paid Memberships Pro: Multiple Memberships per User .4
Аn error occurs during activation: PHP Fatal error: Class 'MemberOrder' not found in .../wp-content/plugins/pmpro-multiple-memberships-per-user-master/includes/invoice.php on line 5

Fatal error when activating plugin

Hi, I can't activate the plugin any more, I've got this error:
PHP Fatal error: Class 'MemberOrder' not found in /var/www/html/site/wp-content/plugins/pmpro-multiple-memberships-per-user/includes/invoice.php on line 5
Could it depends on plugins load order?

Can’t add users to multiple levels

When I try to manually add a user to multiple groups (under Users in the dashboard), I’m able to select a Group but the Membership Level dropdown doesn’t populate.

The issue persists whether the group is set to only allow one or multiple levels to be selected at any one time.

Is this a configuration issue or a bug?

membership-issue

Italian translation.

I would like to have the possibility to translate the plugin into Italian, but it does not contain the languages folder. How can I do?

Thanks.

Is anyone still maintaining this project?

I'm concerned that there are several serious issues that haven't been address and pull requests that haven't been reviewed in a long time. Is anyone still maintaining this project? If not, please announce this on the main README so that someone else can fork the repo and take over the stewardship. Or please add me as a maintainer/collaborator of the repo. I'd like to help improve and update the code. Thank you.

wrong expiration date

Hi all :)

First, I will describe the behavior without this addition, only PMP.
There is Renew option, eg if I have a course that expires after 5 days, when I buy the level again, it will expire after 10 days. The days will be summed up.

I wanted to use it with this add on. If I buy a course again, on the expiry date I have only 5 days (it sholud be 10days). It looks like the same my level is doubled. If I click on Cacnel, it removes my one of two same levels and the expiration date changes to 10 days, so days were summed up, but are "at the bottom". Can you make that the most important expiration date is like at the very top?

Batch Stripe transactions

Multiple one-time Stripe transactions processed in the same checkout are handled as separate transactions, which leads to issues when one charge is rejected but the others succeed. Also leads to the stripe library being pulled in multiple times.

Cancellation Issue

When I cancel a specific level, it seems to cancel all level but that one.

If there is only one level to cancel, it fails. Not sure if the subscription is cancelled. But the user retains the membership level.

Happening since at least v1.9.5.

PayPal compatibility

The main reason that PayPal Express (and other non-Stripe/Braintree gateways) are not compatible with MMPU is that PayPal doesn't allow creating multiple subscriptions at the same time. To allow users to use this gateway safely alongside MMPU, the following changes should be made:

  1. Remove restriction from editing levels on backend levels page, and instead show a more accurate notice
  2. Use JavaScript to only allow users to select one level to purchase at a time on the levels page if not using Stripe or Braintree. Maybe show users a notice as well if they try to select more than one
  3. Only allow one level to be passed into the checkout page to prevent users from checking out for multiple memberships at the same time if not using Stripe or Braintree

After this is done, we can then get smarter about these processes since we only need to restrict multiple levels with subscription payments; free and one-time payments are fine.

Billing Page only grabbing earliest level

This can be an issue when a user checks out for a free level and then paid levels, and wants to change billing info for those new paid levels. Instead of being able to do so, they receive the error "This subscription is not recurring. So you don't need to update your billing information".

Solutions to this include showing how to update the billing info for each level that they are subscribed to on the same page, or allowing a level_id to be passed in through the URL for the level that should have its billing info updated.

Payment Process not showing

Replication Steps:
I suppose you have two groups and any number of levels and Group names are Group A and Group B. I will be referring with same here too.

  1. Create a Free Level in Group A
  2. Now create a paid level in Group B
  3. Do the checkout by selecting Free level from Group A and Paid Level from Group B
  4. And will be able to replicate

not able to proccedd with checkout

checkout button coming disbaled and nothing is happening on selection of multiple levels. Can anyone please help me why this is happening.

TypeError: jQuery(...).validateCreditCard

Hi. I've got the error below in browser console that breaks other scripts on my site.

Uncaught TypeError: jQuery(...).validateCreditCard is not a function
    at HTMLDocument.<anonymous> (pmprommpu-checkout.js?ver=.5:152)
    at i (jquery.js?ver=1.12.4:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
    at Function.ready (jquery.js?ver=1.12.4:2)
    at HTMLDocument.K (jquery.js?ver=1.12.4:2)

When I comment this function then I can't buy two membership levels at once.
Using WordPress 4.9.9 and the latest Paid Membership Pro version.

Please help.

P.S. I use this plugin with WooCommerce Paid Membership Pro addon so I do not need card's validation.

Maybe I need updated version of jQuery?...

@dchenk maybe you can help? Thanks.

Conflicting with builder / display issues / Thrive leads

The plugin seems to be conflicting/causing front end issues with front end builders - SiteOrigin Panels / Thrive Architect / Thrive Leads. Once the plugin is activated Thrive Lead widgets are no longer displayed / visible and some sizing issues.

When the plugin has been deactivated website displays correctly again.

BUG: membership information on Member Admin Site missing

if a user holds more than one memberhip, the memberships are displayed comma separated in one column. BUT: only for one memberhips the level id, start date, end date or locked information are shown. --> All information for all memberships per user must be displays as a list in the backend of PMPRO.

Invalid arguments

Hi,
Nothing is shown on the webpage but it creates an error log with repeated lines:

[28-Jan-2019 15:51:00 UTC] PHP Warning: implode(): Invalid arguments passed in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/pages/checkout.php on line 35
[28-Jan-2019 15:51:00 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/includes/overrides.php on line 208
[28-Jan-2019 15:51:00 UTC] PHP Warning: Invalid argument supplied for foreach() in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/includes/overrides.php on line 209
[28-Jan-2019 15:51:00 UTC] PHP Warning: Invalid argument supplied for foreach() in /home2/nvqvbykw/public_html/wp-content/plugins/paid-memberships-pro/includes/functions.php on line 406
[29-Jan-2019 08:49:39 UTC] PHP Warning: implode(): Invalid arguments passed in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/pages/checkout.php on line 35
[29-Jan-2019 08:49:39 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/includes/overrides.php on line 208
[29-Jan-2019 08:49:39 UTC] PHP Warning: Invalid argument supplied for foreach() in /home2/nvqvbykw/public_html/wp-content/plugins/pmpro-multiple-memberships-per-user-master/includes/overrides.php on line 209
[29-Jan-2019 08:49:39 UTC] PHP Warning: Invalid argument supplied for foreach() in /home2/nvqvbykw/public_html/wp-content/plugins/paid-memberships-pro/includes/functions.php on line 406

membership paid failed with non membership product

Hello,

  1. On multisite, and test it on a subsite: shop.mysite.com
  2. Buddypress is networkly activated, and the BP main site is assigned to a subsite: forums.mysite.com
    3.the following add-on are activated:

Paid Memberships
Paid Memberships Pro - BuddyPress Add OnSettings
Paid Memberships Pro - Multiple Memberships per User
Paid Memberships Pro - WooCommerce Add On

  1. Membership products are paid by woo commerce gateway since there are some physical products on our shop site.

  2. basically, it work well, but if multiple memberships level product is paid with non membership product together, the paid membership level paid might be failed, and the paid users will not show up in membership users list.

PS:

Specifically, most PMPro add ons assume that users will only have one membership level at a time and
don't "know what to do" when users have multiple levels or cancel multiple levels at once. We will be updating
our add ons over time to support MMPU and will add notices here and on our website when we do.

I would like to explain how I used these plugin on operation:

  1. BP is networkly activated, but with B way: https://codex.buddypress.org/getting-started/installation-in-wordpress-multisite/

BP mainsite is assigned to the sub site url: forums.mysite.com

2.woocomerce site: shop.mysite.com

once a user pay for a WOO product WHICH IS ASSIGNED AS MEMEBERSHIP attribute no matter it is a physical or no physical product, it will be auto added to THE SPECIFIC product group on community or forum site.

  1. Multiple memberships per user

In most of case, for more discount benefit, like more pay more cheep promotion, a user pay for more than one products ONCE which might be WITH MEMBERSHIP products OR may not membership product, or may membership and non membership product together.

So, assume that users will only have one membership level at a time is really not practical.

UX Suggestions from Support Member

A support member has requested the following UX improvements:

#1 The “Add” button text should be updated according to what is selected.
For eg. I have 2 current levels selected. The button should show “Current” instead of “Add”.
If I unselect one of them, it should be “Remove” instead of “Add”.
It is confusing to the user.

#2 Under the “Membership Selections”, the list of levels should be presented in bullet/ul form instead of in commas. It is hard for user to read in cases where my product names are all very long.

Need to break user level cache after direct SQL updates

For example, a user had an issue where they would try to update a user's expiration date on the user's profile, but the change was later overwritten by another add-on which saw a cached value of the level, thereby resetting the expiration date to the default.

This was resolved by adding wp_cache_delete( 'user_' . $user_id . '_levels', 'pmpro' ); at the end of the pmprommpu_membership_level_profile_fields_update() function:

/**
* Handle updates
* add_action( 'personal_options_update', 'pmprommpu_membership_level_profile_fields_update' );
* add_action( 'edit_user_profile_update', 'pmprommpu_membership_level_profile_fields_update' );
*/
function pmprommpu_membership_level_profile_fields_update() {
//get the user id
global $wpdb, $current_user;
wp_get_current_user();
if(!empty($_REQUEST['user_id'])) {
$user_id = $_REQUEST['user_id'];
} else {
$user_id = $current_user->ID;
}
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
if(!current_user_can($membership_level_capability))
return false;
// OK. First, we're going to remove them from any levels that they should be dropped from - and keep an array of the levels we're dropping (so we don't adjust expiration later)
$droppedlevels = array();
$old_levels = pmpro_getMembershipLevelsForUser($user_id);
if(array_key_exists('remove_levels_id', $_REQUEST)) {
foreach($_REQUEST['remove_levels_id'] as $arraykey => $leveltodel) {
// $subscription_id = -1;
// foreach($old_levels as $checklevel) {
// if($checklevel->id == $leveltodel) {
// $subscription_id = $checklevel->subscription_id;
// break;
// }
// }
// $wpdb->query("UPDATE $wpdb->pmpro_memberships_users SET status ='admin_cancelled', enddate ='".current_time('mysql')."' WHERE id=$subscription_id");
// if(is_array($_REQUEST['cancel_subscription']) && array_key_exists($arraykey, $_REQUEST['cancel_subscription']) && !empty($_REQUEST['cancel_subscription'][$arraykey])) {
// $other_order_ids = $wpdb->get_col("SELECT id FROM $wpdb->pmpro_membership_orders WHERE user_id = '" . $user_id . "' AND status = 'success' AND membership_id = $leveltodel ORDER BY id DESC");
//
// foreach($other_order_ids as $order_id)
// {
// $c_order = new MemberOrder($order_id);
// $c_order->cancel();
// }
// }
// //email to admin
// $pmproemail = new PMProEmail();
// $pmproemail->sendAdminChangeAdminEmail(get_userdata($user_id));
//
// //send email
// if(is_array($_REQUEST['send_admin_change_email']) && array_key_exists($arraykey, $_REQUEST['send_admin_change_email']) && !empty($_REQUEST['send_admin_change_email'][$arraykey])) {
// //email to member
// $pmproemail = new PMProEmail();
// $pmproemail->sendAdminChangeEmail(get_userdata($user_id));
// }
pmpro_cancelMembershipLevel($leveltodel, $user_id, 'admin_cancelled');
$droppedlevels[] = $leveltodel;
}
}
// Next, let's update the expiration on any existing levels - as long as the level isn't in one of the ones we dropped them from.
if(array_key_exists('expires', $_REQUEST)) {
foreach($_REQUEST['expires'] as $expkey => $doesitexpire) {
$thislevel = $_REQUEST['membership_levels'][$expkey];
if(!in_array($thislevel, $droppedlevels)) { // we don't change expiry for a level we've dropped.
if(!empty($doesitexpire)) { // we're going to expire.
//update the expiration date
$expiration_date = intval($_REQUEST['expires_year'][$expkey]) . "-" . str_pad(intval($_REQUEST['expires_month'][$expkey]), 2, "0", STR_PAD_LEFT) . "-" . str_pad(intval($_REQUEST['expires_day'][$expkey]), 2, "0", STR_PAD_LEFT);
$wpdb->update(
$wpdb->pmpro_memberships_users,
array( 'enddate' => $expiration_date ),
array(
'status' => 'active',
'membership_id' => $thislevel,
'user_id' => $user_id ), // Where clause
array( '%s' ), // format for data
array( '%s', '%d', '%d' ) // format for where clause
);
// $wpdb->query("UPDATE $wpdb->pmpro_memberships_users SET enddate = '" . $expiration_date . "' WHERE status = 'active' AND membership_id = '" . intval($thislevel) . "' AND user_id = '" . $user_id . "' LIMIT 1");
} else { // No expiration for me!
$wpdb->update(
$wpdb->pmpro_memberships_users,
array( 'enddate' => NULL ),
array(
'status' => 'active',
'membership_id' => $thislevel,
'user_id' => $user_id
),
array( NULL ),
array( '%s', '%d', '%d' )
);
// $wpdb->query("UPDATE $wpdb->pmpro_memberships_users SET enddate = NULL WHERE status = 'active' AND membership_id = '" . intval($thislevel) . "' AND user_id = '" . $user_id . "' LIMIT 1");
}
}
}
}
// Finally, we'll add any new levels requested. First, we'll try it without forcing, and then if need be, we'll force it (but then we'll know to give a warning about it.)
if(array_key_exists('new_levels_level', $_REQUEST)) {
$hadtoforce = false;
$curlevels = pmpro_getMembershipLevelsForUser($user_id); // have to do it again, because we've made changes since above.
$curlevids = array();
foreach($curlevels as $thelev) { $curlevids[] = $thelev->ID; }
foreach($_REQUEST['new_levels_level'] as $newkey => $leveltoadd) {
if(! in_array($leveltoadd, $curlevids)) {
$result = pmprommpu_addMembershipLevel($leveltoadd, $user_id, false);
if(! $result) {
pmprommpu_addMembershipLevel($leveltoadd, $user_id, true);
$hadtoforce = true;
}
$doweexpire = $_REQUEST['new_levels_expires'][$newkey];
if(!empty($doweexpire)) { // we're going to expire.
//update the expiration date
$expiration_date = intval($_REQUEST['new_levels_expires_year'][$newkey]) . "-" . str_pad(intval($_REQUEST['new_levels_expires_month'][$newkey]), 2, "0", STR_PAD_LEFT) . "-" . str_pad(intval($_REQUEST['new_levels_expires_day'][$newkey]), 2, "0", STR_PAD_LEFT);
$wpdb->update(
$wpdb->pmpro_memberships_users,
array( 'enddate' => $expiration_date ),
array(
'status' => 'active',
'membership_id' => $leveltoadd,
'user_id' => $user_id ), // Where clause
array( '%s' ), // format for data
array( '%s', '%d', '%d' ) // format for where clause
);
// $wpdb->query("UPDATE $wpdb->pmpro_memberships_users SET enddate = '" . $expiration_date . "' WHERE status = 'active' AND membership_id = '" . intval($leveltoadd) . "' AND user_id = '" . $user_id . "' LIMIT 1");
} else { // No expiration for me!
$wpdb->update(
$wpdb->pmpro_memberships_users,
array( 'enddate' => NULL ),
array(
'status' => 'active',
'membership_id' => $leveltoadd,
'user_id' => $user_id
),
array( NULL ),
array( '%s', '%d', '%d' )
);
// $wpdb->query("UPDATE $wpdb->pmpro_memberships_users SET enddate = NULL WHERE status = 'active' AND membership_id = '" . intval($leveltoadd) . "' AND user_id = '" . $user_id . "' LIMIT 1");
}
}
}
if($hadtoforce) {
// TODO: Should flag some kind of message to alert the admin that we had to force it (and the consequences of that).
}
}
}

This probably happens other places as well.

can not see old membership level

Hi

i have already two membership and i want to multiple membership that user can buy. i just add the add once and see membership level page strange i can not see my old level and even can not add new membership level in group

is something wrong i did?

Thanks

image

multiple level limit does not work as expect

Hello @ideadude

These three plugins are activated:

Paid Memberships Pro
Paid Memberships Pro - Multiple Memberships per Use
Paid Memberships Pro - WooCommerce Add On

Unchecked for "Can users choose more than one level in this group?" , please check the screenshot: http://prntscr.com/n2wrkx

In this case, I still can add and pay for these three membership level product together.

And, Yes, there is only one Membership level will display at user profile page, please check the screenshot:
http://prntscr.com/n2wujk

Although, I understand that this is just as your decriptions:

"Specifically, most PMPro add ons assume that users will only have one membership level at a time and don't "know what to do" when users have multiple levels or cancel multiple levels at once."

But, what I suggest is ADDING some limitation and notice at frontend, just like if deactivate "Paid Memberships Pro - Multiple Memberships per User", there will be notice:You may only add one membership OF THIS KIND or TYPE MEMBERSHIP to your cart.

What you think? Thanks and have a nice day.

Membership Expiration Issues

Right now the expiration is currently able to accept per-month, per-day, and per-year expirations that are honored.

However, if a user selects a specific date, the membership expiration for that date is not reflected.

Problem with displaying membership groups

In the admin pages the membership groups always display as blank. This is also the case when viewing a specific users membership levels. See attached.

Functionality other than this still works as expected and database shows levels and groups correctly.
2d0f990e63b04a132c39285d47714ce1

Problem with backticks in queries

Hi,
MySql (5.5.53/Linux) complains about backtics in queries, e.g. this is the error I get when opening page "Membership Levels":

WordPress database error Unknown column 'mlg.group' in 'field list' for query SELECTmlg.groupFROM wp_pmpro_membership_levels_groups mlg WHERElevel= -1

I had to remove all backticks in pmpro-multiple-memberships-per-user/includes/functions.php to make it work.
Thank you

Bug: Displaying incorrect amount when discount code is applied.

When a discount code is applied on the checkout page via AJAX, only the discount code level for the "main" level ID is displayed. This is because applydiscountcode.php only handles the "main" level ID: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/services/applydiscountcode.php#L26

We should be able to use the pmpro_discount_code_level filter on applydiscountcode.php only to calculate the returned level cost based on all of the levels in $pmpro_checkout_levels:
i.e.

function pmprommpu_pmpro_discount_code_level( $code_level, $discount_code_id ) {
	// Make sure this is being called by applydiscountcode.php
	// Calculate level based on all levels
		// Check for all levels in $pmpro_checkout_levels or rebuild array from $_REQUEST
		// Sum applied level initial_payments, billing_amounts
	// Return level
}
add_action( 'pmpro_discount_code_level' , 'pmprommpu_pmpro_discount_code_level', 10, 2);

or we could update applydiscountcode.php to handle multiple levels.

Support Ticket (Moderators Only)
https://www.paidmembershipspro.com/forums/topic/discount-code-not-summing-when-selecting-multiple-items/

Styling options for Levels page

I need a way to display the Levels within a Group as a dropdown menu (I have one group with over 20 levels and it's too long for my page).

Also, is there anyway to display ANY number of levels as a pricing table with the description field visible?

Thanks.

PMProRH_Field doesn't work properly

Hello,

It seems PMProRH_Field doesn't work properly with this add-on. For example, this code won't display the registered field when the mentioned level (which is an additional level) is selected:

$fields[] = new PMProRH_Field(
	'field_name',
	'select',
	array(
		'levels'	=> array(6, 7),
		'label'		=> 'Field Label',
		'options'	=> array(
			1		=> 'Option One',
			2		=> 'Option Two'
		)
	)
);

Any help?

No Expiration Date Set - After WooCommerce Membership Order

Hi @ipokkel I have been testing this version. But I also noticed that the expiration date is not updated as configured at the subscription level. I took his advice and manually changed the user's profile to the correct date, but I simulated two more user purchases in the hope that autocomplete will occur, and it's not possible. In all associations the expiration item is empty, and when I enter the user profile I see that it is set to "no". Is there a function to solve this?

Originally posted by @tiicaa in #30 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.