Skip Navigation

[Resolved] Toolset Access adds in Layouts

This thread is resolved. Here is a description of the problem and solution.

Problem:
The Access ShortCodes renders a

tag when inserted to a Page to control who can see what on it.

Solution:
To not produce a

you would use:

[toolset_access role="Administrator" operator="allow" raw="true"]Test Allowed[/toolset_access]

It uses the ShortCode attribute raw="true", which outputs no HTML at all.

This support ticket is created 7 years, 9 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 22 replies, has 2 voices.

Last updated by tinaH 7 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#474728
[toolset_access role="Guest" operator="deny"] I'm logged in [/toolset_access]

Above code is rendered with surrounding <p> tags in a Layout text/html cell EVEN though "Disable automatic paragraphs" is checked.

Don't think it should ...

#474944

No, it shouldn't.

I will report this, as I can replicate it.

Thank you for pointing us to this problem.
I will keep you updated here.

#475798

Simple solution.

There is an attribute "raw" wich can be "true | false" and depending on it, it produces a <p> or not.

So to not produce a <p> you would use:

[toolset_access role="Administrator" operator="allow" raw="true"]Test Allowed[/toolset_access] 

The problem this is not in the GUI, so it needs an update.

I will update once it's in the GUI.

#478165

I am closing this here as it will take longer to add it to the GUI.

But above is posted the correct approach, which will be the same once it's implemented in the GUI.

#480281

For anyone wanting a solution while waiting for a GUI update.
This removes or hides empty p tags from the page.

$('p').each(function(index, item) {
    if($.trim($(item).text()) === "") {
        $(item).slideUp(); // $(item).remove(); slideUp looks nicer
    }
});
#480637

There is actually no reason to add that Custom Function.
I posted the correct solution in my second-last post.

Thank you for sharing the code 🙂 - I am sure others will find this useful and also learn from it

#480743

As I understood it raw="true" don't work yet.
At least not for me. I still get empty <p>
So I use this in waiting ...

#480904

It works, I tested this locally.

It's just not added to the GUI, but it's in the Code, so it works when it's called in the ShortCode.

Your issue must be something else then. Maybe you can outline the steps you take to make it happen?

Or maybe you can share access to the site in question mentioning the exact page where you do this?

#482625

Confirmed, it works with raw="true" on toolset access shortcode
BUT
I get empty p tags if I use "Layouts" Beta new "The Content" cell. I get empty p before the actual content.

#483168

I cannot replicate this.

I think you copy pasted the "raw=true" part into the SHortCode in Visual Mode.
Then WordPress wraps the ShortCode attribute into a span, and that breaks it.

Please try to open the Text Editor mode and remove all not needed/wanted HTML.
Then it works.

#485791
content cell adds p before.png
empty p before content.png
nothing strange on the page.png

Hi Beda

Maybe you misunderstand me.
It is the new content cell in layouts beta that generates an empty p tag BEFORE rendering the actual page content.
Attached images shows
the new content cell
the empty p tag in source before page content
page content with a simple view shortcode

That is why I added the code to my functions php to remove the empty p tag.

#485907

I cannot replicate this problem.

Please if possible send me a snapshot of this Website.
It's not the same issue as initially reported, but I will handle this here, for the sake of speed and prompt solution.

You can see here how you can send me a Snapshot of the site:
https://toolset.com/faq/provide-supporters-copy-site/

#486286

You have a snapshot of my site from another ticket.

Go to the page "Admin" it is based on the Layout "Admin".
Any view inserted to the "content" cell get's an empty p before the actual content.

This is the ticket where you have access to my site.
https://toolset.com/forums/topic/google-maps-dont-show-on-iphone/page/2/

#486533

I see that happens only with a View ShortCode, not with actual "normal" content.
That's why I could not replicate it, it was also not the initial report (related to Access ShortCode)

The Suggested way to display a View is to use the View Cell, but of course what you report here should not happen, since it's possible to insert a View as ShortCode in the Body, and display the Body with the content cell.

But that content cell is intended for content editing (builder style)

It also happens with a Visual Editor + the post body shortcode, as I tested on your install.

I will thou make some local tests to see how I can replicate this clean, and then report that to the Developers as well.

Thank you for pointing it out.

#488838

This is solved in the latest Beta versions of Views and Layouts which you can download from your Account in Toolset.

Can you confirm this as well?

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