• I have the following shortcode:

    [wpmem_form register redirect_to="https://mysite.com/thank-you-for-registering"]

    I expect it to redirect to https://mysite.com/thank-you-for-registering after registering but that’s not what happens. It just redirects back to the same page with a “thanks for registering” message and an “existing users login” form.

    I have admin approval of new users turned on.

    • This topic was modified 5 years, 1 month ago by stevied.
    • This topic was modified 5 years, 1 month ago by stevied.
    • This topic was modified 5 years, 1 month ago by stevied.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter stevied

    (@stevied)

    I hacked the plugin as follows to get it to do what I want.

    In file includes/class-wp-members.php, modify the reg_securify function by commenting out a line:

    
    	function reg_securify( $content ) {
    		global $wpmem, $wpmem_themsg;
    		$nonce = wpmem_get( 'reg_nonce', false, 'get' );
    		if ( $nonce && wp_verify_nonce( $nonce, 'register_redirect' ) ) {
    			$content = wpmem_inc_regmessage( 'success', $wpmem_themsg );
    #			$content = $content . wpmem_inc_login();
    		}
    		return $content;
    	}
    

    Change signature for register_form function in includes/class-wp-members-forms.php to:

    function register_form( $mixed = 'new', $redirect_to = null ) {

    Finally, modify wpmem_register_form function in includes/api/api-forms.php:

    
    function wpmem_register_form( $args = 'new', $redirect_to = null ) {
      global $wpmem;
      return $wpmem->forms->register_form( $args, $redirect_to );
    }
    
    • This reply was modified 5 years, 1 month ago by stevied.
    Plugin Author Chad Butler

    (@cbutlerjr)

    The issue here is most definitely a bug. I’ll get that corrected in the next release.

    It’s the result of some changes implemented in 3.3.0 that are intended to provide some API functions for invoking the forms. The wpmem_register_form() function should have either carries the previous arguments (the same way the login form function did), or it should have been passing these values in the $args array. I’ll have to research it to determine what was intended.

    Your hack is pretty close to what the remedy will be; but I would note that in general you should never change plugin files. In this case, you’re fixing something that does definitely need correcting. However, absent an official fix in the next update, your changes would be overwritten when updating. Since this is noted and will be fixed, it’s a little different in this case, but it’s generally a bad practice so I mention it primarily in case someone else with less experience happens along this thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘redirect_to not working with registration form shortcode’ is closed to new replies.