Sauter la navigation

Allow users to manage their items dans WordPress

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.

« My Account » page that lists the items of the currently logged-in user

There are three main steps to follow to add such list to a « My Account » page:

  1. Create a View that lists the items of the currently logged-in user.
  2. Create a Toolset form for editing these items.
  3. 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.

  1. Edit the « My Account » page and insert the View block.
  2. Create a new View, select the type of content you want to list, and design its output.
  3. Click to select the main View block and in the right sidebar, expand the Content Selection section. and Query Filter section.
  4. Click the Add a filter button in the Query Filter subsection.
  5. In the dialog that appears, select to filter by Post author and click Add query filter.
  6. 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 ToolsetPost Forms menu.

For detailed steps, check out the lesson about front-end forms for editing content.

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:

  1. Insert the Fields and text block.
  2. Click the Add Form button and then click the Edit post link.
  3. Select the Content Template you created for editing posts and click to insert the shortcode.

Steps for adding a link to delete listed posts:

  1. Insert the Fields and text block.
  2. Click the Add Form button and then click the Delete Post link.
  3. 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.

Main Toolset Block Used in this Lesson

Créez des listes de publication personnalisées

Updated
septembre 18, 2020