Newspublisher Permissions

Hi there!

I’m just about to start using NewsPublisher. My MODX version is Revolution 2.7.3-pl and NewsPublisher runs in version 3.0.4-pl

So far, so good, but first my goal, then the questions:
What I finally want to achieve is a kind of market place on my homepage. So a page where registered users can easily advertise products. Very simple and also without any payment system. That means also that the users have no access to the manager. So it must be possible to create documents in the frontend. My choice fell on NewsPublisher. And that brings me directly to my questions:

Question 1: I guess I have everything configured reasonably well. Unfortunately I can fill out the form in the frontend, but the page is not created in the manager. Specifically I did the following:

  1. user created in the manager (role: member)
  2. resource group created (name: rg member)
  3. user group created (name: member)
  • Context Access: web, Access Policy: NewsPublisherEditor
  • Resource Category-Access: RG Member, Min. Role: Member Role: Member-9999, Access Policy: Resource, Context: web
  • Element Category Access: Nothing changed
  • Media Source Access: Nothing changed
  • Namespace Access: Nothing changed
  1. My NewsPublisher call:
    [[NewsPublisher] &templateid=13 &show=pagetitle,pub_date,IMG-01,IMG-02 &parentid=33 ]]

I forgot to mention that I use the Login Extra, with which users can register and login. The login already works fine. After login I can fill out the form from the NewsPublisher, but the page is not created in the Manager. But with admin rights it works.

Now there’s my second question:
Question 2: Is there any way to make users only see their own created documents? It would be nice if every user only sees his own advertisements to edit and delete them.

Any help is very appreciated!

Greetings from Vienna

Two questions:

  1. In the ACL entry that connects the User Group to the Resource Group, what is the required authority level for the Policy?

  2. Are the created resources at the root of the site tree?

Hi, Bob,
I have unintentionally saved the post incompletely before. I have now added a few updates. I think this answers your first question.
To your second question: The NewsPublisher Snippet page is not in the root tree of the site

Sorry, my question wasn’t clear. Are the pages the members create at the root of the tree? If so, you would need to change the udperms_allowroot System Setting.

One other question: did you flush permissions and log out all users before testing your new permission setup?

Otherwise, I don’t see anything wrong with what you’re doing, as long as all the permissions are checked on the Resource policy.

No they are not at the root level. I flushed all permissions and logged out all users. Unfortunately without any change. I can fill in the form and send it, it just reappears with all contents. Unfortunately no page is created in the manager.

Or maybe I have a completely different problem. I have 2 TVs for holding pictures and next to it the Browse button, when I click on it nothing happens. Could this be an issue?

What do you mean exactly with “…all the permissions are checked on the Resource policy”?

Oh very tricky Bob. Got it working, the cause was the call of NewsPublisher:
[[NewsPublisher &templateid= 13 &show= pagetitle,pub_date,IMG-01,IMG-02 &parentid= 33 ]] in other words I hide the content filed which is mandatory by default. Because of that no error message appears.
Changing it to [[NewsPublisher &templateid= 13 &show= pagetitle,content,pub_date,IMG-01,IMG-02 &parentid= 33 ]] it works.

So, summarized I stay at 3 open questions (yes one more came up):

  1. How can I prevent the content field to be mandatory? To let you know why I want this: I manage every content via TV’s. But this is not very important, I can also use the content field again. Just in case it’s not a stunt to make the content field not mandatory.

  2. Is there any way to make users only see their own created documents? It would be nice if every user can only edit and delete their own documents.

  3. What can I do to make the Browse Button work next to the image fields? It does nothing in any browser…

Greetings, Mike

  1. The &required property sets a comma-separated list of required fields. I think it can be left empty:
  1. The only really effective way to do this is to create a matching user group and resource group for each user. It’s easier if you use the sanitized username for the name of each group.

