Skip to:
Content
Pages
Categories
Search
Top
Bottom

On profile Update get posted fields


  • rakhisystematix
    Participant

    @rakhisystematix

    Hello Team,

    I need help with profile update code. When the user is updating general settings (password) before submitting to the database I want all posted fields and password as plain text with the username so that I can hit third-party API and send username and password as a parameter.

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

  • shanebp
    Moderator

    @shanebp

    Use this hook: xprofile_updated_profile
    More info in /bp-xprofile/screens/edit.php ~Line 127


    rakhisystematix
    Participant

    @rakhisystematix

    I tried this hook

    function something_updated_profile( $userId, $posted_field_ids, $errors, $old_values, $new_values ) {
    /*if ( empty( $errors ) ) {*/
    print_r( $posted_field_ids );
    echo “<br>user id: ” . $userId . “<br>”;
    print_r( $new_values ); die;
    /*}*/
    }
    add_action(‘xprofile_updated_profile’, ‘something_updated_profile’, 1, 3);

    But on the update of general settings (new password / confirm password) it’s not printing anything


    shanebp
    Moderator

    @shanebp

    Please use the code button when posting code.

    …it’s not printing anything

    That hook is found in a function that has a redirect after the hook, so you cannot dump to the screen.
    Trying writing to a debug log or actually changing something with your function.

    But more importantly – the settings code is not the same as the profile fields code.
    I apologize for not noticing that you said general settings and not profile fields in your OP.

    Try using this hook for Settings > General: bp_core_general_settings_after_save
    Found in bp-settings/actions/general.php
    Note that it does not pass any data – so you’ll need to get the data from $_POST.
    And the hook is followed by a redirect, so you cannot print to screen.


    shanebp
    Moderator

    @shanebp

    I think a good enhancement would be for this hook to pass some data: bp_core_general_settings_after_save
    Currently, there is no way to tell if there were errors.
    The same issue is found in the other files in bp-settings/actions/

    You can open an enhancement ticket here.
    Use the same login info you use for these forums.
    Include a reference to this thread in the ticket description.


    rakhisystematix
    Participant

    @rakhisystematix

    Hello Team,

    I tried using this hook bp_core_general_settings_after_save but in $_post I also want current username as well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar