WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
Email notification when a user edits their info (4 posts)

  1. yanks789
    Member
    Posted 1 year ago #

    You plugin allows for notification when a user registers, but is it possible to get a notification when information is changed? Is there an edit that I need to make to allow for this?

    http://wordpress.org/extend/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    That could be done, but it wouldn't be a simple process.

    Using a combination of the wpmem_pre_update_data and wpmem_post_update_data action hooks, you could compare the user's currently recorded information with what they are updating, and if an update is made, generate an email notification.

  3. yanks789
    Member
    Posted 1 year ago #

    I am pretty familiar with WordPress and coding but am not familiar with the action hooks and making it work with the existing plugin. Can you help me with the action hooks? Or give me a little direction on how to go about this?

  4. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    Sure - action hooks are places you can hook a function to to do certain things, in this case look at if a user is changing information, and then if so, sending an email.

    Take a look at the WP Codex for information on add_action.

    For example, you are going to hook a function to the wpmem_pre_update_data hook it would be something like:

    add_action( 'wpmem_pre_update_data', 'my_function' );

    Then my_function could look at the existing data that a user has in the db, to determine if what they are submitting is in any way different.

    Then you would write a second function and hook it to wpmem_post_update_data (which comes after the action data has been updated).

    add_action( 'wpmem_post_update_data', 'my_other_function' );

    In my_other_function, you would send and email (probably using wp_mail) if my_function resulted in a situation where data was in fact being updated.

    Note: it will be important to reference the hook documentation referenced above for these hooks - they are similar - so that you know what parameters are passed to the action. In this case, $fields is passed, which is an array containing all of the posted data.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.