thank you for all the support... it's really amazing...
This is out of scope for B2BKing, but do you know of a way I can hide items/content/pages/posts based on what you call "Customer Group" in the user list? I have a couple plugins that limit based on user role, but the 'Customer Group' doesn't surface as a user role, which I know is not something that B2BKing does or surfaces in that way.
I would be totally content with a snippet I could use to limit things like pages, posts, content, menus, etc.
Pls don't spend any time on this if it's a time-sink... I am just curious if there is an easy solution.
Just a note for anyone running B2BKing and Elementor and needs to show/hide content based on B2BKing groups, you can use Dynamic Visibility by Ovation (free version) at https://www.dynamic.ooo/widget/dynamic-visibility-for-elementor/ - see screenshot but you can use two database fields B2BKing uses to switch content.
You'll see a new tab in Elementor widget panel when you edit a page called 'Visibility'
Under User Role > User Field. In the search box type 'b2b' - several items will appear.
To only check if a user is a B2B user (not a specific group under B2B) select the 'b2bking_b2buser' entry in the search box
under 'User Field Status' select icon for either 'Contains (checkmark)' or 'Not Contain (an X)'
type 'yes' in 'User Field Value'
To check a specific B2B group select the 'b2bking_customergroup' entry in the search box
under 'User Field Status' select icon for either 'Contains (checkmark)'
in 'User Field Value' type the user group id number which you can get in B2BKing > Groups area. click 'edit' on the group you want to evaluate against then look at the URL like this '/wp-admin/post.php?post=2987&action=edit'. use the number after 'post=' - in this case it's '2987'
Put the ID number (in this example it's 2987) in 'User Field Value'.
That will show/hide the widget or section selected in Elementor using B2BKing's groups!
Hey Stefan -
thank you for all the support... it's really amazing...
This is out of scope for B2BKing, but do you know of a way I can hide items/content/pages/posts based on what you call "Customer Group" in the user list? I have a couple plugins that limit based on user role, but the 'Customer Group' doesn't surface as a user role, which I know is not something that B2BKing does or surfaces in that way.
I would be totally content with a snippet I could use to limit things like pages, posts, content, menus, etc.
Pls don't spend any time on this if it's a time-sink... I am just curious if there is an easy solution.
Thanks buddy!
Hey Sean,
Thank you for the kind words !
Some thoughts on this:
1. Generally to hide content inside a page / post, you can use B2BKing's content restriction shortcode:
https://woocommerce-b2b-plugin.com/docs/shortcode-to-restrict-content-to-b2b-b2c-user-groups-specific-users/
For example:
[b2bking_content show_to=b2b]Private B2B content here...[/b2bking_content]
[b2bking_content show_to=b2c,loggedout]Sorry, you must be a B2B user to see this content[/b2bking_content]
2. However there's no way directly to fully menu items. But you can hide content via CSS!
B2BKing adds classes to the body tag:
(here you can see b2bking_b2c_user)
The classes you can use are:
- b2bking_b2b_user
- b2bking_b2c_user
- b2bking_logged_out
- b2bking_b2b_group_123 (replace 123 with your group id)
That way for example you can hide some menu items for logged out users by simply using:
Hope this helps, and let me know if you have any questions.
Kind regards,
Stefan
Perfect! Thank you.
Just a note for anyone running B2BKing and Elementor and needs to show/hide content based on B2BKing groups, you can use Dynamic Visibility by Ovation (free version) at https://www.dynamic.ooo/widget/dynamic-visibility-for-elementor/ - see screenshot but you can use two database fields B2BKing uses to switch content.
That will show/hide the widget or section selected in Elementor using B2BKing's groups!
Thanks for the content and useful info Sean!
Have a nice weekend,