Restrict Access to Wordpress Pages until WooCommerce Product Purchased - Free Code Snippets Cloud

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • Join our 'How to Start a Web Design Business' Course - and use strategies to grow, get clients, and generate recurring income: websquadron.co...
    Book your 1-2-1 Consultation: websquadron.co...
    Code: www.codesnippe...
    Restrict Access to Wordpress Pages until WooCommerce Product Purchased - Free Code Snippets Cloud
    We love to create - share - respond - and deliver.
    🧐 Learn with our Mastery Modules: websquadron.co...
    🔗 All of our Important Links: websquadron.co...
    😃 Join our Facebook Group: / 3309523509284305
    😃 Get Code Snippets Pro: r.freemius.com...
    😃 Get Elementor Pro: be.elementor.c...
    😃 Boost your RUclips Analysis: www.tubebuddy....
    👕 Get our Merchandise: websquadron.co...
    🥹 Support us: paypal.me/Webs...
    Hire us to work on your Website!
    💌 info@websquadron.co.uk
    👩‍💻 Visit websquadron.co.uk

Комментарии • 31

  • @RodrigoFlores
    @RodrigoFlores Год назад

    As always Imran, great info!

  • @katietimmons8444
    @katietimmons8444 3 месяца назад

    Would this work on the Ultimate Member plugin, giving the user access to all the member profiles? Or would I have to enter the code for each profile page individually? TIA

  • @IsotonikStudios
    @IsotonikStudios Год назад +1

    Wicked, thats the Product Dependancies plugin deactivated and deleted!!

  • @pixelgap
    @pixelgap Год назад

    Nice thanks Imran

  • @bencesugar4254
    @bencesugar4254 8 месяцев назад

    Hi, awesome video, a quick question, there are 3 codes, which do almost the same thing, do we need to use all 3 of them?

    • @websquadron
      @websquadron  8 месяцев назад

      No just use what you need

  • @gabrielk5497
    @gabrielk5497 Год назад

    This is a great upgrade of a similar video you made that replaced the Thank you page for the one you want depending on the product bought but it was public.
    So, the client would need to create an account in order to access in the future, right? And if they are in their dashboard where they can see their orders do you find any way for them to be redirected into this page that was created for this specific product?
    Thanks as always for sharing.

    • @websquadron
      @websquadron  Год назад

      A note could be added to the WooCommerce Product (inside the Product Details bit) that contains the URL for where they access the content.

    • @gabrielk5497
      @gabrielk5497 Год назад

      @@websquadron that's a good idea! The client would need to create an account to access the content, right?

  • @rocaivan
    @rocaivan Год назад

    Would you use a free LMS all-in-one for Elementor if there is one on the market?

    • @websquadron
      @websquadron  Год назад

      Maybe... but I'd want to be sure about what was free and what required a premium version.

  • @gellisrikar
    @gellisrikar 4 месяца назад

    Does this also work with Woo Subscriptions or any other subscriptions plugin?

    • @websquadron
      @websquadron  4 месяца назад

      Nope.

    • @gellisrikar
      @gellisrikar 4 месяца назад

      @@websquadron ok, thanks for your reply

  • @xsiete25x
    @xsiete25x Год назад

    nice

  • @thejamalc
    @thejamalc Год назад +1

    🙌🙌

  • @yismedia
    @yismedia 5 месяцев назад

    @websquadron Ive got one question in my head...
    If I have locked down the Page, which needs to be purchased - is also the content locked?
    For eg if I sell an onlinecokrse / video / image or what so ever it should not be possible to directly access via the link although the page is locked.
    Is there any solution?
    Your video is amazing!

    • @websquadron
      @websquadron  5 месяцев назад

      You can use Woo settings to make the download link change each time.

    • @yismedia
      @yismedia 5 месяцев назад

      @@websquadron I want to use your solution as a course site.
      I meant how to protect direct access to video / images via the file link. Or is this also locked because of the the locked course site?

    • @websquadron
      @websquadron  5 месяцев назад

      @@yismedia Depends on how you feed the video. So I feed it via Muse.AI that stops external access unless it is through the page.

  • @mahan_cm_8
    @mahan_cm_8 6 месяцев назад

    I have a question, if you go to restricted page you get redirected to login page right, after you logged in do you get redirect to the restricted again at the end ?

    • @websquadron
      @websquadron  6 месяцев назад

      Yes you can set it up to take them to your designated page after login

    • @mahan_cm_8
      @mahan_cm_8 6 месяцев назад

      @websquadron Thanks, pardon me Is it in the codes ?? or I have to write a code for it, I didn't look careful to it

    • @websquadron
      @websquadron  6 месяцев назад

      @@mahan_cm_8 I’ll double check in the morning as I’m sure it’s set somewhere

  • @dansk5227
    @dansk5227 Год назад

    Hi Imran, what if I want to lock several pages (more around 50) to one product? Would it be doable?

    • @websquadron
      @websquadron  Год назад

      Yes, just keep selecting the product for those pages

    • @dansk5227
      @dansk5227 Год назад

      Not sure I understand. I just want to lock a number of pages to a single product in Woo. Should I copy paste what you did with the 'layout' page for each page that I want to lock? And is the part about the 'test' page in your tutorial not relevant for me since I am only locking the pages to a single product? And if so, should I exclude that part of the code? Thanks! @@websquadron

    • @dansk5227
      @dansk5227 Год назад

      Would this modification for example work if I replace the slugs, product id and redirect page?
      function restrict_page_access() {
      // Get the current user ID
      $user_id = get_current_user_id();
      // Check if the user is an administrator
      $is_admin = current_user_can('administrator');
      if ($is_admin) {
      return; // If admin, let them access any page
      }
      // Define a list of pages that require the product to be purchased
      $restricted_pages = array('layout', 'test', 'another_page_slug'); // Add more page slugs to this array as needed
      // Product ID that is required for access
      $required_product_id = 297;
      // Get the current page
      $current_page = get_queried_object();
      // If the current page is in our restricted list
      if (in_array($current_page->post_name, $restricted_pages)) {
      // Check if the user has purchased the required product
      $has_purchased = wc_customer_bought_product($user_id, $user_id, $required_product_id);
      if (!$has_purchased) {
      // Redirect the user to the shop if they haven't purchased the required product
      wp_redirect('website.websquadron.co.uk/shop');
      exit;
      }
      }
      }
      add_action('template_redirect', 'restrict_page_access');

  • @Popcorncandy09
    @Popcorncandy09 Год назад +1

    I thought you liked Page Restrict for WooCommerce

    • @websquadron
      @websquadron  Год назад

      I do :)
      But this is an option if you want to reduce the plugins