Jump to content

Front End User ability to unpublish, republish, delete their page


quickjeff
 Share

Recommended Posts

Hi Guys,

Im at a point in my project where I have front end user registration, login capabilities and posting of page capabilities by registered users. The users can also edit their own page. Its pretty much a clean site that is made to function like Craigs list but look like a personal ad site. I have used ryans method for registration, profile control and login. All is good so far! Now in profile template which I call their account management page, a user sees all their pages they have posted. The user can click the link to their page to front end edit their pages content. I would like to also give them ability to unpublish, republish or delete their page. Any thoughts or ideas? The way I invision it, a script checks to see if the user has access to edit the page, which I have done. Then the user can edit via fedI front end editor module. Now I need to display a button unpublish, a button to republish and a button to delete.

Any guidance is appreciated.

Link to comment
Share on other sites

Jeff, the answer to your questions entails several parts; vxda has pointed you to one part. What's he's shown you is the API to unpublish/publish a page. You will need that when it comes to processing the programmatic request of a user to delete,

Here's the parts as I see them

1. Is the user logged in?

2. Do they have the right to edit this page?

3. User clicks button to delete or publish/unpublish - this sends a $post request

4. Check and sanitize the $post request

5. Does this user have permission to delete this page? - this is an added safety net

6. If yes, delete the page and let user know [success or failure]

Btw, remember delete and trash are different things in PW....

Gotta run...meanwhile, Google the forums about these suggested topics (I could have missed something...)

Link to comment
Share on other sites

Okay, with some help from other members here, I currently am displaying a link to the page the user is assigned to edit inside of their account manager page. 

<?php
     foreach($user->editable_pages as $aPage){
    
  echo "<li><a href='$aPage->url'>$aPage->title</a></li>";
  
}
?>

I would like to also add a button for them to be able to delete the page. 

Any help on this?  I have searched the API and not sure what would work best. 

:'(

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...