• Hi, Am!n.
    First, a big thank for the plugin. It is a quick but powerful solution for my need , i.e. send verification mail to new users created via REST-API.
    Actually, in order to reach full functionality I had to comment out the wp_redirect(); and exit; lines in your code.
    I’m working at a project which uses a WordPress backend (accessed by REST-API) facing an Angular Frontend.
    Your plugin would be the perfect match, if it would let me choose completely custom urls for the redirects, and give the possibility to disable any redirect right after user registration.
    Very useful anyway. It does what other, much more famous plugins (ThemeMyLogin or ProfileBuilder, just to mention some) don’t!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dornaweb

    (@dornaweb)

    Hi i’m glad that you liked the plugin,
    see this topic
    i think it’s related to what you need.

    Thread Starter caraffande

    (@caraffande)

    Yes, Amin, could be. The trick of the low priority could be another way to achieve the same result as my commenting out the exit(); line.
    In my case, however, I need a little more. I’d need a way to disable redirects completely.
    Actually I’m registering new users ONLY via AJAX (and REST-API). Any redirect (if any at all) must be handled client-side. The PHP script must NOT send any other header (such as ‘redirect’) since the response to the AJAX call, with all the relevant headers, needs to be constructed within the end-point’s callback.
    Any (potentially) redirecting header (like 30X) is very likely to trigger an error in the client, at least in Angular implementation.
    A quick but clean fix would be, for instance, that no redirect is actually performed (no ‘redirect’ header is sent) if the “Redirect” field in the plugin’s settings is left empty. Or, maybe, redirect if and only if we’re not DOING_AJAX or DOING_REST_API.
    In any case, thanks again for your job!

    Thread Starter caraffande

    (@caraffande)

    P.S.: I’ve also added this in the constructor

            add_action( 'rest_api_init', function () {
                register_rest_route( 'dornaweb/v1', '/email-verify/link/send', array(
                       'methods' => 'POST',
                       'callback' => function ($request) {
                           $user_login = sanitize_text_field($request->get_param('email'));
    
                           if ( empty( $user_login) )
                           {
                               return ['ok' => false];
                           }
    
                           $user = get_user_by( 'email', trim( $user_login ) );
                           if ( empty( $user ) )
                           {
                               return ['ok' => false];
                           }
    
                           $this->send_verification_link( $user->ID );
    
                           // Success
                           return ['ok' => true];
                       }
                    )
                );
            });
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Full support for REST-API’ is closed to new replies.