Author: Predrag

  • How to Manually Resend MemberPress Gifting Emails and Redemption Links Using Gift Reporter Helper Plugin

    Summary

    When customers report that a gift recipient never received their gift email, or when a redemption link is lost, expired, or needs to be manually sent again, the Gift Reporter Helper Plugin provides quick, reliable tools for Support Engineers to locate the gift and resend all necessary information. This internal plugin adds administrative functionality that allows support and site admins to search gifts by gifter or recipient email, identify the gift’s current claim status, resend the original gift email to the gifter, and copy the redemption link for manual sending.

    This document explains how to install and use the Gift Reporter Helper Plugin to manually resend gifting emails or retrieve redemption links when customers cannot locate the original email. The solutions provided here address edge cases and support-specific scenarios not covered in public MemberPress Gifting Add-on documentation, including troubleshooting email delivery failures, handling incorrect recipient email addresses, and verifying redemption link functionality.

    Troubleshooting

    Understanding the Gift Reporter Helper Plugin

    The MemberPress Gifting Add-on sends a gift email to the gifter immediately after purchase. This email includes a secure redemption link for the recipient. If the email is accidentally deleted, goes to spam, or the gifter entered an incorrect recipient email address, support may need to manually resend the gift email or provide the redemption link directly.

    The Gift Reporter Helper Plugin adds a Gift Report screen under Dashboard > MemberPress > Gift Report. Each row in the report represents a single gift purchased through the Gifting Add-on. The Actions column provides two critical tools: Resend Email sends the original gifting email again to the gifter, and Copy Redemption Link copies the gift’s unique claim URL to the clipboard.

    Internal plugin download: Gift Reporter Helper Plugin v1.5.1

    Installing and Configuring the Gift Reporter Helper Plugin

    1. Download the Gift Reporter Helper Plugin from the GitHub releases page.
    2. Navigate to Dashboard > Plugins > Add New.
    3. Click Upload Plugin at the top of the page.
    4. Click Choose File and select the downloaded plugin ZIP file.
    5. Click Install Now.
    6. After installation completes, click Activate Plugin.
    7. Verify installation by navigating to Dashboard > MemberPress and confirming the Gift Report menu item appears.

    Note: The Gift Reporter Helper Plugin requires the MemberPress Gifting Add-on to be installed and active. If the Gifting Add-on is not present, the Gift Report screen will display no results.

    Locating Specific Gifts Using Gift Report Filters

    1. Navigate to Dashboard > MemberPress > Gift Report.
    2. Use the filter tools at the top of the screen to narrow your search.
    3. Enter the gifter email address in the Gifter Email field or the recipient email address in the Recipient Email field.
    4. If needed, narrow the purchase date range using the date picker filters.
    5. Filter by Membership/Product to locate gifts for specific membership levels.
    6. Click Filter to display matching results.
    7. Locate the correct gift in the results table by verifying the gifter name, recipient name, membership type, and purchase date.

    Gift Recipient Never Received Initial Email

    1) Original Gift Email Not Delivered to Gifter

    The gifter reports they never received the original gift email after completing the purchase. This may occur due to spam filtering, SMTP configuration issues, or temporary email delivery failures. Without the original email, the gifter cannot forward the redemption link to the recipient.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Gift Report.
    2. Filter by the gifter’s email address to locate the specific gift.
    3. Verify the transaction status shows Complete in the MemberPress > Transactions section before proceeding.
    4. In the Actions column, click Resend Email.
    5. A confirmation message will appear indicating the email was sent successfully.
    6. Ask the gifter to check their inbox, spam folder, and junk folder.
    7. If the email still does not arrive, verify SMTP configuration at Dashboard > MemberPress > Settings > Emails.
    8. Test general email delivery by sending a test email from Dashboard > MemberPress > Settings > Emails using the Send Test Email button.

    2) Gifter Entered Incorrect Recipient Email Address

    The gifter accidentally entered the wrong email address for the gift recipient during the gifting form submission. The original email was delivered successfully to the incorrect address, but the intended recipient never received it. Resending the email will not solve this issue because it sends to the same incorrect address stored in the gift record.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Gift Report.
    2. Filter by the gifter’s email address to locate the specific gift.
    3. Verify the recipient email address shown in the gift record matches what the gifter intended.
    4. If the email address is incorrect, click Copy Redemption Link in the Actions column.
    5. The redemption URL will be copied to your clipboard.
    6. Paste the redemption link into your support reply or email it directly to the correct recipient email address.
    7. Inform the recipient they should click the link to complete their gift registration.
    8. Test the redemption link in an incognito window before sending to verify it works correctly.

    Note: The gift recipient email address cannot be changed in the MemberPress database after the gift is created. The only solution for incorrect recipient emails is to manually send the redemption link to the correct address using the Copy Redemption Link feature.

    3) Email Delivery Failing Due to SMTP Configuration Problems

    The site is experiencing general email delivery failures affecting all MemberPress emails, including gifting emails. This typically occurs when the default WordPress wp_mail function is not properly configured, when SMTP authentication is missing, or when the sending domain lacks proper SPF and DMARC records.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Settings > Emails.
    2. Click Send Test Email and enter a working email address.
    3. Check if the test email arrives successfully.
    4. If the test email fails, verify SMTP configuration at Dashboard > MemberPress > Settings > Emails in the Send Mail From section.
    5. Ensure From Name and From Email are correctly configured.
    6. Check the site’s email health by visiting https://mxtoolbox.com/emailhealth/ and entering the site domain.
    7. Address any SPF, DMARC, or DNS configuration errors identified by the email health check.
    8. If SMTP issues persist, consider installing and configuring WP Mail SMTP plugin to improve email deliverability.
    9. After resolving SMTP issues, return to Dashboard > MemberPress > Gift Report and use Resend Email to deliver the gift email.

    4) Gifter Wants to Forward Gift Email Again But Deleted Original

    The gifter successfully received the original gift email and forwarded it to the recipient. However, the recipient deleted the email or lost access to it before claiming the gift. The gifter no longer has the original email and cannot forward it again.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Gift Report.
    2. Filter by the gifter’s email address to locate the specific gift.
    3. In the Actions column, click Resend Email.
    4. Inform the gifter the email has been resent and ask them to check their inbox.
    5. Alternatively, if immediate access is needed, click Copy Redemption Link and provide the link directly to the gifter in your support reply.
    6. The gifter can then forward the redemption link to the recipient via email, text message, or any other communication method.

    Verifying Gift Status and Redemption

    The Gift Report screen displays the current claim status for each gift in the Claimed column. Before resending emails or providing redemption links, verify whether the gift has already been claimed to avoid confusion.

    1. Navigate to Dashboard > MemberPress > Gift Report.
    2. Locate the specific gift in the results table.
    3. Check the Claimed column to see if the status is Yes or No.
    4. If the status shows Yes, inform the customer the gift has already been redeemed and provide the redemption date if available.
    5. If the status shows No, proceed with resending the email or providing the redemption link.
    6. Verify the transaction is Complete in Dashboard > MemberPress > Transactions to ensure the gift is valid and active.

    When to Use Resend Email vs. Copy Redemption Link

    Understanding when to use each Gift Reporter action ensures efficient support resolution and prevents unnecessary steps.

    Use Resend Email when:

    • The gifter never received the initial email due to spam filtering or delivery issues;
    • The gifter wants to forward the email again to the recipient;
    • Temporary delivery issues occurred during the original send (SMTP downtime, mail server issues);
    • The recipient email address in the gift record is correct.

    Use Copy Redemption Link when:

    • The gifter entered the wrong recipient email address during purchase;
    • Email delivery is consistently failing and direct sharing is needed;
    • You need to verify the link’s functionality before the customer attempts to use it;
    • The gifter prefers to share the link via text message or social media instead of email;
    • Immediate access is required and email delivery may be delayed.

    Troubleshooting Gift Reporter Plugin Issues

    1) Gift Does Not Appear in Gift Report

    The customer reports purchasing a gift, but the gift does not appear in the Gift Report screen when filtering by gifter or recipient email.

    How to Test/Fix:

    1. Verify the MemberPress Gifting Add-on is installed and active at Dashboard > MemberPress > Add-ons.
    2. Navigate to Dashboard > MemberPress > Transactions.
    3. Search for the transaction by the gifter’s email address or name.
    4. Confirm the transaction status shows Complete and not mp-txn-xxxxxxxx format.
    5. If the transaction is incomplete, troubleshoot the payment gateway configuration at Dashboard > MemberPress > Settings > Payments.
    6. Check if the purchase was made under a different user account or email address.
    7. Verify the membership has Allow this membership to be gifted enabled at Dashboard > MemberPress > Memberships > Membership Options.
    8. If the gift was purchased but never properly recorded, contact MemberPress support for advanced troubleshooting.

    2) Resend Email Button Not Working

    Clicking the Resend Email button does not trigger email delivery or shows an error message.

    How to Test/Fix:

    1. Verify site SMTP configuration at Dashboard > MemberPress > Settings > Emails.
    2. Send a test email from the Emails settings page to confirm general email delivery works.
    3. Check browser console for JavaScript errors that may prevent the button from functioning.
    4. Disable browser extensions or test in an incognito window to rule out extension conflicts.
    5. Clear site caching and browser cache, then attempt to resend again.
    6. Verify the gifter’s email address is valid and correctly formatted in the gift record.
    7. Check the site’s error logs for PHP errors that may indicate plugin conflicts.
    8. If issues persist, deactivate other plugins temporarily to identify conflicts, then reactivate one by one.

    3) Redemption Link Returns Invalid or Expired Error

    The recipient clicks the redemption link but receives an error message stating the link is invalid or has expired.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Gift Report and verify the gift status shows Claimed: No.
    2. If the status shows Claimed: Yes, inform the customer the gift has already been redeemed.
    3. Verify the membership and product settings at Dashboard > MemberPress > Memberships are correctly configured.
    4. Check if the membership was deleted or deactivated after the gift was purchased.
    5. Test the redemption link in an incognito browser window to rule out caching issues.
    6. Verify the site URL structure has not changed since the gift was purchased (HTTP vs HTTPS, domain changes).
    7. Check for permalink conflicts at Dashboard > Settings > Permalinks and flush permalinks if necessary.
    8. If the gift was purchased long ago and the membership structure changed, contact MemberPress support for advanced troubleshooting.

    Important Limitations and Considerations

    • The Gift Reporter Helper Plugin is an internal tool not intended for public distribution or customer self-service;
    • Resending emails delivers the message to the original gifter email address recorded in the gift record and cannot be changed;
    • Recipient email addresses cannot be edited after a gift is created; incorrect addresses require manual link sharing;
    • Gifts can only be claimed once; attempting to use a redemption link after claiming will result in an error;
    • The plugin requires the MemberPress Gifting Add-on to be installed and active to function properly;
    • Email delivery depends on site SMTP configuration; plugin functionality cannot override SMTP failures;
    • Redemption links remain valid indefinitely unless the associated membership or coupon is deleted.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Additional References

  • How to Safely Reduce MemberPress Database Table Sizes

    Summary

    Over time, MemberPress database tables can grow significantly in size, particularly the wp_mepr_events table which logs user activities, membership events, and transaction-related actions. Large database tables can impact site performance, increase backup times, and consume hosting resources.

    This document provides safe methods for reducing the size of MemberPress database tables by removing old event records while preserving critical transaction and reporting data. The solutions covered include proper database backup procedures, testing queries before execution, and understanding which records can be safely deleted without affecting site functionality or historical reporting.

    These procedures are designed for support team members assisting users with database optimization and for advanced users comfortable with database management tools. All methods prioritize data integrity and include safeguards against accidental data loss.

    Troubleshooting

    Understanding MemberPress Database Tables

    MemberPress creates several database tables to store membership data, transactions, and events. The primary tables include:

    • wp_mepr_events: Logs membership events, logins, and user activities (typically the largest table);
    • wp_mepr_transactions: Stores payment transaction records;
    • wp_mepr_subscriptions: Contains active and canceled subscription data;
    • wp_mepr_members: Stores member-specific information;

    The wp_mepr_events table grows continuously as it records every membership-related event on the site. Depending on site traffic and membership activity, this table can contain hundreds of thousands or millions of records.

    Backing Up the Database Before Making Changes

    Important: Never perform database modifications without creating a complete backup first. Database changes cannot be undone without a backup.

    Before proceeding with any database cleanup, users must create a full database backup. There are multiple methods for creating database backups:

    Method 1: Using a WordPress Backup Plugin

    1. Navigate to Dashboard > Plugins > Add New.
    2. Search for and install a database backup plugin such as UpdraftPlusBackWPup, or WP Database Backup.
    3. Click Activate after installation.
    4. Navigate to the plugin’s settings page from Dashboard > Settings.
    5. Configure backup settings to include the database only (not files).
    6. Click Backup Now or Run Backup.
    7. Download the backup file to your local computer for safekeeping.

    Method 2: Using phpMyAdmin

    1. Log into your hosting control panel (cPanel, Plesk, or custom dashboard).
    2. Locate and click phpMyAdmin.
    3. Select your WordPress database from the left sidebar.
    4. Click the Export tab at the top.
    5. Select Quick export method and SQL format.
    6. Click Go to download the database backup file.
    7. Save the file to your local computer with a descriptive name including the date.

    Method 3: Using WP-CLI

    For users with SSH access and WP-CLI installed:

    wp db export backup-$(date +%Y%m%d-%H%M%S).sql

    This command creates a timestamped database backup file in the current directory.

    Large wp_mepr_events Table

    The wp_mepr_events table can grow to millions of records, significantly increasing database size and potentially impacting query performance.

    1) Events Table Contains Years of Historical Data No Longer Needed for Reporting

    The events table stores detailed logs of user activities including logins, membership changes, and transaction events. For most sites, events older than 1-2 years provide minimal value for current reporting or troubleshooting purposes while consuming significant database space.

    How to Test/Fix:

    First, determine how many records exist in the events table and how many would be deleted:

    1. Access your database using phpMyAdmin or another database management tool.
    2. Select your WordPress database from the left sidebar.
    3. Click the SQL tab at the top.
    4. Run this query to check total record count:
    SELECT COUNT(*) FROM wp_mepr_events;
    1. Run this query to check how many records are older than 1 year:
    SELECT COUNT(*) FROM wp_mepr_events WHERE created_at < NOW() - INTERVAL 1 YEAR;
    1. Review the count to understand how much data will be removed.
    2. Test retrieving sample records that would be deleted:
    SELECT * FROM wp_mepr_events WHERE created_at < NOW() - INTERVAL 1 YEAR LIMIT 10;
    1. Verify the records shown are indeed old events that are no longer needed.
    2. Once confirmed, execute the deletion query:
    DELETE FROM wp_mepr_events WHERE created_at < NOW() - INTERVAL 1 YEAR;
    1. Wait for the query to complete. Large tables may take several minutes.
    2. Run the count query again to verify records were deleted:
    SELECT COUNT(*) FROM wp_mepr_events;
    1. Optimize the table to reclaim disk space:
    OPTIMIZE TABLE wp_mepr_events;

    Note: Users can adjust the time interval based on their data retention needs. Replace 1 YEAR with 2 YEAR6 MONTH, or 90 DAY as appropriate. More conservative retention (2 years) is recommended for sites with compliance requirements or those who frequently reference historical data.

    2) Database Queries Timing Out When Attempting to Delete Large Numbers of Records

    For very large events tables with millions of records, a single DELETE query may exceed server timeout limits or lock the table for extended periods, impacting site functionality.

    How to Test/Fix:

    Use batch deletion to remove records in smaller chunks:

    1. Access your database using phpMyAdmin or another database management tool.
    2. Click the SQL tab.
    3. Execute this query to delete records in batches of 10,000:
    DELETE FROM wp_mepr_events WHERE created_at < NOW() - INTERVAL 1 YEAR LIMIT 10000;
    1. Wait for the query to complete.
    2. Check how many rows were affected in the query results.
    3. If 10,000 rows were deleted, repeat the query until fewer than 10,000 rows are affected (indicating all matching records have been removed).
    4. After all batches are complete, optimize the table:
    OPTIMIZE TABLE wp_mepr_events;

    Alternatively, for users with SSH access and WP-CLI installed, create a custom script to automate batch deletion:

    #!/bin/bash
    # Delete old MemberPress events in batches
    
    while true; do
      DELETED=$(wp db query "DELETE FROM wp_mepr_events WHERE created_at < NOW() - INTERVAL 1 YEAR LIMIT 10000;" --skip-column-names | grep -oP '\d+')
      echo "Deleted $DELETED records"
      
      if [ "$DELETED" -lt 10000 ]; then
        echo "Cleanup complete"
        break
      fi
      
      sleep 2
    done
    
    wp db query "OPTIMIZE TABLE wp_mepr_events;"
    1. Save this script as cleanup-events.sh.
    2. Make it executable with chmod +x cleanup-events.sh.
    3. Run the script with ./cleanup-events.sh.

    3) Uncertainty About Which Events Can Be Safely Deleted

    Users may be concerned about accidentally deleting events that are still referenced by active memberships, subscriptions, or transactions.

    How to Test/Fix:

    The wp_mepr_events table primarily serves as a historical activity log. Deleting old events does not affect:

    • Active memberships or subscriptions;
    • Transaction records in wp_mepr_transactions;
    • User access to content;
    • Current subscription statuses;
    • Payment gateway connections;

    However, deleting events will remove historical data used for:

    • Historical reporting and analytics;
    • Login history tracking;
    • Debugging past membership issues;
    • Audit trails for compliance purposes;

    To verify which event types exist in the table before deletion:

    1. Access your database using phpMyAdmin.
    2. Run this query to see event type distribution:
    SELECT event, COUNT(*) as count 
    FROM wp_mepr_events 
    WHERE created_at < NOW() - INTERVAL 1 YEAR 
    GROUP BY event 
    ORDER BY count DESC;
    1. Review the event types and counts to understand what data will be removed.
    2. Common event types include “login”“member-signup-completed”“transaction-completed”, and “subscription-created”.
    3. Proceed with deletion if the event types shown are acceptable to remove from historical records.

    Other MemberPress Tables

    While the wp_mepr_events table is typically the largest, users may occasionally need to address other table sizes.

    4) Large wp_mepr_transactions Table

    Important: The transactions table should generally not be modified or cleaned. Transaction records are essential for financial reporting, tax compliance, refund processing, and subscription management. Deleting transaction records can break active subscriptions and prevent proper revenue tracking.

    If the transactions table is excessively large, this typically indicates a site with substantial transaction history. Rather than deleting records, consider:

    • Archiving old transaction data to a separate database or export file;
    • Upgrading hosting plan to accommodate larger database sizes;
    • Consulting with a database administrator about table partitioning strategies;

    How to Test/Fix:

    Only proceed with transaction cleanup if absolutely necessary and after consulting with accounting/finance teams about data retention requirements. If cleanup is required:

    1. Create a complete database backup (see backup section above).
    2. Export old transaction records to a CSV file for archival purposes:
    SELECT * FROM wp_mepr_transactions 
    WHERE created_at < NOW() - INTERVAL 3 YEAR 
    INTO OUTFILE '/tmp/archived_transactions.csv' 
    FIELDS TERMINATED BY ',' 
    ENCLOSED BY '"' 
    LINES TERMINATED BY '\n';
    1. Verify the export file was created successfully and contains the expected data.
    2. Download the export file to a secure location.
    3. Only delete transactions that meet all these criteria:
    • Transaction is older than 3 years;
    • Transaction status is “complete” or “refunded”;
    • Transaction is not associated with an active subscription;
    1. Execute this query cautiously:
    DELETE t FROM wp_mepr_transactions t
    LEFT JOIN wp_mepr_subscriptions s ON t.subscription_id = s.id
    WHERE t.created_at < NOW() - INTERVAL 3 YEAR
    AND t.status IN ('complete', 'refunded')
    AND (s.id IS NULL OR s.status = 'cancelled');

    Post-Cleanup Verification and Maintenance

    After completing database cleanup operations, perform the following verification steps:

    1. Navigate to Dashboard > MemberPress > Memberships.
    2. Verify that active memberships display correctly.
    3. Navigate to Dashboard > MemberPress > Subscriptions.
    4. Verify that active subscriptions appear with correct status and dates.
    5. Navigate to Dashboard > MemberPress > Transactions.
    6. Verify that recent transactions display properly.
    7. Test member login functionality on the frontend.
    8. Verify that protected content remains accessible to members with active subscriptions.
    9. Check site error logs for any database-related errors.
    10. Monitor site performance over the next 24-48 hours for any anomalies.

    To prevent future excessive table growth, consider implementing these ongoing maintenance practices:

    • Schedule quarterly or semi-annual database cleanup tasks;
    • Monitor database size through hosting control panel;
    • Set up automated database optimization through cron jobs;
    • Review event logging settings to reduce unnecessary event creation.

    When to Contact Support or a Developer

    Users should contact MemberPress support or hire a WordPress developer if:

    • Database cleanup queries fail or produce errors;
    • Site functionality breaks after database modifications;
    • Subscriptions or memberships stop working correctly;
    • Database backup cannot be restored successfully;
    • Table optimization fails or causes performance degradation;
    • Custom database modifications are needed beyond standard cleanup;
    • Hosting provider restricts direct database access.

    MemberPress support can assist with troubleshooting issues related to plugin functionality after database modifications but cannot perform database operations directly on customer sites.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Developer Documentation

    Additional References

  • How to Fix MemberPress Database Deadlock Error With Rule Transients

    Summary

    This document addresses a database deadlock error that occurs when MemberPress attempts to delete transients for the Rule custom post type. The error appears in the WordPress debug log with the message “Deadlock found when trying to get lock; try restarting transaction” and occurs during the deletion of the _transient_mepr_all_models_for_class_meprrule option.

    Database deadlocks happen when multiple database operations attempt to access the same resources simultaneously. In this case, concurrent transient deletion operations for MemberPress Rules create conflicts that prevent database queries from completing successfully. This document provides a solution to prevent the deadlock by disabling transient caches specifically for MemberPress Rules, allowing the site to continue functioning normally without database conflicts.

    Troubleshooting

    Understanding the Database Deadlock Error

    The database deadlock error occurs during high-traffic periods or when multiple processes attempt to update MemberPress Rule transients simultaneously. Transients are temporary cached data stored in the WordPress database that help improve performance by reducing repeated database queries. However, when multiple processes try to delete or update the same transient simultaneously, MySQL can encounter a deadlock situation where neither process can proceed.

    1) Deadlock Error in Debug Logs

    The error appears in the WordPress debug log when MemberPress attempts to delete Rule transients. The full error message typically reads: “Deadlock found when trying to get lock; try restarting transaction” and references the _transient_mepr_all_models_for_class_meprrule option.

    How to Test/Fix:

    1. Enable WordPress debug logging by adding these lines to the wp-config.php file:
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    1. Monitor the wp-content/debug.log file for deadlock errors related to MemberPress Rule transients.
    2. If deadlock errors appear consistently, proceed with implementing the solution to disable Rule transient caches.

    2) Concurrent Transient Operations Causing Conflicts

    Multiple WordPress processes or cron jobs may attempt to access MemberPress Rule transients simultaneously. This is particularly common on high-traffic sites or sites with aggressive caching configurations. When multiple processes try to delete the same transient option at the same time, MySQL cannot determine which operation should proceed first, resulting in a deadlock.

    How to Test/Fix:

    1. Check if the errors coincide with high traffic periods or scheduled cron job executions.
    2. Review active plugins that might trigger MemberPress Rule queries simultaneously.
    3. Implement the solution below to disable transient caching for Rules and eliminate the concurrent operation conflicts.

    Solution: Disable Rule Transient Caches

    The recommended solution is to disable transient caching specifically for MemberPress Rules. This prevents the database deadlock by eliminating the transient deletion operations that cause the conflict. While this may result in slightly more database queries for Rule data, it ensures database stability and prevents site errors.

    Implementation Using WPCode Plugin (Recommended)

    1. Navigate to Dashboard > Plugins > Add New.
    2. Search for “WPCode” and install the free version.
    3. Click Activate after installation completes.
    4. Navigate to Dashboard > Code Snippets > + Add Snippet.
    5. Click Add Your Custom Code (New Snippet).
    6. Enter the snippet title: “Disable MemberPress Rule Transient Caches”.
    7. Set Code Type to PHP Snippet.
    8. Paste the following code into the Code Preview section:
    function disable_mp_rule_transient_caches($use_cache, $cpt, $class) {
      // Check if the custom post type is MemberPress Rule
      if($cpt == 'memberpressrule') {
        // Disable transient cache for Rules
        $use_cache = false;
      }
      
      return $use_cache;
    }
    
    // Hook into MemberPress transient cache filter
    add_filter('mepr-cpt-all-use-transient-cache', 'disable_mp_rule_transient_caches', 11, 3);
    1. Set Insert Method to Auto Insert.
    2. Set Location to Run Everywhere.
    3. Toggle the snippet to Active.
    4. Click Save Snippet.
    5. Monitor the wp-content/debug.log file for 24-48 hours to verify the deadlock errors no longer appear.

    Implementation Using Child Theme functions.php

    1. Navigate to Dashboard > Appearance > Theme File Editor.
    2. Select your child theme from the Select theme to edit dropdown. If you do not have a child theme, create one following the WPBeginner child theme guide.
    3. Click on the functions.php file in the right sidebar.
    4. Add the following code at the end of the file, after the closing PHP tag ?> if present, or at the very end if no closing tag exists:
    function disable_mp_rule_transient_caches($use_cache, $cpt, $class) {
      // Check if the custom post type is MemberPress Rule
      if($cpt == 'memberpressrule') {
        // Disable transient cache for Rules
        $use_cache = false;
      }
      
      return $use_cache;
    }
    
    // Hook into MemberPress transient cache filter
    add_filter('mepr-cpt-all-use-transient-cache', 'disable_mp_rule_transient_caches', 11, 3);
    1. Click Update File.
    2. Clear all site caching (server cache, CDN cache, WordPress object cache, and page cache).
    3. Monitor the wp-content/debug.log file for 24-48 hours to verify the deadlock errors no longer appear.

    Important: Always use a child theme when adding custom code to functions.php. If you add code directly to your parent theme’s functions.php file, the code will be lost when the theme is updated. The WPCode plugin method is recommended as it avoids this issue entirely.

    Understanding the Code Solution

    The code solution works by filtering the mepr-cpt-all-use-transient-cache filter hook that MemberPress uses to determine whether to use transient caching for custom post types. The function checks if the custom post type is memberpressrule and, if so, sets the $use_cache variable to false. This prevents MemberPress from creating, updating, or deleting transients for Rules, eliminating the database operations that cause deadlock conflicts.

    The filter is hooked at priority 11 to ensure it runs after MemberPress’s default filter priority of 10, guaranteeing the custom behavior takes precedence. The function accepts three parameters from the filter: $use_cache (the current cache status), $cpt (the custom post type being queried), and $class (the MemberPress class name). Only the $cpt parameter is checked to determine if caching should be disabled.

    Verifying the Solution

    1. After implementing the code, clear all caching layers on the site.
    2. Monitor the wp-content/debug.log file for 24-48 hours.
    3. Verify that no new deadlock errors related to _transient_mepr_all_models_for_class_meprrule appear in the log.
    4. Test MemberPress functionality including membership access, rule evaluation, and content protection to ensure normal operation.
    5. If errors persist after 48 hours, verify the code was added correctly and that no PHP errors appear in the debug log.

    Note: Disabling transient caching for Rules means MemberPress will query Rule data directly from the database on each request. This typically has minimal performance impact, as Rule queries are relatively lightweight. However, sites with hundreds of Rules or very high traffic may experience slightly increased database load. Monitor site performance after implementation.

    Alternative: Increase Database Max Lock Wait Timeout

    If disabling transient caches is not preferred, an alternative solution is to increase the MySQL innodb_lock_wait_timeout value. This gives database operations more time to complete before timing out, potentially reducing deadlock occurrences. However, this approach only mitigates the issue rather than eliminating the underlying cause.

    How to Test/Fix:

    1. Contact your hosting provider to request an increase to the MySQL innodb_lock_wait_timeout setting.
    2. Request an increase from the default 50 seconds to 120 seconds or higher.
    3. Monitor the debug log after the change is implemented to see if deadlock errors decrease.
    4. Note that this solution may not completely eliminate deadlocks, as it only extends the timeout period rather than preventing concurrent operations.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Developer Documentation

  • How to Use MemberPress Bulk Invoice Generator to Create Multiple PDF Invoices

    Summary

    The Bulk Invoice Generator is an internal helper plugin that enables administrators to generate multiple MemberPress invoice PDFs simultaneously. While MemberPress allows individual invoice downloads per transaction, this plugin addresses the limitation of batch invoice generation for accounting, audits, or tax preparation purposes.

    This document provides technical guidance for Support team members assisting customers with bulk invoice generation. The plugin integrates with the MemberPress PDF Invoice add-on to create batched PDF files packaged in ZIP archives. This functionality is particularly valuable for customers requiring recurring financial reports, annual billing records for accountants, or comprehensive backup archives of all transaction invoices.

    Troubleshooting

    Installing and Accessing the Bulk Invoice Generator

    1. Download the latest plugin version from https://github.com/omaraelhawary/memberpress-bulk-invoice-generator/releases.
    2. Navigate to Dashboard > Plugins > Add New.
    3. Click Upload Plugin.
    4. Select the downloaded ZIP file and click Install Now.
    5. Click Activate after installation completes.
    6. Navigate to Dashboard > MemberPress > Bulk Invoice Generator to access the tool interface.

    Generating Invoices Using the Plugin

    The plugin supports two primary generation modes that administrators can select based on their requirements.

    Method 1: Generate All Invoices

    1. Navigate to Dashboard > MemberPress > Bulk Invoice Generator.
    2. Select the Generate All Invoices option.
    3. Click Generate Invoices.
    4. Wait for the batch process to complete. Processing time varies based on transaction volume and server performance.
    5. Download the generated ZIP file from the confirmation screen or locate it in /wp-content/uploads/mepr/mpdf/.

    Method 2: Generate by Date Range

    1. Navigate to Dashboard > MemberPress > Bulk Invoice Generator.
    2. Select the Generate By Date Range option.
    3. Set the Start Date and End Date for the desired invoice period.
    4. Select the Transaction Status (Completed, Confirmed, Pending, or Refunded).
    5. Optionally, enter a specific Customer Email to filter invoices for individual customers.
    6. Click Generate Invoices.
    7. Download the generated ZIP archive after the process completes.

    Note: The plugin generates PDF files locally but does not automatically email invoices to customers. Administrators must manually download and distribute the ZIP archive if customer delivery is required.

    Locating Generated Invoice Files

    All generated PDF invoices and ZIP archives are stored in the following directory:

    /wp-content/uploads/mepr/mpdf/

    The ZIP filename includes a timestamp to identify when the batch was created. Support can assist customers in locating these files through FTP access or their hosting control panel File Manager.

    Common Issues and Solutions

    1) “MemberPress PDF Invoice add-on is not active” Error

    This error occurs when the required MemberPress PDF Invoice add-on is either not installed or not activated on the site. The Bulk Invoice Generator depends entirely on this add-on to generate PDF files using the site’s configured invoice template.

    How to Test/Fix:

    1. Navigate to Dashboard > Plugins.
    2. Verify that MemberPress PDF Invoice appears in the plugins list.
    3. If the add-on is present but deactivated, click Activate.
    4. If the add-on is not installed, navigate to Dashboard > MemberPress > Add-ons.
    5. Locate PDF Invoice and click Install, then Activate.
    6. Return to Dashboard > MemberPress > Bulk Invoice Generator and attempt generation again.

    2) “No transactions found for selected criteria” Message

    This message appears when the date range, transaction status, or customer email filter produces no matching transactions. The plugin cannot generate invoices if no qualifying transactions exist in the database.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Transactions.
    2. Verify that transactions exist within the specified date range and status criteria.
    3. If using the Customer Email filter, confirm the email address exactly matches a customer record.
    4. Adjust the date range to include known transaction dates.
    5. Change the transaction status filter to Completed to include the most common transaction type.
    6. Remove the Customer Email filter to test with broader criteria.
    7. Attempt invoice generation again with adjusted parameters.

    3) “Unable to create ZIP file — ZipArchive not available” Error

    This error indicates the PHP ZipArchive extension is not enabled on the server. The plugin requires this extension to bundle multiple PDF files into a single downloadable archive.

    How to Test/Fix:

    1. Navigate to Dashboard > Tools > Site Health.
    2. Click the Info tab.
    3. Expand the Server section.
    4. Locate PHP Extensions and verify zip appears in the list.
    5. If the extension is missing, contact the hosting provider to enable PHP ZipArchive.
    6. After the host enables the extension, retry invoice generation.

    4) “Unable to generate invoices — mpdf directory is not writable” Error

    This error occurs when WordPress cannot write files to the /wp-content/uploads/mepr/mpdf/ directory due to incorrect file permissions. The plugin must have write access to store generated PDFs and ZIP archives.

    How to Test/Fix:

    1. Access the site via FTP or hosting File Manager.
    2. Navigate to /wp-content/uploads/mepr/.
    3. Check if the mpdf directory exists. If not, create it manually.
    4. Set directory permissions to 755 or 775 depending on server configuration.
    5. Set file permissions within the directory to 644 or 664.
    6. If permission changes do not resolve the issue, contact the hosting provider to verify ownership settings.
    7. Return to Dashboard > MemberPress > Bulk Invoice Generator and retry generation.

    5) Generation Process Times Out for Large Batches

    When generating invoices for thousands of transactions, PHP execution time limits or memory restrictions may cause the process to terminate prematurely. This is particularly common on shared hosting environments with strict resource limitations.

    How to Test/Fix:

    1. Reduce the date range to generate invoices in smaller batches (monthly or quarterly instead of annually).
    2. Navigate to Dashboard > Tools > Site Health > Info > Server.
    3. Note the PHP Time Limit and PHP Memory Limit values.
    4. If values are below 300 seconds or 256M respectively, contact the hosting provider to request increases.
    5. Consider using WP-CLI on hosts that support it for processing very large batches without browser timeout restrictions.
    6. Monitor server performance during generation and adjust batch sizes accordingly.

    System Requirements and Dependencies

    The Bulk Invoice Generator requires the following components to function properly:

    • MemberPress plugin (active and licensed);
    • MemberPress PDF Invoice add-on (active and configured);
    • PHP ZipArchive extension (enabled on server);
    • Writable /wp-content/uploads/mepr/mpdf/ directory;
    • Sufficient PHP memory and execution time for batch size.

    Support should verify these prerequisites when troubleshooting generation failures or errors.

    Best Practices for Support Assistance

    When assisting customers with the Bulk Invoice Generator, Support should:

    • Clarify that the plugin generates invoices locally but does not automatically email them to customers;
    • Guide customers to the ZIP file location at /wp-content/uploads/mepr/mpdf/;
    • Recommend smaller date ranges for sites with extensive transaction histories to avoid server timeouts;
    • Verify PHP ZipArchive availability if ZIP creation fails consistently;
    • Advise customers to download generated archives promptly to prevent accidental overwrites during subsequent generations;
    • Confirm that the MemberPress PDF Invoice add-on is properly configured with appropriate template settings before bulk generation.

    Important: This plugin is an internal Support tool not covered in public MemberPress documentation. Recommend it only for advanced administrators with legitimate bulk invoice export requirements and provide appropriate guidance during implementation.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Developer Documentation

    Additional References

  • Investigating Unclaimed MemberPress Gifts Using Gift Reporter Helper Plugin

    Summary

    When customers report that a gift recipient never received or redeemed their MemberPress gift, the Gift Reporter Helper Plugin provides detailed visibility into gift transactions and claim status. This internal tool enables Support team members to quickly identify unclaimed gifts, verify redemption links, and troubleshoot delivery issues without manually searching through transaction records.

    This document explains how to use the Gift Reporter Helper Plugin to investigate unclaimed gifts, verify claim status, and resolve common issues with gift delivery and redemption. The solutions covered here address edge cases and technical considerations specific to the MemberPress Gifting Add-on that are not covered in public documentation.

    Troubleshooting

    Installing and Activating the Gift Reporter Helper Plugin

    The Gift Reporter Helper Plugin is an internal tool available only to MemberPress Support team members. Before investigating unclaimed gifts, you must install and activate this plugin on the customer’s site.

    1. Download the Gift Reporter Helper Plugin from the internal repository at https://github.com/omaraelhawary/memberpress-gift-reporter/releases/tag/v1.5.1.
    2. Navigate to Dashboard > Plugins > Add New.
    3. Click Upload Plugin at the top of the page.
    4. Click Choose File and select the downloaded plugin ZIP file.
    5. Click Install Now and then Activate.
    6. Verify installation by navigating to Dashboard > MemberPress > Gift Report.

    Using the Gift Report Interface

    The Gift Report screen provides comprehensive filtering options and quick actions for managing gift investigations. Understanding how to use these features efficiently will reduce troubleshooting time.

    1. Navigate to Dashboard > MemberPress > Gift Report.
    2. Review the Summary Statistics section at the top of the page. This displays total gifts purchased, claimed versus unclaimed counts, claim rate percentage, and total revenue for the filtered results.
    3. Use the filter options to narrow results. Available filters include Claim Status (Claimed, Unclaimed, All), Purchase Date Range (specific date ranges), Membership/Product (specific gifted memberships), and Search (Gifter or Recipient email addresses).
    4. Review the gift transaction table. Each row displays Gifter Name, Gifter Email, Recipient Name, Recipient Email, Membership Name, Purchase Date, Claim Date, Claim Status, and Quick Actions.
    5. Use the Quick Actions column for immediate troubleshooting. Available actions include Copy Redemption Link (copies the unique redemption URL for manual testing) and Resend Email (triggers a new gift notification email to the gifter).

    Common Gift Delivery and Redemption Issues

    1) Recipient Never Received Gift Email

    The most common complaint is that the gift recipient never received the email notification containing the redemption link. This can occur due to email delivery failures, spam filtering, or incorrect recipient email addresses.

    How to Test/Fix:

    1. Open the Gift Report screen and filter by Claim Status: Unclaimed.
    2. Search for the specific gift using the gifter or recipient email address.
    3. Verify the recipient email address is correct in the gift transaction record. If incorrect, the gifter entered the wrong email during purchase.
    4. Check the customer’s email authentication setup. Navigate to Dashboard > Settings > General and verify the WordPress Address and Site Address settings match the domain.
    5. Verify SPF and DKIM records are properly configured for the sender domain. Email delivery issues often occur when these DNS records are missing or misconfigured.
    6. Use the Resend Email quick action to trigger a new gift notification email.
    7. If emails continue to fail, recommend the customer use a dedicated SMTP service such as WP Mail SMTPSendGrid, or Mailgun to improve email deliverability.
    8. As an alternative solution, use the Copy Redemption Link action and manually provide the link to the gifter so they can share it directly with the recipient.

    Important: Email deliverability issues are often caused by missing or incorrect SPF, DKIM, and DMARC DNS records. These authentication protocols verify that emails are legitimately sent from the domain. Without proper configuration, gift emails may be flagged as spam or rejected entirely by recipient email servers.

    2) Gift Appears Claimed But Recipient Reports Not Receiving Access

    Sometimes the Gift Report shows a gift as claimed with a redemption date, but the recipient reports they never received access to the membership. This typically occurs when the gift was redeemed under a different user account than expected.

    How to Test/Fix:

    1. Locate the gift transaction in the Gift Report and verify the Claim Date is populated.
    2. Navigate to Dashboard > MemberPress > Transactions.
    3. Search for transactions matching the recipient email address or the gifted membership name around the claim date.
    4. Review the transaction details to identify which user account redeemed the gift. The User column shows the WordPress username associated with the transaction.
    5. If a different email address or user account claimed the gift, verify whether the recipient has multiple accounts. Family members or shared email addresses sometimes cause unintentional redemptions.
    6. If the wrong person claimed the gift, explain to the customer that gift redemption links are single-use and cannot be reset once claimed.
    7. Advise the customer that the gifter will need to purchase a new gift for the intended recipient if the original gift was claimed by the wrong person.

    3) Gift Does Not Appear in Gift Report

    If a gift transaction does not appear in the Gift Report despite the customer confirming purchase, several configuration or plugin issues may be preventing proper gift tracking.

    How to Test/Fix:

    1. Verify the MemberPress Gifting Add-on is active. Navigate to Dashboard > MemberPress > Add-ons and confirm the Gifting Add-on shows an Active status.
    2. Check that the membership is configured to allow gifting. Navigate to Dashboard > MemberPress > Memberships, edit the relevant membership, and verify Allow this membership to be gifted is checked under Membership Options.
    3. Review the transaction status. Navigate to Dashboard > MemberPress > Transactions and locate the gift purchase transaction. Verify the transaction status is set to Complete. Pending or failed transactions will not create gift records.
    4. Confirm the purchase was made as a gift. Check the transaction record for the presence of a gift-related coupon code in the format GIFT-XXXX. If no gift coupon is present, the customer did not check the “Is this a gift?” option during checkout.
    5. Verify the customer did not purchase the gift under a different user account. Search transactions using both the gifter email and the site owner’s administrative accounts.
    6. If the transaction exists but the gift does not appear in the Gift Report, the Gift Reporter Helper Plugin may have a compatibility issue. Check for JavaScript errors in the browser console or PHP errors in the WordPress debug log.

    4) Redemption Link Does Not Work or Shows Error

    Recipients sometimes report that clicking the redemption link in the gift email produces an error or does not properly load the registration form. This can be caused by permalink issues, caching conflicts, or membership configuration problems.

    How to Test/Fix:

    1. Use the Copy Redemption Link action in the Gift Report to obtain the gift URL.
    2. Open the redemption link in an incognito or private browser window to test without cached data or existing login sessions.
    3. If the link produces a 404 error, flush the WordPress permalink structure. Navigate to Dashboard > Settings > Permalinks and click Save Changes without making any modifications.
    4. Check for caching plugin conflicts. Navigate to Dashboard > Plugins and temporarily deactivate caching plugins such as WP RocketW3 Total Cache, or WP Super Cache. Test the redemption link again.
    5. If caching is the issue, configure the caching plugin to exclude gift redemption URLs from caching. Add the following path pattern to the cache exclusion list: /gift-redemption/ or /register/ (depending on the site’s permalink structure).
    6. Verify the gifted membership has an active payment gateway configured. Navigate to Dashboard > MemberPress > Settings > Payments and confirm at least one payment method is active, even though gift redemptions use zero-cost coupons.
    7. Check for theme compatibility issues. Temporarily switch to a default WordPress theme such as Twenty Twenty-Four and test the redemption link again.

    5) Gift Reminder Emails Not Being Sent

    MemberPress can send reminder emails to gift recipients when their gifted subscription is about to expire. If these reminders are not being sent, WP-Cron scheduling issues or reminder configuration problems may be the cause.

    How to Test/Fix:

    1. Navigate to Dashboard > MemberPress > Reminders.
    2. Verify a reminder is configured from settings. If no reminder exists, create a new reminder and select this trigger option.
    3. Check the reminder email content and scheduling settings. Ensure the reminder is set to send at an appropriate interval before expiration, such as 7 days or 3 days after.
    4. Verify WP-Cron is functioning correctly. Install the WP Crontrol plugin to view scheduled cron events.
    5. Check for MemberPress reminder cron events. Navigate to Dashboard > Tools > Cron Events and search for events with names containing mpgr_run_gift_reminders.
    6. If cron events show a “now” status in the Next Run column, WP-Cron is not executing properly. This typically occurs on low-traffic sites where page loads do not trigger WP-Cron frequently enough.
    7. For sites with WP-Cron issues, recommend implementing a system cron job to replace WP-Cron. Add the following code to the wp-config.php file above the line /* That’s all, stop editing! Happy publishing. */:
    // Disable WP-Cron and use system cron instead
    define('DISABLE_WP_CRON', true);
    1. After disabling WP-Cron, set up a system cron job through the hosting control panel to execute the following command every 5 minutes:
    */5 * * * * wget -q -O - 'https://[[SITE-DOMAIN]]/wp-cron.php?doing_wp_cron' > /dev/null 2>&1

    Replace [[SITE-DOMAIN]] with the actual domain name.

    Note: System cron implementation requires server access and varies by hosting provider. Some managed WordPress hosts provide alternative cron solutions through their control panels. Consult the hosting provider’s documentation for specific instructions.

    Best Practices for Gift Troubleshooting

    • Always verify the recipient email address is correct before investigating technical issues. Typos during gift purchase are the most common cause of delivery failures;
    • Test redemption links in incognito or private browsing mode to eliminate cached data and active login sessions as variables;
    • Check both the Gift Report and Transactions screens when investigating gift issues. Cross-referencing data helps identify discrepancies or missing information;
    • Document the claim date and user account for claimed gifts. This information is essential if customers dispute redemption status or request refund;
    • Recommend email authentication configuration for all customers experiencing gift delivery issues. Proper SPF, DKIM, and DMARC setup significantly improves email deliverability.;
    • Always deactivate and delete the Gift Reporter Helper Plugin after completing the investigation. This internal tool should not remain active on customer sites.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Developer Documentation

    Additional References

  • Setting Up Automatic Gift Reminders for Unclaimed Gifts in MemberPress Using the Gift Reporter Helper Plugin

    Summary

    Unclaimed gifts are one of the most common issues reported by MemberPress customers using the Gifting Add-on. Gifters often forget to remind recipients to claim their gifts, resulting in lower redemption rates and increased support follow-ups.

    The Gift Reporter Helper Plugin (internal) provides an automated solution by sending scheduled reminder emails to gifters for any unclaimed gifts after a set number of days. This guide explains how to enable and customize automatic reminders to improve redemption rates and reduce manual follow-ups. The plugin includes a background process that checks for unclaimed gifts once per day using WordPress scheduled tasks.

    Troubleshooting

    Setting Up Automatic Gift Reminders

    The automatic reminder system allows you to send one or more reminder emails to gifters of unclaimed gifts at custom intervals. The reminder system operates through WordPress scheduled tasks (WP-Cron), checking for unclaimed gifts once per day and automatically sending reminder emails to gifters when gifts meet the defined reminder schedule.

    1. Download and install the Gift Reporter Helper Plugin (internal) version 1.5.1 from GitHub.
    2. Navigate to Dashboard > Plugins and activate the Gift Reporter Helper Plugin.
    3. Go to Dashboard > MemberPress > Gift Report > Reminders.
    4. Enable the “Automatic Gift Reminders” toggle.
    5. Define reminder schedules by selecting one or more intervals. Common settings include 7 days, 14 days, and 30 days after purchase. You can add or remove intervals to match your gifting behavior patterns.
    6. Click the Save Settings button when done.

    Important: The reminder system requires WordPress WP-Cron to function properly. Verify that WP-Cron is running correctly on your site before relying on automatic reminders. If using a managed host or external cron job, ensure it triggers wp-cron.php regularly. Without a working cron process, reminders will not send.

    Testing Reminder Email Delivery

    Before activating automatic reminders for production use, you should verify that reminder emails are being delivered correctly to prevent missed notifications.

    1. Navigate to Dashboard > MemberPress > Gift Report > Reminders.
    2. Click the Send Test Email button.
    3. Check your email inbox for the test reminder email using the default email template.
    4. Verify that the email was delivered and displays correctly.
    5. If the test email is not received, check your site’s outgoing email configuration. Consider installing an SMTP plugin to improve email deliverability.

    Customizing Reminder Email Templates

    The reminder email template can be fully customized through a theme override. This allows you to modify the HTML, text content, and styling to match your brand without editing plugin files directly.

    Default template path:
    /wp-content/plugins/memberpress-gift-reporter/views/emails/reminder-email.php

    To override the template:

    1. Copy the reminder-email.php file from the plugin’s views/emails/ directory.
    2. Create the following directory structure in your active theme if it does not exist: /wp-content/themes/[[YOUR-THEME-NAME]]/memberpress-gift-reporter/emails/
    3. Paste the copied reminder-email.php file into the newly created emails/ directory.
    4. Modify the HTML or text content in the copied file as needed.
    5. The plugin will automatically load the customized version from your theme instead of the default template.

    Available template variables:

    • {$product_name} – The gifted membership name
    • {$redemption_link} – The direct link for the recipient to claim the gift
    • {$site_name} – The website’s name
    • {$user_email} – The gifter’s email address
    • {$user_first_name} – The gifter’s first name

    Note: Any changes made to the template in your theme will be preserved during plugin updates. Do not modify the plugin’s template files directly, as these changes will be lost when the plugin is updated.

    Common Issues with Automatic Reminders

    1) Reminder Emails Are Not Sending

    The most common cause of reminders not sending is that WordPress WP-Cron is not enabled or not executing properly. WP-Cron is triggered by site traffic, so low-traffic sites or heavily cached sites may not trigger scheduled events reliably.

    How to Test/Fix:

    1. Install and activate the WP Crontrol plugin from the WordPress plugin repository.
    2. Navigate to Dashboard > Tools > Cron Events.
    3. Look for the gift reminder cron event in the list. If it is not present, the reminder system has not been activated properly.
    4. If the event is present but shows a status of “Now” or a past timestamp, WP-Cron is not executing as expected.
    5. Verify that your site is receiving regular traffic or configure a server-level cron job to trigger wp-cron.php reliably. Many managed WordPress hosts provide alternate cron systems that can be enabled.
    6. If using a page caching plugin, ensure that WP-Cron requests are not being cached. MemberPress caching configuration guides provide specific instructions for popular caching plugins.

    2) Reminder Emails Are Not Being Received by Gifters

    Emails may be sent by WordPress but not delivered to the gifter’s inbox due to email deliverability issues. This is commonly caused by improper SMTP configuration or emails being marked as spam.

    How to Test/Fix:

    1. Verify your site’s outgoing email configuration by sending a test email through Dashboard > MemberPress > Gift Report > Reminders.
    2. Check the email spam folder to confirm whether emails are being marked as spam.
    3. Install an SMTP plugin such as WP Mail SMTP to improve email deliverability.
    4. Configure proper SPF and DKIM records for your domain to prevent emails from being flagged as spam.
    5. Test reminder email delivery again after configuring SMTP.

    3) Duplicate Reminder Emails Are Being Sent

    If reminders are sent more than once for the same unclaimed gift, this is typically caused by duplicate cron events being scheduled in WordPress.

    How to Test/Fix:

    1. Install and activate the WP Crontrol plugin.
    2. Navigate to Dashboard > Tools > Cron Events.
    3. Search for the gift reminder cron event and check if multiple instances of the same event are scheduled.
    4. Delete duplicate cron events by clicking Delete next to each duplicate entry.
    5. Navigate to Dashboard > MemberPress > Gift Report > Reminders and click Save Settings to reset the scheduled cron event.
    6. Verify that only one instance of the reminder cron event is scheduled by checking Tools > Cron Events again.

    4) Reminder Emails Use Incorrect Template or Variables

    If reminder emails display incorrect information or use the wrong template, this is usually caused by an outdated cached template or incorrect template override path.

    How to Test/Fix:

    1. Clear your site’s cache completely, including any server-level caching, CDN caching, and WordPress object cache.
    2. Verify that the customized template file is located in the correct path: /wp-content/themes/[[YOUR-THEME-NAME]]/memberpress-gift-reporter/emails/reminder-email.php
    3. Confirm that the template uses the correct variable syntax. Variables should be wrapped in PHP echo statements, such as <?php echo $product_name; ?>.
    4. Send a test email from Dashboard > MemberPress > Gift Report > Reminders to verify that the template is loading correctly.

    Understanding How WP-Cron Works for Reminder Scheduling

    WordPress uses WP-Cron to schedule time-based tasks such as automatic gift reminders. Unlike traditional server cron jobs that run at specific times regardless of traffic, WP-Cron is triggered by page loads. This means that scheduled tasks are checked and executed only when someone visits your site.

    For low-traffic sites, this can cause scheduled reminders to be delayed. For high-traffic sites with aggressive page caching, WP-Cron may not trigger at all because cached pages do not execute WordPress PHP code.

    To ensure reliable reminder delivery, consider implementing one of the following solutions:

    • Configure a server-level cron job to trigger wp-cron.php at regular intervals (recommended);
    • Use your hosting provider’s alternate cron system if available (such as WP Engine’s Alternate Cron);
    • Ensure that your caching plugin does not cache requests to wp-cron.php;
    • Install a plugin that monitors and improves WP-Cron reliability.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Developer Documentation

    Additional References

  • How to Reconnect Subscriptions and Transactions When a Membership Is Removed

    Summary

    This document provides instructions for reconnecting existing subscriptions and transactions to a new membership when the original membership has been removed from MemberPress. The solution uses SQL database queries to update product associations, ensuring that customer subscription data and transaction history remain intact after membership deletion.

    When a membership is accidentally deleted or needs to be replaced, all associated subscriptions and transactions become orphaned in the database. This method updates the database records to point to a new membership, restoring proper functionality and maintaining customer access to purchased content.

    Troubleshooting

    Understanding the Issue

    When a membership is deleted from MemberPress, the associated subscriptions and transactions remain in the database but lose their connection to an active membership. This causes several problems:

    • Subscriptions become orphaned and cannot process recurring payments;
    • Transaction history appears disconnected from any membership;
    • Customer access may be lost if content rules depend on the membership;
    • Reports and analytics show incomplete or inaccurate data;
    • Gateway communication fails for subscription renewals.

    The membership ID stored in the database tables no longer references a valid membership, requiring manual database updates to restore proper functionality.

    Reconnecting Subscriptions and Transactions

    1) Orphaned Subscriptions After Membership Deletion

    When a membership is deleted, active subscriptions continue to exist in the database but reference a membership ID that no longer exists. This prevents recurring payment processing and breaks the relationship between subscribers and their purchased content.

    How to Test/Fix:

    1. Create a complete database backup before proceeding. This can be done through your hosting control panel, phpMyAdmin export function, or a backup plugin.
    2. Identify the old membership ID (the deleted membership) and the new membership ID (the replacement membership).
    3. Access your database management tool (typically phpMyAdmin through your hosting control panel).
    4. Select the correct database for your WordPress installation.
    5. Navigate to the SQL tab.
    6. Verify your database table prefix by checking the wp-config.php file for the $table_prefix value. The default prefix is wp_, but your installation may use a different prefix.
    7. Prepare the SQL query to update subscriptions by replacing [[NEW_MEMBERSHIP_ID]] with your actual new membership ID and [[OLD_MEMBERSHIP_ID]] with your actual old membership ID.
    8. If your table prefix is not wp_, replace it with your actual prefix in the query below.
    UPDATE wp_mepr_subscriptions SET product_id = [[NEW_MEMBERSHIP_ID]] WHERE product_id = [[OLD_MEMBERSHIP_ID]];
    1. Review the query carefully to ensure all IDs and table prefixes are correct.
    2. Execute the query by clicking Go.
    3. Note the success message showing the number of affected rows.
    4. Navigate to Dashboard > MemberPress > Subscriptions.
    5. Verify that subscriptions now display the correct membership association.

    2) Disconnected Transaction History After Membership Deletion

    Transaction records remain in the database after membership deletion but become disconnected from the membership product. This breaks reporting, prevents proper access control evaluation, and disrupts customer account history displays.

    How to Test/Fix:

    1. Ensure you have a current database backup from the previous steps.
    2. Access phpMyAdmin and select your WordPress database.
    3. Navigate to the SQL tab.
    4. Prepare the transaction update query by replacing [[NEW_MEMBERSHIP_ID]] with your actual new membership ID and [[OLD_MEMBERSHIP_ID]] with your actual old membership ID.
    5. If your table prefix is not wp_, replace it with your actual prefix in the query below.
    UPDATE wp_mepr_transactions SET product_id = [[NEW_MEMBERSHIP_ID]] WHERE product_id = [[OLD_MEMBERSHIP_ID]];
    1. Review the query carefully to ensure all IDs and table prefixes are correct.
    2. Execute the query by clicking Go.
    3. Note the success message showing the number of affected rows.
    4. Navigate to Dashboard > MemberPress > Transactions.
    5. Search for transactions that should now be connected to the new membership.
    6. Verify that transactions display the correct membership name.
    7. Test creating a new transaction or processing a subscription renewal to confirm functionality.

    Example Implementation

    If your database table prefix is nbu_, your old membership ID is 456, and your new membership ID is 789, the complete queries would be:

    UPDATE nbu_mepr_subscriptions SET product_id = 789 WHERE product_id = 456;
    UPDATE nbu_mepr_transactions SET product_id = 789 WHERE product_id = 456;

    These queries update all subscription and transaction records that reference membership ID 456 to instead reference membership ID 789, effectively reconnecting all historical data to the new membership.

    Important: Direct database modifications are permanent and cannot be undone without restoring from backup. Always create a complete database backup before executing SQL queries. If you are uncertain about any step, consult with a developer or database administrator before proceeding.

    Verification Steps

    After executing both queries, perform these verification steps to ensure the updates were successful:

    1. Navigate to Dashboard > MemberPress > Subscriptions.
    2. Filter or search for subscriptions that were previously connected to the old membership.
    3. Confirm each subscription now displays the new membership name in the Membership column.
    4. Navigate to Dashboard > MemberPress > Transactions.
    5. Search for transactions that should be associated with the new membership.
    6. Verify the Membership column shows the correct membership name.
    7. Select a customer account and view their transaction history to confirm proper display.
    8. Test subscription functionality by processing a manual renewal or waiting for an automatic renewal.
    9. Verify that content access rules work correctly for affected customers.
    10. Check that membership-specific reports show accurate data.

    Additional Considerations

    • This solution only updates the database associations and does not modify payment gateway records;
    • If the new membership has different pricing or terms, existing subscriptions will maintain their original subscription terms;
    • Gateway webhooks and IPN notifications will continue to reference the original subscription data at the gateway level;
    • Content access rules must be configured for the new membership to ensure customers maintain proper access;
    • If the old and new memberships had different content access configurations, customer access may change after this update;
    • This method is suitable for standard MemberPress installations. Custom database modifications or third-party integrations may require additional considerations.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Additional References

  • How to Restrict Transaction Action Links by User Role in MemberPress

    Summary

    MemberPress allows multiple WordPress users with different roles to access the WordPress admin dashboard. However, certain user roles may require restricted access to transaction management actions to prevent unauthorized modifications or deletions of payment records.

    This document provides a solution for restricting transaction action links (such as Refund, Delete, or Edit) in the MemberPress transactions table based on specific WordPress user roles. The solution uses the mepr_admin_txn_row_action_links filter to conditionally hide transaction actions for designated roles while maintaining full access for administrators and other authorized roles.

    This functionality is essential for membership sites that grant backend access to customer service representatives, order viewers, or other limited-permission staff members who need to view transaction data without the ability to modify or delete critical payment records.

    Troubleshooting

    Implementing Role-Based Transaction Action Restrictions

    1) Users With Limited Roles Can Modify or Delete Transactions

    By default, WordPress users with admin dashboard access can view and interact with MemberPress transactions based on their capabilities. Some sites require certain roles to view transaction data without the ability to perform actions like refunding, deleting, or editing transactions. This prevents accidental or unauthorized changes to critical payment records.

    How to Test/Fix:

    Add the following code snippet to restrict transaction action links for specific user roles. This code uses the mepr_admin_txn_row_action_links filter to remove action links from the transactions table for users assigned to restricted roles.

    // Remove transaction actions for specific roles
    add_filter('mepr_admin_txn_row_action_links', function($links, $rec, $txn) {
        $user = wp_get_current_user();
        
        // Define the roles that should have no transaction action links
        $restricted_roles = ['order_viewer', 'subscriber', 'customer'];
        
        // Check if the user has any of the restricted roles
        if (array_intersect($restricted_roles, (array) $user->roles)) {
            $links = []; // Empty links array
        }
        
        return $links;
    }, 99, 3);

    Implementation Steps:

    1. Navigate to Dashboard > Plugins and install the WPCode plugin if not already installed.
    2. Go to Dashboard > Code Snippets > Add Snippet.
    3. Click Add Your Custom Code (New Snippet).
    4. Set the code type to PHP Snippet.
    5. Copy and paste the code snippet above into the code editor.
    6. In line 5 of the code snippet, update the $restricted_roles array with the specific WordPress user roles that should not see transaction action links.
    7. Set the snippet to Active.
    8. Click Save Snippet.
    9. Log out and log back in as a user with one of the restricted roles to verify that transaction action links are hidden.
    10. Navigate to Dashboard > MemberPress > Transactions to confirm that the actions (Refund, Delete, Edit) are not visible for restricted roles.

    Important: This code only hides transaction action links in the WordPress admin interface. It does not modify underlying WordPress capabilities or permissions. Users with sufficient capabilities may still access transaction modification functions through direct URLs or other methods. For complete permission control, consider using a role management plugin like Members or User Role Editor to restrict MemberPress-specific capabilities.

    2) Code Snippet Needs to Be Added to Child Theme Instead of Plugin

    Some sites prefer to add custom code directly to their child theme rather than using a code snippets plugin. This approach keeps customizations within the theme files and may be preferred for sites with custom development workflows.

    How to Test/Fix:

    1. Connect to your site via FTP or through your hosting control panel file manager.
    2. Navigate to /wp-content/themes/[[YOUR_CHILD_THEME_NAME]]/.
    3. Open the functions.php file for editing.
    4. Add the code snippet from the previous section to the bottom of the file.
    5. Update the $restricted_roles array with the appropriate role names.
    6. Save the file and upload it back to the server if using FTP.
    7. Test by logging in as a user with a restricted role and verifying that transaction actions are hidden.

    Critical: Always use a child theme when adding custom code to theme files. Adding code directly to a parent theme will cause all customizations to be lost when the theme is updated. If you do not have a child theme, create one before proceeding or use the WPCode plugin method instead.

    3) Determining the Correct User Role Names for Restriction

    WordPress role names (also called role slugs) are not always obvious and may differ from their display names. Custom roles created by plugins or theme frameworks may have non-standard naming conventions. Using incorrect role names in the $restricted_roles array will prevent the code from functioning correctly.

    How to Test/Fix:

    1. Install and activate the User Role Editor plugin.
    2. Navigate to Dashboard > Users > User Role Editor.
    3. Select the role you want to restrict from the dropdown menu.
    4. Note the role slug displayed in parentheses next to the role display name (for example, “Order Viewer (order_viewer)”).
    5. Add the role slug (not the display name) to the $restricted_roles array in the code snippet.
    6. Repeat for all roles that should have restricted transaction access.
    7. Save the code snippet and test with each role to confirm restrictions are applied correctly.

    Alternatively, you can retrieve all user roles programmatically by adding this temporary code snippet:

    // Temporary: Display all user roles (remove after use)
    add_action('admin_notices', function() {
        global $wp_roles;
        echo '<div class="notice notice-info"><pre>';
        print_r($wp_roles->get_names());
        echo '</pre></div>';
    });

    This will display all available roles and their slugs at the top of the WordPress admin dashboard. Remove this code after identifying the correct role names.

    4) Users With Multiple Roles Need Different Permission Levels

    Some WordPress sites assign multiple roles to individual users using role management plugins. The code snippet uses array_intersect() to check if any of the user’s assigned roles match the restricted roles list. This ensures that even users with multiple roles will have transaction actions hidden if they possess any restricted role.

    How to Test/Fix:

    If you need more granular control over users with multiple roles, modify the code logic to use array_diff() instead. This approach will only restrict actions if all of the user’s roles are in the restricted list:

    // Remove transaction actions only if ALL user roles are restricted
    add_filter('mepr_admin_txn_row_action_links', function($links, $rec, $txn) {
        $user = wp_get_current_user();
        
        // Define the roles that should have no transaction action links
        $restricted_roles = ['order_viewer', 'subscriber', 'customer'];
        
        // Check if ALL user roles are in the restricted list
        if (!array_diff((array) $user->roles, $restricted_roles)) {
            $links = []; // Empty links array
        }
        
        return $links;
    }, 99, 3);

    Use this variation if you want to allow transaction actions when a user has at least one non-restricted role alongside restricted roles.

    Testing and Verification

    After implementing the code snippet, perform the following tests to ensure the restrictions are working correctly:

    1. Log in as an administrator and verify that all transaction action links remain visible.
    2. Log in as a user with a restricted role and confirm that no action links appear in the transactions table.
    3. Log in as a user with a non-restricted role (but not administrator) and verify that appropriate actions remain available.
    4. If using a role management plugin, test with users assigned multiple roles to confirm expected behavior.
    5. Clear any caching plugins or browser cache before testing.
    6. Test on both desktop and mobile browsers to ensure consistent behavior across devices.

    Common Issues and Solutions

    Code Snippet Does Not Take Effect

    • Verify that the code snippet is set to Active in WPCode or properly saved in the child theme functions.php file;
    • Check for PHP syntax errors by enabling WordPress debug mode;
    • Clear all caching (server-side, plugin-based, and browser cache);
    • Ensure role names in the $restricted_roles array exactly match the WordPress role slugs.

    Transaction Actions Still Visible for Restricted Roles

    • Verify the user is assigned the correct role by checking Dashboard > Users;
    • Confirm the role slug matches what is specified in the code (use User Role Editor to check);
    • Check if another plugin or theme is adding its own transaction action links using a different filter hook;
    • Increase the filter priority from 99 to 999 if another function is overriding the restriction.

    Website Shows Critical Error After Adding Code

    • This indicates a PHP syntax error in the code snippet;
    • Access the site via FTP or hosting file manager and remove the code from functions.php;
    • If using WPCode, access the database directly and set the snippet status to inactive;
    • Review the code for missing brackets, semicolons, or other syntax issues;
    • Test the code in a staging environment before applying to production.

    Public Facing Documentation / Additional References

    Public Facing Documentation

    Developer Documentation

    Additional References