Support » Plugin: Password Reset with Code for WordPress REST API » Uncaught Error: Call to undefined function bdpwr_send_password_reset_code_email(

  • 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 - 16 through 30 (of 34 total)
  • Thread Starter andreslora09

    (@andreslora09)

    Sorry I didn’t reply earlier, I was sick. Adding bdpwr_send_password_reset_code_email to inc/functions.php made it work!

    Are you going to commit an update?

    Plugin Author dominic_ks

    (@dominic_ks)

    @andreslora09 No worries, thanks for getting back to me. Yes I’ll push an update with that function moved, I’ll let you know when it’s done!

    Plugin Author dominic_ks

    (@dominic_ks)

    @andreslora09 And to confirm that is now done! You should look for V0.0.11 which is the latest published version.

    I moved the function in question, but while I was at it I have added translation functions to all of the strings in the plugin, including exception messages, so hopefully this helps you as well?

    Please do let me know how you get on, and of course if you want to contribute translations then that’d be great!

    Thread Starter andreslora09

    (@andreslora09)

    Awesome, I updated it.

    How can i translate the messages? I saw you add the message like this:

    return new WP_Error( 'no_email' , __( 'You must provide an email address.' , 'bdvs-password-reset' ) , array( 'status' => 400 ));

    Could you explain me the proper way to translate it without modifying the plugin?

    Note: Sure, I could help with the spanish translation.

    Plugin Author dominic_ks

    (@dominic_ks)

    @andreslora09 well, that is the question! Ha! I’ll be honest I’ve never done anything to do with translations before. I haven’t had a chance to look into it too much, but I gather that this is the defacto tool:

    And there are a few guides around online, e.g.

    I’ll report back if I find more out about it but if this is enough to get you started then cool.

    Cheers,

    Thread Starter andreslora09

    (@andreslora09)

    Oh yeah, sure, I’ve done it before, I just thought there was a different way of doing it programmatically, but I did it twice or trice with poedit and other plugins.

    Thank you man!

    • This reply was modified 7 months, 3 weeks ago by andreslora09.
    Plugin Author dominic_ks

    (@dominic_ks)

    @andreslora09 no problemo!

    If you’re able to can you submit the translation as a PR on GitHub?

    Also would you mind leaving a review for this plugin on WP.org?

    Cheers!

    Thread Starter andreslora09

    (@andreslora09)

    If you’re able to can you submit the translation as a PR on GitHub?

    Sure, I’ll try to do it this week.

    Also would you mind leaving a review for this plugin on WP.org?

    Of course, I love this plugin.

    BTW, I want to customize the mail template, without losing it when the plugin release a new update, is possible?

    Plugin Author dominic_ks

    (@dominic_ks)

    Awesome thanks @andreslora09!

    Do you mean you want to customise the text that is sent in the email? If so, yes, you can do that with this:

    
    add_filter( 'bdpwr_code_email_text' , function( $text , $email , $code , $expiry ) {
      return $text;
    }, 10 , 4 );
    

    Cheers,

    Thread Starter andreslora09

    (@andreslora09)

    Hi @dominic_ks,

    I meant to modify the email templates with my own html and css recycling the functionality but with my design. I’ve done it before with woocommerce email templates, creating a copy of the files in my theme (so they wont be affected with updates) but I don’t know if i can do the same with this plugin.

    Thread Starter andreslora09

    (@andreslora09)

    Also, when i try to translate this plugin: This plugin is not properly prepared for localization (View detailed logs on Slack). If you would like to translate this plugin, please contact the author.

    I think you have to add a language folder to your plugin and include the .po file for the default language.

    Plugin Author dominic_ks

    (@dominic_ks)

    @andreslora09 Thanks, OK I’ll need to look into that some more.

    Re: the email template, I’d suggest that the template itself shouldn’t be part of this plugin since the email function just sends the content specific to this plugin to the recipient.

    Normally for something like this I’d suggest either using a plugin for wrapping a template around all outgoing emails, or using the wp_mail hook to filter the email details by wrapping an html template around the message body and being sure to add the correct content type to the headers.

    Cheers,

    Thread Starter andreslora09

    (@andreslora09)

    Got it, thank you man!

    Plugin Author dominic_ks

    (@dominic_ks)

    @andreslora09 FYI you should be good to go on translations now!

    Thread Starter andreslora09

    (@andreslora09)

    Cool, I already did the translation, can I get your email so i can send you the .po and .mo files.

    I used loco translate the plugin to translate the plugin, but anyone could make it work using the .po and .mo files.

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