User account page is an important part of directory and membership sites that allows users to see, edit, and delete their items. With Toolset, you can easily create such account page.
First, make sure that you’ve created a « My Account » page. To this page, we’ll add a list of « my content », with links to edit and delete items belonging to the logged-in user.
There are three main steps to follow to add such list to a « My Account » page:
- Create a View that lists the items of the currently logged-in user.
- Create a Toolset form for editing these items.
- Add the links to edit and delete items, to the View.
Create a View that lists the item of the currently logged-in user
Start by creating a simple View. Then, use the Query Filter to select only the posts created by the currently logged-in user.
- Edit the « My Account » page and insert the View block.
- Create a new View, select the type of content you want to list, and design its output.
- Click to select the main View block and in the right sidebar, expand the Content Selection section. and Query Filter section.
- Click the Add a filter button in the Query Filter subsection.
- In the dialog that appears, select to filter by Post author and click Add query filter.
- In the right sidebar, make sure that the Post author is the same as the logged in user option is selected and click Save.
Create a Toolset form for editing the items
Now, you need to create a Toolset form and a template for editing the items users can submit. You’ll create the form outside of the « My Account » page via the Toolset → Post Forms menu.
For detailed steps, check out the lesson about front-end forms for editing content.
Add the links to edit and delete items
Finally, you can edit the View you created in the first step and add links to edit or delete the items.
Steps for adding a link to edit listed posts:
- Insert the Fields and text block.
- Click the Add Form button and then click the Edit post link.
- Select the Content Template you created for editing posts and click to insert the shortcode.
Steps for adding a link to delete listed posts:
- Insert the Fields and text block.
- Click the Add Form button and then click the Delete Post link.
- If needed, select the additional options for the delete link and click to insert the shortcode.
That’s it! The « My Account » page now lists all posts of the currently logged-in users and provide them with links to edit or delete their own items.
Créez des listes de publication personnalisées
Related topics
- Using WooCommerce Fields in Product Forms
- Selecting Parent Posts when Using Forms to Create Child Items
- Displaying Form Data
- Restricting access to pages
- Create users and assign them the roles you created
- Grant Privileges to Content Managers
- Setting up Custom Roles for Members
- Creating a « My Account » Page
- Charge users for submitting content
- Extending Form Functionality with Hooks
- Styling Front-End Forms
- Setting up Automatic Post Expiration
- Controlling Access to Front-End Forms
- Adding Generic Fields to Forms
- Send Notifications when Someone Submits the Form
- Deleting Content from The Front-End
- Front-end Forms for Editing Content
- Front-end Forms for Adding Content
- Using the Native Media Manager in Front-End Forms
- Protecting Forms from Spam
- Front-end Forms For Repeatable Field Groups
- How to Reset Access Settings
- Selecting allowed tags in front-end forms
- Access Control for Fields
- Letting Forms Edit Post and User Fields Created by Other Plugins
- Access Control for Standard and Custom Content Types
- Conditional Display for Form Inputs