Recent Topics

1 Nov 24, 2020 19:20    

I want to place a content block (restricted to members) in a public post. As intended for anonymous users the content block is hidden ("The visibility level of the content block "#number title" is not sufficient.") - But also for logged in users with member status the content block remains hidden. (To show the content block the whole post hast to be set to members only)
Is there a way to place content blocks (with restricted permission) in a public post in a way logged in users with according permission right can read?

Thanks and regards

2 Nov 25, 2020 09:03

You can code into a widget and place your content there or use the same sort of thing directly in a skin page by setting a div to be invisible unless the user is logged in or with a certain status

I made a freeHTML widget that checks if the user is registered by adding a variable [uid] to the header of my site the then added content via a widget.

In the skin/_html_header.php I added this
var uid = "<?php echo $current_User->ID; ?>";

then added a widget for the container

if (uid > 0)
{document.write("<div style='width:87%; margin:auto; margin-top:-1em; border-top:2px solid green; border-bottom:2px solid green; padding-top:0.6em; padding-bottom:0.32em; text-align:center' class='promote'><a href=''><img style='border:0; width:90%' src='/media/blogs/cabin/img/workshop_button.jpg' alt='workshop icon' /></a></div>");}

You could also add a back office option so add the widget and each time add different content.

3 Nov 25, 2020 09:35

@amoun thx! does this also work in 6.11.5 or only in 7.x?

4 Nov 25, 2020 12:24

Both :) as it's just basic javascript and php

5 Nov 25, 2020 14:42

My challenge: In my instances there is no "skin" folder, only "skins" and in the root of this folder there is no "_html_header.php" file, neither in that folder containing my actual skin.
Only in fallbacks and in skins_admin I can find a "".
So, what is to do?

6 Nov 25, 2020 15:54

Sorry I'm a bit careless as I'm always in a hurry

  1. /skins/ it is ~my slackness in
  2. the can be copied to what ever skin you like.
  3. You can add the code via the back office for each collection > Settings > Advanced > scroll down to Skin and style and add
      var uid = "<?php echo $current_User->ID; ?>";

    to the
    Custom meta tag/css section (before </head>):

7 Nov 25, 2020 16:38

sorry, thats not what I have meant.

See this screeshot:

In this page I use several different Content Blocks (saved as for members only) and included those into a public page.
So publicly those content (from content blocks) should not be visible, but for me and memebers it should.

For me as admin the content block is just as invisible as for anonymus user. The visiblity level should be sufficient, but nevertheless it does not work (See next screenshot)

That is the challenge,

8 Nov 25, 2020 20:55

Excuse my errors etc. and I'm halfway through a bottle of organic Spanish 14.5% Pacheo, Monastrell, having not had a drink for a couple of months, so slowly ig will go :)

There are two issues I have to consider a) that you want this to apply to multiple [div]s and b) the visibility level is not working out.

The visibility is not just set by the user being logged in i.e if usrID > 0 but by what level and permissions have been set for groups etc.

I will have to look more closely at your site and what you have set up to think further especially given my alcohol intake :) will be back to tomorrow.

Form is loading...