Skip Navigation

[Resolved] restrict access via php

This support ticket is created 7 years, 6 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by nelsonT-2 7 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#447948

Hi,

I've built a web site with an older version of Access. At the time, we needed to put the shortcode manually to restrict access to certain portions of a page (or just show certain portions)...

The problem I have is that I need to show a widget only to logged in users. The widget is called directly inside the php code (at the time, my partners used to create a custom WP template for every specific need they had).

So, I need a php code to only show that widget when people are logged in (or are not guess, if it's easier)...

Here's the PHP code:

<div id="calendrier">
         	 <?php echo CALENDAR(); ?>    
        	<a href="?page_id=20" class="lienBrun">voir tous les évènements ></a>
        </div>

I have no problem going in the code to change something, but I don't know wich element to use... Isn't there any API reference or similar (just like with Views) to know how to use Access or what are the available functions and properties?

#448030

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nelson,

Thank you for contacting our support forum.

You can resolve this by using this code.

 <?php 
if(is_user_logged_in()){ ?>  
<div id="calendrier">
             <?php echo CALENDAR(); ?>    
            <a href="?page_id=20" class="lienBrun">voir tous les évènements ></a>
        </div>
 <?php 
} ?>  

Please let me know if this helps.
Thanks,
Shane

#448038

Thank you.

I saw this code also after (did a Google search)... I was just thinking that Access had something built-in (since that's regular WP code)...

So, anyway, thank you and I hope it will help others.

Nelson

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