Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Support request] Content of notification email to admin when member edits their profile

Simple Membership Plugin › Forums › Simple Membership Plugin › Content of notification email to admin when member edits their profile

  • This topic has 6 replies, 2 voices, and was last updated 7 months, 1 week ago by Davo.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • February 25, 2026 at 5:01 pm #31932
    Davo
    Participant

    Hello

    I currently receive a notification email when a member edits/updates their profile on the website. The content of this email is (I have replaced the numbers with n’s):

    Details:\n\nArray
    (
    [phone] => nnnnn nnnnnn
    [member_id] => nn
    )

    Is it possible for this notification email to show all the fields that the member has edited/updated?

    Thanks

    February 26, 2026 at 1:23 am #31933
    The Assurer
    Moderator

    Yes, this is possible — but not with the default behavior out of the box.
    What you are currently seeing:
    Details:

    Array
    (
    [phone] => nnnnn nnnnnn
    [member_id] => nn
    )

    means that the email is printing the raw $fields array, and only the fields that were processed in that particular hook are being included (not a full profile snapshot).

    Why This Happens

    When a member updates their profile, the plugin triggers a notification using the updated fields array. That array typically only contains:

    The fields that were submitted
    Or sometimes only a subset of processed fields
    It does not automatically fetch all profile fields from the database.
    So by default, the email only shows what was passed to that function — not the full member record.

    Recommended Solution – Modify the Email to Pull Full Member Data

    Instead of printing the $fields array directly, you can fetch the full member record from the database using the member ID and include all fields in the email.

    Here is an example approach:

    add_action(‘swpm_member_profile_updated’, ‘my_custom_profile_update_email’, 10, 2);
    function my_custom_profile_update_email($member_id, $fields) {

    global $wpdb;
    $table_name = $wpdb->prefix . “swpm_members_tbl”;

    // Get full member record
    $member = $wpdb->get_row(
    $wpdb->prepare(“SELECT * FROM $table_name WHERE member_id = %d”, $member_id),
    ARRAY_A
    );

    if (!$member) {
    return;
    }

    $body = “Member profile updated.\n\nFull Details:\n\n”;

    foreach ($member as $key => $value) {
    $body .= $key . ” => ” . $value . “\n”;
    }

    wp_mail(
    get_option(‘admin_email’),
    ‘Member Profile Updated’,
    $body
    );
    }

    This will send the complete member record instead of just the edited fields.

    February 26, 2026 at 7:00 am #31934
    Davo
    Participant

    The Assurer… many thanks for your prompt reply.

    Could you please remind me on where I would add your recommended code.

    KRs
    Davo

    March 2, 2026 at 2:59 pm #31936
    The Assurer
    Moderator

    (Recommended): Add It to Your Theme’s functions.php
    Steps:

    Go to your WordPress Dashboard

    Navigate to:
    Appearance → Theme File Editor

    Open the file:

    functions.php

    Scroll to the bottom

    Paste the custom code there

    Click Update File

    That’s it.

    ⚠️ Note:
    If you change themes later, you will lose this code.

    March 5, 2026 at 11:15 am #31952
    Davo
    Participant

    Hi The Assurer

    I added the code to the bottom of the functions.php file of the website child theme, which already had code relating to “allowing SWPM members to access downloads via Download Monitor”, however I got a critical error.

    Error Details
    =============
    An error of type E_PARSE was caused in line 83 of the file /home/*****/public_html/wp-content/themes/themify-ultra-child/functions.php. Error message: syntax error, unexpected variable “$table_name”, expecting “)”

    Could there be a conflict?
    Thanks

    March 6, 2026 at 3:16 am #31953
    The Assurer
    Moderator

    A syntax error usually means something wass mistyped.

    If you want to check for conflicts, please see:
    https://simple-membership-plugin.com/forums/topic/test-for-plugin-and-theme-conflict-before-posting-an-issue-or-a-bug/

    March 6, 2026 at 3:03 pm #31957
    Davo
    Participant

    I did a cut and paste to avoid typing errors. I’ll have a look at the conflict checks and advise.
    Thanks

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy