Viewing 3 replies - 1 through 3 (of 3 total)
  • Anonymous User 14808221

    (@anonymized-14808221)

    I would know a plugin but its not free (google for Toolset, they have an Access and a Form plugin that will help you achieve what you want)

    On the other hand, what you would need is the following:
    1. A plugin to create forms with which the users can sign up after paying something.
    2. Either manually or automatically with code update that user (or guest) to a higher role that has access to view the specific pages you hide
    3. A plugin or code that allows you to hide specific pages by roles

    This is something that can be achieved as said with named Toolset plugin, or custom code or a mix of free plugins, perhaps some like https://ww.wp.xz.cn/plugins/members/ or https://ww.wp.xz.cn/plugins/paid-memberships-pro/

    Thread Starter jas490

    (@jas490)

    @bedas thanks for your response. Yes, the plug-ins enable user roles and what content is open to different roles, etc. Unfortunately I’m looking to achieve something slightly different. If, for example, I have 30 games on my site, I need to be able to unlock a game/per user, depending on what games they pay for. So theoretically, each user will have a different combination of content that is unlocked for them, depending on which content they pay for.

    Anonymous User 14808221

    (@anonymized-14808221)

    Just thinking out loud, would this be possible with the WP Password Protection (pages)?

    By purchasing a related product (you would have one product for each “game”), the user would get an email and in that email you would communicate the password for the related game (which would be a page).
    Then the user can go to that page and see content after inserting the password.

    This would likely need some custom coding for the emails after purchasing the product related to the game, and eventually some custom coding for relating the product to the specific game.
    (Well, I am quite sure using Toolset you could avoid some of that custom code, but that is as said a paid plugin and for the same price, or a bit more, maybe you could even hire a programmer to do the coding for you, if you do not feel comfortable writing it on your own)

    As for an “out of the box” solution I don’t think there is anything out there that does exactly that, since it is a bit particular goal.

    1. You could maybe relate the pages to products with a Custom Field that holds the Page (Game) ID, on the product side
    2. You could then eventually customise the WooCommerce emails by overriding the templates using some PHP like shown here https://woocommerce.com/posts/how-to-customize-emails-in-woocommerce/ or eventually a plugin like https://woocommerce.com/products/woocommerce-email-customizer/ can help.

    I would start testing this by using woocommerce_email_after_order_table or woocommerce_email_before_order_table hooks.

    I think the PHP email customisation is being more flexible and you could get the ID of the Page (Game) from the “purchased product”. That would give you the ID of that page and hence you can then get the password for that page using $post = get_post($post_id) and then from the post object accessing the password like so $post->post_password
    $post_id would be previously populated from the said Custom Field of the product that holds the ID of the page (game) related to it, like so:
    $post_id = get_post_meta($product_id, 'the_field_with_page_id', true)

    To get the $product_id itself inside the email, there is some guidance here https://stackoverflow.com/questions/49330876/get-the-product-id-from-email-templates-in-woocommerce-3

    As said, I don’t think this will be possible without a line of code, some plugins might help avoid a couple lines but ultimately you will have to write some logic, I think.

    I hope this helps!

    • This reply was modified 5 years ago by Anonymous User 14808221.
    • This reply was modified 5 years ago by Anonymous User 14808221.
    • This reply was modified 5 years ago by Anonymous User 14808221.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Member Content’ is closed to new replies.