• Resolved pankajpatil

    (@pankajpatil)


    Following rest api call is stopped working after the last update

    $request1 = new WP_REST_Request( 'POST', '/mpp/v2/profile-image/me' );
    $request1->set_param( 'media_id', $attachment_id );
    $request1->set_header( 'X-WP-Nonce', wp_create_nonce( 'wp_rest' ) );
    $response1 = rest_do_request( $request1 );

    I am getting “user is not owner error”. Although I am authenticating the user in my custom rest api call.

Viewing 11 replies - 1 through 11 (of 11 total)
  • We are facing same issue. Please fix the api endpoint.

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    I changed it so that you either have to be the owner of the media file or have editor and above privileges. Let’s see if that fixes it for you in 2.2.6.

    Thanks,

    Ronald

    Thread Starter pankajpatil

    (@pankajpatil)

    Its not working for me, although I am able to get the current user in jwt and its uploading the image with the same user but while assigning that attachment id using rest api call after upload I am still getting “You must have a role of editor or above to set a new profile image.”.

    I am still not able to assign the image uploaded using the custom rest api call using rest api call.

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    Okay, I’ll do more testing. Sorry about that and thanks for your patience.

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    I’ve just pushed out a fix. Note, you must be editor or above to edit the profile picture in my testing.

    Thread Starter pankajpatil

    (@pankajpatil)

    That means I cannot allow my candidate users to update there profile image?

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    What role are your candidate users? I can lax the permissions to upload the profile. The goal is to not allow users to change the profile pictures of others.

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    It almost sounds like I need a new endpoint that passes the user_id and media_id to the endpoint.

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    Here’s the new endpoint in 2.2.8. It should be more lax regarding permissions. It just requires the user to have upload privileges.

    https://mediaron.com/user-profile-picture/#rest-other-profiles

    Thread Starter pankajpatil

    (@pankajpatil)

    WOW that did solved my issue. Thank you ronald for creating that endpoint.

    Thank you for your support and timely response.

    Plugin Contributor Ronald Huereca

    (@ronalfy)

    Cool! I’d appreciate a rating if you haven’t already done so.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘REST api stopped working’ is closed to new replies.