Skip to:
Content
Pages
Categories
Search
Top
Bottom

Notification on Profile Update

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

  • r-a-y
    Keymaster

    @r-a-y

    There’s a `do_action` hook you can use:
    `xprofile_updated_profile` (located in /buddypress/bp-xprofile.php.)

    You could potentially use the wp_mail() function to send an email to the admin with this hook.

    Don’t know what a `do_action` is and how to make use of it?

    If you’re familiar with a tiny bit of PHP, here’s some articles that will help:
    http://www.nathanrice.net/blog/an-introduction-to-wordpress-action-hooks/
    https://codex.wordpress.org/Plugin_API#Actions

    Here’s something quick you can try:

    `function my_update_profile_send( $id ) {
    $text = bp_core_get_user_domain( $id );
    wp_mail( ‘YOUR ADMIN EMAIL ADDRESS’, ‘Profile Updated’, $text );
    }
    add_action( ‘xprofile_updated_profile’, ‘my_update_profile_send’ );`

    Put the code snippet in your theme’s functions.php.


    Steve
    Participant

    @steveholland

    Hi r-a-y,

    Thank-you very much for pointing me in the right direction and providing a useful example of how it can be implemented – it works too.

    This will greatly assist me in expanding other areas of the website also. I’m only new to buddypress but am slowly learning.

    Thanks again,
    Steve


    Steve
    Participant

    @steveholland

    Hi r-a-y,

    Almost two months after implementing this I have developed it further and it’s working great! Thanks again for your help.

    However, I am struggling to work out how I can implement this same function for status updates in addition to profile updates? Using your code, how would I need to edit it and where would it need to go?

    `
    function my_update_profile_send( $id ) {
    $text = bp_core_get_user_domain( $id );
    wp_mail( ‘YOUR ADMIN EMAIL ADDRESS’, ‘Profile Updated’, $text );
    }
    add_action( ‘xprofile_updated_profile’, ‘my_update_profile_send’ );
    `

    Cheers,
    Steve


    Steve
    Participant

    @steveholland

    Is anyone able to assist/point me in the right direction?


    Steve
    Participant

    @steveholland

    Where can I find a list of do_actions?

    I need to get a notification upon account email change and also status update. Can anyone help please?


    Steve
    Participant

    @steveholland

    Hi,

    I need the following: https://buddypress.trac.wordpress.org/ticket/2296

    Yet WordPress have closed their ticket, can anyone offer some support on this? Where can I add the above code?

    I need to know when someone changes their account email and also when someone updates their status.


    r-a-y
    Keymaster

    @r-a-y

    Hi Steve,

    Missed your mentions.

    do_actions can be found by searching for them. If you have a good search program, do a search for “do_action” throughout the /plugins/buddypress/ folder. (You’ll get a lot of results! It’s better to just sift through the code to find what you want though.)

    As for specifics, the do_action for activity updates is “bp_activity_add”:
    https://buddypress.trac.wordpress.org/browser/tags/1.2.9/bp-activity.php#L679

    The code snippet above will not work with this as the parameter for “bp_activity_add” is different.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Notification on Profile Update’ is closed to new replies.
Skip to toolbar