-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another unprotected pages in private gallery #1066
Comments
You can un-protect the index page. I can add the news.php script to the list of scripts that can be unprotected. Any control of what is then displayed would be up to the theme scripts. |
Thanks. Now my unprotected pages are:
And what about custom pages (pages which I created)? May be you said it in last sentense, but for me it remained lost in translation. |
You do not need to unprotect the "inc_" pages, only pages that are directly loaded by URLs |
Any custom script you make should show up in the list of pages that can be unprotected. |
Hmmm... I dont know how to make/add custom script to show up those pages unprotected. Can you direct me how to do it please? |
With the current development release your news can be un-protected by simply checking the news.php script in callery options/unprotected pages. Showing specific CMS pages is a bit more complicated. You would start by making a copy of the theme pages.php script, maybe call it "public_pages.php" and unprotect that script. You will have to decide how you are going to link to these custom pages. Perhaps a custom menu item? Anyway, the link will need to pass the page titleLink in a query parameter. Then public_pages.php will have to instantiate $_CMS_current_page = newPage($titlelink); Where titlelink is the string you passed. You may well want to make other modifications to public_pages.php. Things like breadcrumbs may not make any sense. Even if they did, they would invoke the protected pages.php script so would not work. You might want to consider making you site "public" but password protecting anything you do not want shown. Might be a simpler task. |
Many thanks. I will try it. If gallery is public and albums are protected - is there only one password or users can have different passwords? |
Registered users will be able to view the albums when they are logged in. But I also have another thought that I need to research. There is a filter that might let you decide what to show and not to show. |
So, you can do all this with a filter. In your theme's functions.php add the following code. ` function test_protection($allow, $page) { For the array list the titlelinks of the pages you wish to allow to be viewed. This will allow all news articles and the selected list of pages to be publicly viewed. If you wanted to restrict the news, you could do a similar test on the news category of the article. |
Woooorks!!! Yeah, you are programming God!!! Many thanks!!! 🥇 |
Is possible to make it as plugin or standard part of nPG so I don't need to edit theme after every update? |
Sure. To make it a plugin, just put the code in a separate file in the plugins folder. You will have to add the plugin header stuff: Look at the demoplugin for what you need. |
👍 I wrote to nPG forum, can you check it please? |
Thanks. For me, you can close this issue. |
I have private gallery.
Is there any way to set some of page (which I created) and all News public?
The text was updated successfully, but these errors were encountered: