Forum Discussion

srujanayeruvaka's avatar
8 years ago

How to hide 'Share' button for Anonymous users?

Hi,

 

Is there a way to hide the 'Share' button from posts/blogs/etc, for Anonymous users? Looking for a way to hide the below component by default for unregistered users.

<component id="external.widget.add-this" />

 

Thanks,

Srujana.

  • ChiaraS's avatar
    ChiaraS
    8 years ago

    srujanayeruvaka

     

    you can create a custom component named external.widget.add-this@override

     

    and add the following code in it:

    <#if user.registered>
    <@delegate/>
    </#if>

    That should only render the component for logged-in users. 

7 Replies

  • Hi srujanayeruvaka  You can use conditional CSS in page initialization script.

    /t5/bizapps/page/tab/community%3Astudio%3Aadvanced%3Ainit

     

    <#if user.anonymous>
    <style>
        .lia-link-navigation.lia-js-add-this-widget {
            display: none;
         }
    </style>
    </#if>

    You can add page. name condition also  If want to hide on a specific page.

     

  • srujanayeruvaka's avatar
    srujanayeruvaka
    Champion
    8 years ago

    Thank you for the quick response VikasB!

    I should have been more clear with my question... I would like to know if there is a way to control the loading of this component in the quilt based on whether a user is registered or not.

    The display:none; option is the general approach and we have this solution in place. Just thinking if there is a better or more efficient way to do it. :)

     

    Thank you!

     

  • ChiaraS's avatar
    ChiaraS
    Lithium Alumni (Retired)
    8 years ago

    srujanayeruvaka

     

    you can create a custom component named external.widget.add-this@override

     

    and add the following code in it:

    <#if user.registered>
    <@delegate/>
    </#if>

    That should only render the component for logged-in users. 

  • nikita_1608's avatar
    nikita_1608
    Guide
    8 years ago

    Hi ChiaraS,

     

    I would like to completely remove share button from the entire community.

    Could you please provide any solution for this?

     

     

     

    Thanks

  • AbhishekIlindra's avatar
    AbhishekIlindra
    Boss
    8 years ago

    nikita_1608 : Kindly check this Document. Hope it will work.

     

    If my post is helpful and answers your question, please give "Kudos" and "Accept it as a Solution."

    Thanks & Regards,
    Abhishek Illindra