Password protect single page
Re: Password protect single page
I'm just about to finish a plugin for CMSMS that will do just that. I wasn't sure if would ever release it but given the circumstances, why not?... Just need to tidy up the plugin a bit and write some decent documentation about how to use it. I may release it in a couple of days.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Password protect single page
what a timing!
Re: Password protect single page
If anyone cares to try it: http://dev.cmsmadesimple.org/project/files/1246
I had been using a raw version of it. I believe other developers have bits and pieces of code (plugins/modules) they use on personal projects but, other than that, these never see the light of day. This is one of those bits that, in the hope of it being useful to others, ends up being released.rotezecke wrote:what a timing!
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Password protect single page
i had a quick look and managed to get it to work, however:
1) using the "Smarty data or logic that is specific to this page" block for didn't register the smarty block {protect}{/protect} - and yes - {process_pagedata} was first plugin called on the template in use. Fix for me: moving the {page_protect passwords='pass1'} to the (top of) template itself.
2) couple of notices and warnings:
i'm not after support (i dont need this function at present), just thought i post it. dont know if this is a bug or user error.
----------------------------------------------
Cms Version: 1.11.9
Installed Modules:
CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.3
MenuManager: 1.8.6
ModuleManager: 1.5.5
News: 2.13
Search: 1.7.11
ThemeManager: 1.1.8
CGExtensions: 1.37.2
CGSimpleSmarty: 1.7
CGSmartImage: 1.13
Captcha: 0.4.6
GBFilePicker: 1.3.3
TinyMCE: 2.9.12
FrontEndUsers: 1.21.20
ListIt2: 1.4
CGEcommerceBase: 1.4.3
CGPaymentGatewayBase: 1.2.2
Orders: 1.15.2
SelfRegistration: 1.8.1
JQueryTools: 1.2.5
Products: 2.19.8
Promotions: 1.1.10
Cart2: 1.0.7
ListIt2News: 1.4
ListIt2XDefs: 1.2
FormBuilder: 0.7.3
Gallery: 1.6.1
AdvancedContent: 0.9.4.3
CodeMirror: 3.0.0
Config Information:
php_memory_limit:
process_whole_template:
max_upload_size: 2000000
url_rewriting: none
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true
Php Information:
phpversion: 5.4.4-14+deb7u5
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 8192
memory_limit: 128M
max_execution_time: 30
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 2M
session_save_path: /var/lib/php5 (1733)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
Server Information:
Server Api: apache2handler
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.31
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found
----------------------------------------------
1) using the "Smarty data or logic that is specific to this page" block for
Code: Select all
{page_protect passwords='pass1'}
2) couple of notices and warnings:
the above goes away if I include: action="default" with {page_protect ...}Notice: Undefined index: action in /var/www/mario_santini/httpdocs/plugins/function.page_protect.php on line 278
the above does not go away with either or both welcome_msg (with {page_protect ...}) and/or protected_msg (with {protect ...}).Notice: Undefined variable: msg in /var/www/mario_santini/httpdocs/plugins/function.page_protect.php on line 287
i run a fresh install of CMSMS 1.11.9 on php5.4.4 on current debian linux. there's a stack of modules, most of which aren't called anywhere.Warning: Missing argument 5 for pp_protect(), called in /var/www/mario_santini/httpdocs/tmp/templates_c/15content_en^62e936251e4799749e89fa9828a0ee7332eb5816.content.content_en.php on line 26 and defined in /var/www/mario_santini/httpdocs/plugins/function.page_protect.php on line 39
Warning: Missing argument 5 for pp_protect(), called in /var/www/mario_santini/httpdocs/tmp/templates_c/15content_en^62e936251e4799749e89fa9828a0ee7332eb5816.content.content_en.php on line 28 and defined in /var/www/mario_santini/httpdocs/plugins/function.page_protect.php on line 39
i'm not after support (i dont need this function at present), just thought i post it. dont know if this is a bug or user error.
----------------------------------------------
Cms Version: 1.11.9
Installed Modules:
CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.3
MenuManager: 1.8.6
ModuleManager: 1.5.5
News: 2.13
Search: 1.7.11
ThemeManager: 1.1.8
CGExtensions: 1.37.2
CGSimpleSmarty: 1.7
CGSmartImage: 1.13
Captcha: 0.4.6
GBFilePicker: 1.3.3
TinyMCE: 2.9.12
FrontEndUsers: 1.21.20
ListIt2: 1.4
CGEcommerceBase: 1.4.3
CGPaymentGatewayBase: 1.2.2
Orders: 1.15.2
SelfRegistration: 1.8.1
JQueryTools: 1.2.5
Products: 2.19.8
Promotions: 1.1.10
Cart2: 1.0.7
ListIt2News: 1.4
ListIt2XDefs: 1.2
FormBuilder: 0.7.3
Gallery: 1.6.1
AdvancedContent: 0.9.4.3
CodeMirror: 3.0.0
Config Information:
php_memory_limit:
process_whole_template:
max_upload_size: 2000000
url_rewriting: none
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true
Php Information:
phpversion: 5.4.4-14+deb7u5
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 8192
memory_limit: 128M
max_execution_time: 30
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 2M
session_save_path: /var/lib/php5 (1733)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
Server Information:
Server Api: apache2handler
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.31
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found
----------------------------------------------
Re: Password protect single page
Weird. I'm not being able to reproduce that behavior myself, but yes: it can be used the way you described. It just defeats one of the purposes of the plugin which is to be able to have different sets of passwords for different pages (well it could be done with different templates, but not really an ideal scenario). Still not being able to reproduce it on any of my test servers.rotezecke wrote:i had a quick look and managed to get it to work, however:1) using the "Smarty data or logic that is specific to this page" block for Code:{page_protect passwords='pass1'} didn't register the smarty block {protect}{/protect} - and yes - {process_pagedata} was first plugin called on the template in use. Fix for me: moving the {page_protect passwords='pass1'} to the (top of) template itself.
Usually notices can be disregarded on most cases, and some are almost unavoidable in certain circumstances. The same applies to warnings, but with some degree of caution. Both are good data for the developer, as these give pointers to potential problems. At the moment, even with that list of warnings an notices, the plugin appears to be working as designed. I'll do some more tests before I release a version flagged as stable.
TBH I really appreciate the info and the feedback: it does help, and is always welcomerotezecke wrote:i'm not after support (i dont need this function at present), just thought i post it. dont know if this is a bug or user error.

Thanks.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Password protect single page
i got it working without warnings today. first, i assume i had in the meta textarea, not the Smarty data field. no way of telling, but since it is working now i have no other explanation (and i bow my head in shame).
on the plus side: I removed the last argument from pp_protect function to read. the warnings are gone and the plugin still works as advertised. i also included a $msg=''; early in the smarty_cms_function_page_protect function (outside the if statement) to address that Notice.
nice plugin. i'm sure i'll need it one day.
Code: Select all
{page_protect passwords='pass1'}
on the plus side: I removed the last argument from pp_protect function to read
Code: Select all
function pp_protect($params, $content, $smarty, &$repeat)
nice plugin. i'm sure i'll need it one day.