I think this could be done automatically with a postHook on the Register snippet.

  1. Turn on Dev. tools (Ctrl-shift-i) and see if there are any JavaScript errors when you try to access the browse button. Also, check the values of the npElFinderConnector Snippet Properties.

Thanks for your reply Bob!

  1. Empty did not work, but as long as one field is specified it works like a charm.
    &required=`pagetitle` works fine and content can be left empty.

  2. OK thanks! I will take a closer look on how to create such things. I hope it’s okay if I get back to you on this later.

  3. I did use the Dev Tools and voilà, there is a JS error:
    index.php?id=42:385 Uncaught ReferenceError: $ is not defined
    So I searched and found that I’m loading jquery.min.js at the end of my file. I assumed I might have to load jquery earlier. So I put it in the head section and now I get a different error (each one only when pressing the browse button) saying:
    Uncaught TypeError: $(...).dialogelfinder is not a function at HTMLButtonElement.<anonymous> (index.php?id=42:389) at HTMLButtonElement.dispatch (jquery.min.js:2) at HTMLButtonElement.v.handle (jquery.min.js:2)
    The npElFinderConnector Snippet Properties look OK to me.

If interesting, the development page can be accessed here.

You shouldn’t have to load JQuery at all.

Be sure you have these in your NewsPublisher tag:


I need JQuery for some fancy things but removed it for testing - didn’t change the behavior.

When adding
and pressing the Browse Button next to the TV Image field, I get an internal server error 500`

When adding
and pressing the Browse Button next to the TV Image field, I get the following message:

—some tries later —
:white_check_mark: Ok got the RTE thing working. Had to uninstall the TinyMCE Rich Text Editor within the Manager. Any ideas for a coexistence of that 2 RTE’s? Should I try to use another RTE in the manger?

—some other tries later —
:white_check_mark: Finally got the second thing also working. The problem here was a typo in the .htaccess file. Because I’m using FURL I need the friendly URL Part in the htaccess file. The typo was a comma instead of a dot in the file name .htaccess (that was pretty hard to find :wink:

OK, now I got everything up and running. But as I already wrote, I would like that every user may only edit and delete his own created documents and TVs. But if I now look at the elFinder, then I would have to make a central folder in which the pictures of each user are placed. I.e. everyone sees everything. Unfortunately this is not what I was looking for, my customer will not want that…

Does anyone have any other idea how I can realize this? I know this is a difficult task, but I ask before I start writing an extra. That would take forever and wouldn’t be half as good as e.g. the NewsPublisher. For that, my know-how is miles away.

One way to accomplish what you want (if I’m understanding you) might be to use the NpEditThisButton Snippet with the

&ownpagesonly=`1` property

This would put the “Edit” button (which launches the NewsPublisher page for that resource) only on pages the user created. When viewing pages not created by the current user, the page would appear, but not the “Edit” button.

The NpEditThisButton Snippet tag would go in the template for the user pages.

The only drawback is that the users would have to navigate to their own pages in order to delete or edit them.

Hi Bob,

many many thanks for your help & support. However, I think that this way it will become to complicated for the users. And maybe I didn’t describe my goal well - so I’ll try it again:

The customer is a club for model aircraft sports. On their homepage it should be possible for registered users to sell used airplanes, helicopters, etc. privately. So that has to be as simple as possible. They should sign in and then use a form to offer their used things. Such offer consists of a heading, some richtext and up to five pictures. Any guest of their homepage should see all offers, but editing and deleting must be restricted to the creator of the offer (and of course the admin).

I’ve read a lot in your Guide Bob and NewsPublisher is very powerful and using it to solve my “simple” problem seems like to take a sledgehammer to crack a nut. Please correct me if you see it different.

Anyway I always appreciate your help! Regardless what I’m searching about MODX in most all cases I’ll find postings from helping out - so thanks on this way.

Greetinsg Mike

Putting edit button on each user page seems like a good solution to me. To edit or remove their page, they just have to visit it and click on the edit button.

On the other hand, it’s your site, and you’ll have to decide what works best for you.