Newspublisher: control path where elfinder opens (other than media source)

I use Newspublisher by @bobray for users to upload text and images to their own resource. To keep the users from interfering with each others media I use a media source for the image TVs that uses the username(which doubles as pagetitle) as last part of the path. This works so far (after some configuration).

But now I want my admins to access a similar newspublisher page on the front end with NpEditThisButton to edit these resources. Everything works – apart from access to the images, because of the different username, of course. The path needs to be dependend on the pagetitle of the resource one is editing.

So my goal would be to be able to control exactly the path where elfinder opens. Due to the complicated way Elfinder is called (from a separate resource) I have not found any way to tell it the path that is depended on the pagetitle.

Any idea?

I can’t think of any way to do that inside of NewsPublisher, but you might be able to do it with a plugin attached to OnWebPagePrerender or OnWebPageRender that rewrites the $scriptProperties['browserStartPath'] property value, the $scriptProperties['browserStartURL'] or something similar.

If that won’t work, you might be able to rewrite the JS code for one or both of those settings.

Thanks for the suggestion. Can you provide a little more info on how to do that? I have not yet written any plugins, although I know in principle how they work.

Just create a plugin (the name doesn’t matter) and attach it to both OnWebPagePrerender and OnWebPageRender. Use code like this:

$scriptProperties['browserStartPath'] = `whatever` $scriptProperties['browserStartURL']` = `whatever` ;
$properties['browserStartPath'] = `whatever` $properties['browserStartURL']` = `whatever` ;
return;

Replace “whatever” with the desired location. All four values should be the same. I’m not at all sure it will work.

Actually, I just thought of a better idea. Forget about the plugin and just create those two settings as User Settings, with the appropriate value for each user. Those should override the System Settings. Again, the two values should be the same for both settings, though different for each user.