Jump to content

Cannot add images from other pages


Pete
 Share

Recommended Posts

Hi guys

I'm using a custom template and trying to add images from other pages and getting this error:

TemplateFile: You do not have access to images on this page

#0 C:\xampp\htdocs\sc11\wire\core\Modules.php(316): ProcessPageEditImageSelect->init()
#1 C:\xampp\htdocs\sc11\wire\core\ProcessController.php(136): Modules->get('ProcessPageEdit...')
#2 C:\xampp\htdocs\sc11\wire\core\ProcessController.php(192): ProcessController->getProcess()
#3 [internal function]: ProcessController->___execute()
#4 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array)
#5 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('execute', Array)
#6 C:\xampp\htdocs\sc11\wire\core\admin.php(45): Wire->__call('execute', Array)
#7 C:\xampp\htdocs\sc11\wire\core\admin.php(45): ProcessController->execute()
#8 C:\xampp\htdocs\sc11\site\templates-admin\controller.php(13): require('C:\xampp\htdocs...')
#9 C:\xampp\htdocs\sc11\site\templates\admin.php(13): require('C:\xampp\htdocs...')
#10 C:\xampp\htdocs\sc11\wire\core\TemplateFile.php(88): require('C:\xampp\htdocs...')
#11 [internal function]: TemplateFile->___render()
#12 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array)
#13 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('render', Array)
#14 C:\xampp\htdocs\sc11\wire\modules\PageRender.module(236): Wire->__call('render', Array)
#15 C:\xampp\htdocs\sc11\wire\modules\PageRender.module(236): TemplateFile->render()
#16 [internal function]: PageRender->___renderPage(Object(HookEvent))
#17 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array)
#18 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('renderPage', Array)
#19 C:\xampp\htdocs\sc11\wire\core\Wire.php(289): Wire->__call('renderPage', Array)
#20 C:\xampp\htdocs\sc11\wire\core\Wire.php(289): PageRender->renderPage(Object(HookEvent))
#21 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('render', Array)
#22 C:\xampp\htdocs\sc11\wire\modules\Process\ProcessPageView.module(73): Wire->__call('render', Array)
#23 C:\xampp\htdocs\sc11\wire\modules\Process\ProcessPageView.module(73): Page->render()
#24 [internal function]: ProcessPageView->___execute()
#25 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array)
#26 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('execute', Array)
#27 C:\xampp\htdocs\sc11\index.php(181): Wire->__call('execute', Array)
#28 C:\xampp\htdocs\sc11\index.php(181): ProcessPageView->execute()
#29 {main}

If I change the page to the default "page" template, it will let me do so, but only on other pages using the default template.

As a test, I created a new page with the same fields and settings as the default template and tried and got the same error.

Any ideas?

EDIT: Sorry, should mention that this is when inserting images into the body field via TinyMCE from another page.

Link to comment
Share on other sites

This is where that error is coming from, in /wire/modules/Process/ProcessPageEditImageSelect.module:

if(!$this->page->viewable()) throw new WireException("You do not have access to images on this page");

The question is why does it think the page you are trying to pull images from is not viewable. Just a guess here, but:

Does the page lack a template file (on the file system?). Pages without a template file are considered not viewable() by anyone. So trying to pull images from a page without a template file would produce the error you got. Looking at this now, I'm thinking I should find another way to check access here.

Link to comment
Share on other sites

That was the issue Ryan - because I'm copying the content and haven't created the templates yet then that's the problem.

Still, as you say some other way of checking might be better here, and the message isn't the prettiest either :) A one-line warning would be better I think and maybe still let you access images,or if that would totally break the output then some sort of warning and an option to override permissions (guessing that would be harder to code and thinking about it that wouldn't actually make much sense as why would you erode permissions like that).

Link to comment
Share on other sites

I forgot to mention it before, but that last update should have fixed this too. I changed it to just check for access "page-view" permission, and not any other factors. If you don't have that access then the page wouldn't even be selectable, so I don't think that error message will be seen again in regular use.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...