Hello,
I created a custom .php file, which I pop up in a page created with the Pages builder in Admin section. However, as it is now, anyone can see this file without being a member if they know the direct URL for it.
Is it possible add a piece of code to my file, which checks if the user is logged in to my community before allowing the user to see the content?
|
|
You can set who can view (guest/member) in the blocks on the new page ..... Admin > settings > Builders > Pages Builder .....
HTH . |
I am aware of that, yes. But it's not the page I created in Pages Builder I want to password protect. It is the .php-file I created for my popup window. I want to make sure that people can only view this file if they are logged in to my community even though this file is not actually a part of the Dolphin code. |
You can try this, edit green code to what you will have there
<? if( $logged['member'] = (int)$_COOKIE['memberID'] ) {
?> <div align="center"> <table border="2" bgcolor="#e8e8e8" width="39%" cellpadding="2" cellspacing="0" bordercolor="#cc0000" style="border-collapse: collapse" id="table1"> <tbody> <tr> <td> <p align="center"><b><span style="color: #000000;"><br />Your members code will be here.<br /><br /></span></b></p> </td> </tr> </tbody> </table> </div> <?
} else {
?> <div align="center"> <table border="2" bgcolor="#e8e8e8" width="39%" cellpadding="2" cellspacing="0" bordercolor="#cc0000" style="border-collapse: collapse" id="table1"> <tbody> <tr> <td> <p align="center"><b><span style="color: #cc0000;"><br />Sorry, you need to login before you can see this page.<br /><br /></span></b></p> </td> </tr> </tbody> </table> </div> <?
} ?>
|
This will force members to login if they click on for example: Browse Members", they are redirected to the login page.
Add this to the php file you would redirected to login:
$logged['member'] = member_auth( 0 );
Place code towards the top of page usally under these values:
$_page
$_page_cont
Hope this helps..
|
Thanks a bunch, guys! I'll be trying this out as soon as I have some free time to test everything.
You help is much appreciated :D
|
I am trying to put
__hello_member__ section in different site, so users can login to my main domain from a different site.
Any expert here?
|
In extension of my previous question, I'd like to prevent "standard members" from seeing this custom page so only my paying members will be able to do this.
Any of you guys who have a sollution to this?
|
Yes, add the page to your Admin Panels section for membership levels and set it there. |
Yes, add the page to your Admin Panels section for membership levels and set it there.
How do I do that? I don't see that option anywhere?
|