Skip Navigation

[Resuelto] Front end post groups for content and users?

This support ticket is created hace 2 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 respuestas, has 2 mensajes.

Last updated by Waqar hace 2 años, 4 meses.

Assisted by: Waqar.

Autor
Mensajes
#2217761

Tell us what you are trying to do?

A while ago, you gave me a work around for this issue which worked well. Now, I have a similar issue but it's simpler in nature, so I wondered if I could use Access Post Groups this time, of whether I should stick to the conditional fields solution as before?

Is it now possible to add content & users to a post group from the front end? For example, I'm creating or editing content, and I can pick the post group from a dropdown. Or, I am creating or editing a user and can do the same, to give them access to that group.

No new groups need to be created - just simply adding content & users so that our non technical staff don't have to go into the backend to manage content restrictions and give access to users.

The reason I'd prefer to use Post Groups this time is because it's native to Toolset, so perhaps would perform better if there are lots of users using the site at one time? Or perhaps the conditional fields would perform better with many users?

Many thanks, Joe

#2218139

Waqar
Supporter

Languages: Inglés (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Joe,

Thank you for contacting us and I'd be happy to assist.

The post groups management is still only available from the admin area ( back-end ). For this reason, to achieve content restriction similar to the earlier requirement, you can again use the "conditional display based on the custom field values" approach.

I hope this helps and please let me know if you have any follow-up questions.

regards,
Waqar

#2219469

Thanks for your reply Waqar,

I have modified the conditional fields approach to make use of Woocommerce. Most of it is working great, but I have a question about child pages which I'll detail below.

For this project we added WooCommerce to sell access to content. The user purchases a product, and when the order is completed they can see extra content on the product page using a conditional field and the shortcode below. I'm also using this to display a list of purchased products on their dashboard, which is great. This works well because it's automatic when they buy the product, and can be all managed through the front end.

https://toolset.com/forums/topic/sites-users-personal-product-list/

My question is how do I apply this to child pages? There are several articles attached to each product with hidden content. When the user purchases the product parent, this content should also become available...so the conditional field should check to see if the user has purchased the parent.

Do I create another shortcode? And how could I modify the shortcode above to check the parent instead of the current page itself?

Is this a reliable way to manage premium content?

Many thanks! Joe

#2219475

Thanks for your reply Waqar,

I have modified the conditional fields approach to make use of Woocommerce. Most of it is working great, but I have a question about child pages which I'll detail below.

For this project we added WooCommerce to sell access to content. The user purchases a product, and when the order is completed they can see extra content on the product page using a conditional field and the shortcode below. I'm also using this to display a list of purchased products on their dashboard, which is great. This works well because it's automatic when they buy the product, and can be all managed through the front end.

https://toolset.com/forums/topic/sites-users-personal-product-list/

My question is how do I apply this to child pages? There are several articles attached to each product with hidden content. When the user purchases the product parent, this content should also become available...so the conditional field should check to see if the user has purchased the parent.

Do I create another shortcode? And how could I modify the shortcode above to check the parent instead of the current page itself?

Is this a reliable way to manage premium content?

Many thanks! Joe

#2221347

Waqar
Supporter

Languages: Inglés (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

You can update the shortcode from the other thread slightly, so that it can support the attribute 'item'. This attribute can be used to pass the ID of the product that needs to be checked:


add_shortcode('wpv-product-purchased', 'wpv_product_purchased_func');

function wpv_product_purchased_func($atts){
	$a = shortcode_atts( array(
		'item' => get_the_ID()
	), $atts );

	$current_user = wp_get_current_user();
	$email = $current_user->email;
	return (wc_customer_bought_product( $email, $current_user->ID, $a['item']));
}

After this change, when you'll use the shortcode without the attribute 'item', it will check whether the current product has been purchased or not, just as before:


[wpv-product-purchased]

And when, you need to check for the purchase of a product other than the current product, you can use the item attribute, like this:


[wpv-product-purchased item="12345"]

Note: You'll replace '12345' with your target parent product's ID.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.