Jump to content

How to Allow logged in user to add a page


ziu
 Share

Recommended Posts

I have created a website that has a login and register feature.
i used ryan's login register module.

but now i want the logged-in user to add a page e.g. Add Property this page will have custom fields which logged in user will fill. but user can add only single. and he/she can update/edit this page only.

I need your help guys in achiveing this.

Thanks in advance.

Any help will be appreciated.

Link to comment
Share on other sites

Easy. See 

Then have a field in that page for owner, which is the user's $user->id, add ?edit=true to the url (in a link from a user page or whatever)  then in the page template something like

<?php namespace ProcessWire;

// Code to display page contents to guests

if($input->get->edit && ($page->owner != $user->id)){
  echo 'You are not authorised to edit this page.';
} else {
  // Your code (edit form etc) here
}

Very rough, but you should get the gist.

If you get stuck, come back here and ask.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Hi dave, i attached an image , which describes what exactly i want to achieve.

after user fills that property page, this page will add as a sub page under All Properties page as children. but one thing to note that one user can submit only one property at a time, hence he has permission to edit and save that page only.

It will be big help for me, if you can guide me to perform this operation. as i am  searching forum since last 10 days to achieve this and still not getting it. 

thank you

 

addpage.jpg

Link to comment
Share on other sites

Moderator Note

20 hours ago, ziu said:

It will be big help for me, if you can guide me to perform this operation. as i am  searching forum since last 10 days to achieve this and still not getting it. 

@ziu,

Please do not start several topics about the same issue. I have deleted your other thread. 

  • Sad 1
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

×
×
  • Create New...