Title: inator's Replies | WordPress.org

---

# inator

  [  ](https://wordpress.org/support/users/inator/)

 *   [Profile](https://wordpress.org/support/users/inator/)
 *   [Topics Started](https://wordpress.org/support/users/inator/topics/)
 *   [Replies Created](https://wordpress.org/support/users/inator/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/inator/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/inator/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/inator/engagements/)
 *   [Favorites](https://wordpress.org/support/users/inator/favorites/)

 Search replies:

## Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Confirmation page after purchase does not display invoice properly](https://wordpress.org/support/topic/confirmation-page-after-purchase-does-not-display-invoice-properly/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/confirmation-page-after-purchase-does-not-display-invoice-properly/#post-3314807)
 * Ok the fix for the email is similar. In classes/class.pmproemail.php around line
   373 change:
 * `if($invoice)`
    to `if($invoice->code)`
 * and around line 439 change:
 * `elseif(pmpro_isLevelFree($user->membership_level))`
    to `elseif(pmpro_isLevelFree(
   $user->membership_level) || $invoice && !$invoice->code)`
 * This is probably more of a workaround since it might be better to establish another
   template that would display the reoccurring payment amount, but it’ll at least
   get things up and running for now until a better solution is identified.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Confirmation page after purchase does not display invoice properly](https://wordpress.org/support/topic/confirmation-page-after-purchase-does-not-display-invoice-properly/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/confirmation-page-after-purchase-does-not-display-invoice-properly/#post-3314806)
 * I spoke too soon. Although this address what is displayed, the resulting membership
   email has the same issue. We’ll have to hunt down where that gets fired and probably
   apply the same sort of fix. I suspect it will be the same. I’ll report back if
   I can track it down.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Confirmation page after purchase does not display invoice properly](https://wordpress.org/support/topic/confirmation-page-after-purchase-does-not-display-invoice-properly/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/confirmation-page-after-purchase-does-not-display-invoice-properly/#post-3314805)
 * This problem persists through version 1.7.0.4. It seems to occur if you have 
   a subscription with $0 up front but reoccurring thereafter. I narrowed it down
   to an issue with pages/confirmation.php around line 22:
 * `<?php if($pmpro_invoice) { ?>`
 * Since there’s an $pmpro_invoice object, but no real invoice data (since nothing
   was charged), all the required echoed output is null. I changed it to this and
   so far so good:
 * `<?php if($pmpro_invoice->code) { ?>`
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Fatal error after clicking submit button](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898366)
 * Ok … I just couldn’t leave this one alone! Here’s a possible permanent solution.
   Just add this line directly above “$sql = “INSERT INTO $wpdb->pmpro_memberships_us…”
   around line 565 of functions.php:
 * `if ($level['cycle_period'] == '') $level['cycle_period'] = 0;`
 * Per the mySQL reference manual [here](http://dev.mysql.com/doc/refman/5.0/en/enum.html)
   an index number of 0 can be passed on the insert, which will be allowed in a 
   STRICT MODE setup without throwing an error. An examination of the resulting 
   inserted row reveals an empty value for cycle_period, I believe as intended on
   a free level, right?.
 * PMPRO developers, please let me know your thoughts. Thanks much.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Fatal error after clicking submit button](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898365)
 * Ok I’m getting somewhere: I turned on error reporting and here’s what i got back:
 *     ```
       WordPress database error: [Data truncated for column 'cycle_period' at row 1]
       INSERT INTO wp_pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate) VALUES('1', '1', '0', '0.00', '0.00', '0', '', '0', '0.00', '0', NOW(), NULL)
       ```
   
 * As it turns out, my instance of mySQL server is in Strict mode as explained [here](http://stackoverflow.com/questions/1704304/what-is-this-error-database-query-failed-data-truncated-for-column-column-na)
   and expects the insertion of data for the cycle_period to be an enum value. Although
   there is a default value for this field set in the table of “Month”, when it 
   receives an empty value it throws the error. A quick work around for me was to
   add “INSERT IGNORE INTO” to the above SQL statement but that seems to be an invitation
   for some other problems. Perhaps some code needs to be added to force feed an
   enum value for cycle_period even if it does not apply? This might make the plugin
   more tolerant of a STRICT MODE mySQL environment. Also, I suggest the addition
   of $wpdb->show_errors(); somewhere in the script.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Fatal error after clicking submit button](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898364)
 * I have isolated the probplem to a mySQL error associated with this code starting
   around line 565 of functions.php:
 *     ```
       $sql = "INSERT INTO $wpdb->pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)
       						VALUES('" . $level['user_id'] . "',
       						'" . $level['membership_id'] . "',
       						'" . intval($level['code_id']) . "',
       						'" . $level['initial_payment'] . "',
       						'" . $level['billing_amount'] . "',
       						'" . $level['cycle_number'] . "',
       						'" . $level['cycle_period'] . "',
       						'" . $level['billing_limit'] . "',
       						'" . $level['trial_amount'] . "',
       						'" . $level['trial_limit'] . "',
       						" . $level['startdate'] . ",
       						" . $level['enddate'] . ")";
   
       				if(!$wpdb->query($sql))
       				{
       					$pmpro_error = __("Error interacting with database", "pmpro") . ": ".(mysql_errno()?mysql_error():'unavailable');
       					return false;
       				}
       ```
   
 * I have not yet been able to figure it out but perhaps it is a malformed SQL statement?
   Here it as final output:
 * `INSERT INTO wp_pmpro_memberships_users (user_id, membership_id, code_id, initial_payment,
   billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit,
   startdate, enddate) VALUES('1', '1', '0', '0.00', '0.00', '0', '', '0', '0.00','
   0', NOW(), NULL)`
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Fatal error after clicking submit button](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898363)
 * I cleared the fatal error by changing line 981 of preheaters/checkout.php to 
   this:
 * if(isset($morder) && $morder->cancel())
 * which allows the following error to be displayed:
 * “IMPORTANT: Something went wrong during membership creation. Your credit card
   was charged, but we couldn’t assign your membership. You should not submit this
   form again. Please contact the site owner to fix this issue.”
 * Which of course makes no sense because the issue is only exposed on a free signup.
   There’s clearly some problem with the logic in processing a free order, I suspect
   somewhere where pmpro_isLevelFree() is called.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Fatal error after clicking submit button](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898362)
 * Hello – I have the same problem with the last several versions. It only applies
   to a free signup. Any solution for this bug? I am on 1.7.0.4 now by the way.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions] Control order that memberships are displayed on levels page](https://wordpress.org/support/topic/control-order-that-memberships-are-displayed-on-levels-page/)
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [13 years ago](https://wordpress.org/support/topic/control-order-that-memberships-are-displayed-on-levels-page/#post-3320139)
 * I solved this in my levels.php page template by adding:
 *     ```
       <?php
       global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $pmpro_currency_symbol;
   
       //fix for level order issue
       //see http://wordpress.org/support/topic/control-order-that-memberships-are-displayed-on-levels-page
       ksort($pmpro_levels);
       ```
   
 * Just add it right after the globals declaration (as shown above) and all will
   be right with your world.
 * As an alternative, the functions.php could be modified to do the same, but I 
   didn’t want to mess with modifying the plugin source. I created my own custom
   template pages so I’m good!

Viewing 9 replies - 1 through 9 (of 9 total)