webhoes

use alternative template for editing a page

Recommended Posts

I have a page my classifieds that allows for adding a new classified. All is done with API because user are not allowed acces to the admin. User also don't have page edit rights.

The new classified has template classified and is a child of classifieds. These are visible to the frontend.

Can use another template like classified edit to let user edit their classified.

I was thinking about a edit button/link on the my classifieds page per classified who are presented there in a list.

Can this be done? And if so, how?

 

 

Share this post


Link to post
Share on other sites

What's the reason for this strange sounding setup? So you want users to be able to create and edit pages, but not via the default template, and without the necessary rights? Why? Are you trying to create some sort of review workflow, i.e. the admin has to approve the classified first, and only he can then publish it? If that's the idea, you could simply work with page status: Only the admin can publish a new classified. (kinda like user-comments have to be reviewed and approved by someone, before it's published)

Share this post


Link to post
Share on other sites

User are not allowed to the admin because they can see privat information of others. The classifieds part is an extra feature to the site.

That is why all pages are done via the api and they can only see their own content. I have created seconday admin for that.

It looks like this. All entered classified of that user are placed under the submit form for a new classified.

All is working except editing a classified and adding an image. That is why I am thinking a editing the classified through another template.

I tried putting all entered classifieds in a forms, but could not get this working with images and making sure the right page gets updated.

image.thumb.png.5e404a5d014a2ce4351598fa8e8217d8.png

Share this post


Link to post
Share on other sites

not sure if this helps, but there is a little known trick you can do where you can change the active fieldgroup of any template at runtime...

I'm using this a bit in situations where i want to use a single template for something, but i want to be able to change stuff about the the layout, field descriptions, visibility, collapsed status and so forth, based on the value of a field; but it could be done based on other parameters/conditions..

Share this post


Link to post
Share on other sites

thanks @Macrura, that is not what I am looking right now.

However if this site works and might want to add more types of animals all with specific fields, then this would come in handy.

 

Share this post


Link to post
Share on other sites

I did. But for them to change their own page they need page-edit rights. When they see the page tree that also means they can see and edit pages of other users.

Also hooking into the page output is not good practice (read here on the forum).

Share this post


Link to post
Share on other sites

No, they can see their own pages only (and child pages). Perhaps it's configurable?

Share this post


Link to post
Share on other sites
3 hours ago, webhoes said:

I did. But for them to change their own page they need page-edit rights. When they see the page tree that also means they can see and edit pages of other users.

Also hooking into the page output is not good practice (read here on the forum).

No. They can see but not edit the page that they are not allow to edit. In other words, users are limited to edited the branch that assign to them.

2 hours ago, tpr said:

No, they can see their own pages only (and child pages). Perhaps it's configurable?

tpr is right. It is configurable.

Gideon

Share this post


Link to post
Share on other sites

The same branch contains pages from different users. Tried that and because all users have page edit right, they could edit other pages.

I think I found the solutions with an alternative template.

I created a my-classifieds-edit template and made it a child of my-classifieds. I made one page with it and called it edit.

A user can now call that page through a edit link like /my-classifieds/edit/?id=xxx

 

There is only one strange thing. When I ouput the description on the edit page, I see the <p> and <br> tags. And after a save these are visible in the frontend. Something that doesn't happen when creating the page the first time.

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.