• Resolved JeffreyPia

    (@jeffreypia)


    Hi!

    Love your plugin – does exactly what we need for our site.

    We’ve run into one last roadblock: we’re adding new functionality to streamline new user registration using Gravity Forms + User Registration & Invite Codes add-ons. Can you advise how I can whitelist a url with dynamically generated query string value? This is the format:

    https://my.domain.com/?page=gf_activation&key=rand0ma1phanum3rics

    Thanks in advance!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter JeffreyPia

    (@jeffreypia)

    Managed to get this to work:

    $urlActivationPage = site_url('/?page=gf_activation');
    if( substr( site_url( $_SERVER['REQUEST_URI'] ), 0, strlen( $urlActivationPage ) ) === $urlActivationPage ) {
    	$whitelist[] = site_url( $_SERVER['REQUEST_URI'] );
    }

    Let me know if there’s a better method

    Plugin Author Kevin Vess

    (@kevinvess)

    You could try this instead:

    /**
     * Filter Force Login to allow exceptions for specific URLs.
     *
     * @return array An array of URLs. Must be absolute.
     **/
    function my_forcelogin_whitelist( $whitelist ) {
      if( $_GET['page'] == 'gf_activation' ) {
        $whitelist[] = site_url($_SERVER['REQUEST_URI']);
      }
      return $whitelist;
    }
    add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);
    Thread Starter JeffreyPia

    (@jeffreypia)

    Ah, that’s a lot more elegant. Thanks Kevin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Whitelist new user activation link’ is closed to new replies.