• Resolved andreslora09

    (@andreslora09)


    Hello, I am trying to use this plugin, but after I installed it I’m getting these warnings / errors:

    <b>Fatal error</b>: Uncaught Error: Call to undefined function bdpwr_send_password_reset_code_email() in
    /var/www/HIDDEN_PROJECT_NAME/wp-content/plugins/bdvs-password-reset/inc/class/class.user.php:71
    Stack trace:
    #0
    /var/www/HIDDEN_PROJECT_NAME/wp-content/plugins/bdvs-password-reset/inc/api/api.route.reset-password.php(29):
    BDPWR_User->send_reset_code()
    #1 /var/www/HIDDEN_PROJECT_NAME/wp-includes/rest-api/class-wp-rest-server.php(1160):
    {closure}(Object(WP_REST_Request))
    #2 /var/www/HIDDEN_PROJECT_NAME/wp-includes/rest-api/class-wp-rest-server.php(1007):
    WP_REST_Server->respond_to_request(Object(WP_REST_Request), ‘/bdpwr/v1/reset…’, Array, NULL)
    #3 /var/www/HIDDEN_PROJECT_NAME/wp-includes/rest-api/class-wp-rest-server.php(440):
    WP_REST_Server->dispatch(Object(WP_REST_Request))
    #4 /var/www/HIDDEN_PROJECT_NAME/wp-includes/rest-api.php(354):
    WP_REST_Server->serve_request(‘/bdpwr/v1/reset…’)
    #5 /var/www/HIDDEN_PROJECT_NAME/wp-includes/class-wp-h in
    <b>/var/www/HIDDEN_PROJECT_NAME/wp-content/plugins/bdvs-password-reset/inc/class/class.user.php</b> on line

    I am using JWT Auth plugin, I added the endpoints to whitelist, also I tried deactivating JWT Auth Plugin but and I am still getting the errors, so I think is has nothing to do with that plugin.

Viewing 15 replies - 1 through 15 (of 34 total)
  • Plugin Author dominic_ks

    (@dominic_ks)

    Hello @andreslora09,

    An odd one, I wouldn’t have thought this has anything to do with the JWT plugin as you say.

    The function that it says is undefined is in the /inc/email/functions.php file, can you check if you have that file?

    If it’s missing for some reason you might need to delete and reinstall the plugin.

    Cheers,

    Thread Starter andreslora09

    (@andreslora09)

    Hi, thanks for the quick answer.

    The function is there:

    function bdpwr_send_password_reset_code_email( $email = false , $code = false , $expiry = 0 )

    Still getting the error tho. I also tried reinstalling the plugin.

    Plugin Author dominic_ks

    (@dominic_ks)

    Hmmm, not sure how to diagnose that without being able to debug. Can you tell me about your server setup there? All WP & plugins up to date? Do you by chance have your WP install in a subdirectory like example.com/my-wp-site – ?

    Thread Starter andreslora09

    (@andreslora09)

    I’m working this changes on localhost server.

    Example path:

    /Users/HIDDEN_USER/Projects/HIDDEN_AUTHOR/HIDDEN_PROJECT/wp-content/plugins/bdvs-password-reset/inc/email/functions.php

    No, I dont have WP install in a subdirectory.

    I also tried testing it on forge staging server, isn’t working there tho.

    Everything es up to date, my current wordpress version is 5.6.1.

    It’s really weird :thinkingface

    Plugin Author dominic_ks

    (@dominic_ks)

    So you are just accessing this like https://localhost/wp-json/bdpwr/v1/reset-password ?

    Thread Starter andreslora09

    (@andreslora09)

    Thread Starter andreslora09

    (@andreslora09)

    Anything else I should try? This plugin does what I need, I just have to make it work

    Plugin Author dominic_ks

    (@dominic_ks)

    Hello,

    Sorry have been trying various things to reproduce this error but I can’t get at it.

    What are you developing with locally? WAMP? XAMP? Are you able to confirm if you’ve tried this with a bare WP install? i.e. no other plugins active and the default theme?

    Cheers,

    Thread Starter andreslora09

    (@andreslora09)

    Hello,

    I tried disabling all plugins but this one and still getting the same error =/

    I am working on docker with laradock ecosystem, I have another wordpress sites, and I’m not having problem with them.

    I’m testing this endpoint through postman, sending a POST to https://dev.HIDDENPROJECT.io/wp-json/bdpwr/v1/reset-password passing my email in a x-www-form-urlencoded.

    If I sent an empty email I got this:

    {
    “code”: “no_email”,
    “message”: “You must provide an email address.”,
    “data”: {
    “status”: 400
    }
    }

    Which means it works until it try to call bdpwr_send_password_reset_code_email.

    Thread Starter andreslora09

    (@andreslora09)

    I modify your plugin a bit and it worked:

    In class.user.php I added bdpwr_send_password_reset_code_email (which was in functions.php of your plugin) and also modify this line:

    return $this->bdpwr_send_password_reset_code_email( $email , $code , $expiration );

    Then I got:

    {
    “data”: {
    “status”: 200
    },
    “message”: “A password reset email has been sent to your email address.”
    }

    What do you think?

    Plugin Author dominic_ks

    (@dominic_ks)

    Yeah that’s fine as a workaround but if you ever update the plugin you will lose that change and it will stop working again.

    I’ll be honest though, I have no idea why this is happening. I don’t think I’ll be able to recreate your development set up. All I can think is that there’s something odd about how the files are being loaded but I’m not sure what to suggest at this point.

    I assume this is on Linux, what version of PHP are you using?

    Thread Starter andreslora09

    (@andreslora09)

    I’m using PHP Version 7.2.15 in local enviroment.

    I have an extra question and you can forget about this issue. I would like to translate the messages response, the only way I see is to modify the plugin directly as I did to fix the issue I had, Am I right?

    Thanks for the help!

    Plugin Author dominic_ks

    (@dominic_ks)

    Do you mean the messages that come back from the API? If so, yes at the moment that’s the only way, but we could add filters for these…

    Thread Starter andreslora09

    (@andreslora09)

    Thanks for the help, I appreciate it.

    Plugin Author dominic_ks

    (@dominic_ks)

    No problem!

    Did just have a couple of thoughts on the original issue:

    I’m wondering if the order that the files are included could cause the issue, perhaps you could try editing the inc/inc.php file and moving the line that says include_once( 'email/email.php' ); above the line that says include_once( 'api/api.php' );

    Failing that, I also wonder if it is perhaps unhappy that there are two files named functions.php, and wonder if you could try moving the bdpwr_send_password_reset_code_email function to the inc/functions.php file?

    Appreciate you’ve worked around this issue for now, but it’d be good if we could prevent others running into the same problem.

    Cheers,

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘Uncaught Error: Call to undefined function bdpwr_send_password_reset_code_email(’ is closed to new replies.