• Resolved manu2404

    (@manu2404)


    Hey there! How is it going?

    First, thank you so much for this plugin and for making it free, we really appreciate it.

    I would like to get a code example to whitelist some dynamic urls.

    Let’s say the domain I want to whitelist is
    xxxxxxx.com/unirse/?level=1

    What of the 3-4 code options would be the best and what do I have to change on them? Could you change it and make an example of how it would look applied to that URL?

    Thank you so much!

    Best,
    Manu

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

    (@kevinvess)

    Thanks for using Force Login! I’m glad you like it.

    To decided which method of whitelisting your dynamic URLs, I’d need to know more specifics.

    For example, if you want to whitelist the x.com/unirse/ URL regardless of the query string ?anything=whatever or none – I would suggest Method 1.

    If you want to whitelist only that exact URL, including the query string, then I would recommend this:

    /**
     * Filter Force Login to allow exceptions for specific URLs.
     *
     * @return array An array of URLs. Must be absolute.
     */
    function my_forcelogin_whitelist( $whitelist ) {
      // list of single page URLs
      $whitelist[] = site_url( '/unirse/?level=1' );
    
      return $whitelist;
    }
    add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);

    Lastly, if you’re asking to whitelist any page URL that has the query string parameter of ?level applied to it, or that specifically equals 1 – ?level=1 – I would recommend Method 3.

    Just change the example URLs to match your pages, parameters, and/or values to whitelist any URLs or combination of URLs you need.

    Thread Starter manu2404

    (@manu2404)

    Hey there Kevin, you’re amazing!

    Thanks for the example, I understood it and it worked perfectly. Also, thank you for the quick answer!

    Keep working on this

    Best,

    Plugin Author Kevin Vess

    (@kevinvess)

    Great! I’m glad you were able to get this resolved.

    Be sure to rate and review my plugin to let others know how you like it.

    Thanks for using Force Login!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Dynamic URL – Example’ is closed to new replies.