Skip Navigation

[Resolved] Show item only for certain user types

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 13 replies, has 2 voices.

Last updated by Minesh 4 months, 3 weeks ago.

Assisted by: Minesh.

Author
Posts
#2711264

Hi, thanks fort answering this topic: https://toolset.com/forums/topic/will-need-to-hide-a-link-to-post-artwork-unless-author-has-made-a-bio/

But I'm afraid this is too complex for me since i'm not a programmer.
i've got another question, for which i'm afraid your answer might be the same:

When a paying subscriber publishes a certain post type posting by entering a form, they can enter all their social media channel url's, which then will show at the front end.

But we also offer a free subscription. In that subscription i want them to be able to fill in all these url's, but it should not show on the post. (Unless they decide to buy a payed subscripttion)
I tried this with conditional fields in the post type template, But i can't find a way to hide the url when the publisher has a free subscription.

Hope you can help me out on these 2 issues / wishes.

thanks.

#2711295

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you can always use conditional block or conditional shortcode to display the conditional content.

Please check the following Doc:
- https://toolset.com/course-lesson/using-toolset-conditional-block/#conditions-based-on-user-roles
- https://toolset.com/2021/08/5-advanced-uses-of-toolsets-conditional-block-in-wordpress/

I suggest best option for you to learn Toolset quickly and export its capabilities:

You can use our free test platform http://www.discover-wp.com and use any of our reference site that is build on top using Toolset features.

This will allow you to create a test site or our free test platform: http://www.discover-wp.com
- https://discover-wp.com/site-templates/

In addition to that - if you want to install any of our reference site we offer on http://www.discover-wp.com on your local machine or server, you can use the framework installer plugin:
- https://toolset.com/course-lesson/using-framework-installer-to-install-reference-sites/

Once you create test site using any of the reference site on your local machine or server - you can add your additional plugins or add your desired theme and check and play with that that will allow you to explore features and functionalities build on top using Toolset.

By following this path you will have hand-on experience about how you can implement the functionality.

However - at any point you can raise a ticket with where you require further help and we are happy to assist you further.

If above does not help, you can always share problem URL and admin access details with all required information and we are happy to fix the issue.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2711339

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As you can see with the following screenshot: hidden link

I've added another conditional block and I'm checking the current user role and if current user role is not equal to "packet_1" it will display those links:
=> hidden link

Can you please confirm it works as expected.

Regarding the additional question, as per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported.

May I kindly ask you to open a new ticket with every new question you may have with all required details.

#2711340

Hi, i also figured that one out, but that is not what i mean 😉

It's not about what the USER sees, its what EVERBODY sees. So these social links and the website link, that whole block should disappear for everybody who visits the site when the author of that post has a pakket 1 user role 🙂

#2711346

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following shorcode to "Custom Code" section offered by Toolset:
=> hidden link

function func_get_current_post_author_role(){
    global $authordata;
  
    $author_roles = $authordata->roles;
    $author_role = array_shift($author_roles);
  
    return $author_role;
}
add_shortcode( 'get_post_author_role', 'func_get_current_post_author_role' );

I've registered the shortcode name "get_post_author_role" at:
=> Toolset => Settings and click on the "Front-end Content" tab. Look for the section called "Third-party shortcode arguments"

Then I've modified the conditional block on the following page:
=> hidden link

I've added the it as you can see with the following screenshot:
=> hidden link

Can you please confirm it works as expected:
- hidden link

#2711355
Schermafbeelding 2024-08-05 150944.png

Hi, yes on the front-end that is what i ment, thanks a lot!
But.. in the backend i'm getting an error now, see screenshot:

#2711365

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That is not error but I've changed the condition for the conditional block as you can see with the following screenshot: hidden link

I see its working as expected now.

#2711371
Schermafbeelding 2024-08-05 153918.png

ah okay, but on the other artists the links also are gone: hidden link
(I'm very grateful!)

#2711376

Oh and reminder: only this artist has also entered social links: hidden link

#2711379

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I forget to register the function name "func_get_current_post_author_role" after changing the shortcode to check function.

It should be ok now for both the account.

#2711380

thanks a lot, yes now it works!!
I don't know if you're still working on it, but i'm seeing the block recovery button again: this block contains unexpected or invalid content. On the template edit page

#2711381

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - it will not affect functionality. I do not have any other solution to share for that as you are using third-party block inside conditional and toolset blocks.

Maybe you can create a content template and move all those blocks to that content template and then wrap the content template with the conditional block of role.

#2711382

Is that because i'm using the wordpress row widget?

#2711383

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could be possible or due to the custom function or nested conditions you have. If you do not have any issues with that you should leave at as its going to work without any issues on frontend.

#2711384

okay! thanks a lot!!!