Support » Plugin: Email verification on signups » Using wp_redirect on the user_register-hook prevents others from using that hook

  • The Plugin uses the user_register-hook, but not gently to others who use it, because it calls wp_redirect and prohibids later calls from been executed.

    As a workaround I added a low priority on the use of the hook in this plugin.

    Like this:
    Line 38 in email-verify.php
    ` add_action( ‘user_register’, [ $this, ‘user_register’ ], 1000 );

    So far this works.

Viewing 2 replies - 1 through 2 (of 2 total)
  • jasonb4u2

    (@jasonb4u2)

    Howdy, Can I ask you kindly to help me understand what this means, what it does, what is the result ?

    Just to know coz I dont know if need to add this code or not

    bas_der_gruene

    (@bas_der_gruene)

    In my setting I need to add additional fields to the registration form, because I need additional information from my users. The user_register-Hook is exactly for that purpose usable: It fires after the common data is saved, so I can handle the additional fields afterwards, so I can save, redact, do whatever I need to do with the knowledge of the now already registered user (with ID and so on).

    This plugin prohibits me from doing this, because if the add_action from the line 38 is called with default priority it may fire before my usage of the hook fires. Since this plugin uses wp_redirect (which stops all follow-up load of WordPress and starts new at the redirect-location) my custom function isn’t fired at all, and the additional information from my users is lost. The low priority of 1000 (default is 20) makes sure, the plugins use of the hook comes last.

    EDIT: Uuuh. Fun with denglish.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using wp_redirect on the user_register-hook prevents others from using that hook’ is closed to new replies.