Create WordPress tables with user specific content
Today, we’ve been testing Posts Table Pro, our dynamic WordPress table plugin, with the Advanced Access Manager plugin. This article will tell you how to use the two plugins together to list WordPress user specific content in a table.
You’ll learn how to list posts, pages or other custom post types. You’ll discover an easy way to restrict them so that different users see different posts in the table. I’ll also reveal how to hide your entire table so that only certain people can see it.
Why would I want to list WordPress user specific content?
There are lots of reasons why you’d want to create a WordPress table with user-specific content. For example:
- A WordPress document library might show some documents to the public, and others to staff or managers.
- Your index of blog posts might include some hidden posts that only logged in users with a specific role can see.
- Your e-commerce product table might list retail products to guests; and wholesale products to users with a ‘wholesale’ role. You can list retail and wholesale products on a single page, instead of needing a separate wholesale area.
You can do all this and more by combining Posts Table Pro with Advanced Access Manager.
Creating user specific content with Advanced Access Manager
Advanced Access Manager is surprisingly comprehensive for a free WordPress plugin. It comes with several ways to control access to WordPress content:
- Create role-specific content that only specific logged in user roles can see.
- Protect user-specific content that only named logged in user accounts can access.
- Choose whether or not visits (i.e. guest users) can see the content.
For each option, you can choose what appears for people without the correct privileges. You can hide the information completely, restrict it so that only people with the direct URL can see it, or display a custom message. You can restrict the ability to add comments, redirect people to another page, or password protect the content. It’s even possible to add an expiration date so that the user’s access automatically expires at a future date.
How to control access to pages, posts & custom post types
- First, install the free or pro version of the Advanced Access Manager WordPress plugin.
- When you add or edit a page, post or custom post type, you’ll find a new ‘Access Manager’ section.
- On the left, there are tabs for the different protection options. These let you create user role specific content, user specific content, as well as choosing what happens for guests.
- On the right, choose one or more access restriction settings. (More on this in the next section.)
How does it work with Posts Table Pro?
So far, I’ve told you how to create WordPress user specific content with Advanced Access Manager. Next, I’ll reveal how each restriction option works when you list your WP content in a table with Posts Table Pro:
- List – Hides user specific content from public areas, while remaining available to anyone with the direct URL. Posts and pages are hidden from your Posts Table Pro tables for unauthorized users. Users with the correct role or login can see them in the table.
- Read – Lists protected content as usual, but unauthorized users will see an ‘Access denied’ message when they try to access the page. Content is listed for all users in the Posts Table Pro table but unauthorized users cannot access the single post page.
- Limit – Not recommended, as the teaser message will not appear in Posts Table Pro.
- Read Counter – Restricts how many people can access the restricted content. The restriction only applies when people click on a link in the table to access the single post page. The page/post still appears in the table after the limit has been reached.
- Comment – Restricts who can comment on the single post page.
- Redirect – Redirects unauthorized users to your chosen URL if they try to access the single page/post.
- Password Protected – Password protects the page/post so that only people with the password can access it. It is still listed in the Posts Table Pro table as usual. Most of the columns in the table will appear for everyone, but information in the content column is hidden. A password login form appears in the content column so that users can enter the password directly into the table and reveal the hidden content.
- Access Expiration – Choose a date when the content will expire and people can no longer access the single post page.
Combining the access restrictions
You can combine the above options to create more complex rules for your WordPress user specific content.
For example, you can combine the ‘List’ and ‘Password Protected’ options to hide information from the table and require a password when someone tries to access the direct URL to the protected content.
Can I show different information in the table columns to different users?
Yes, you can do this with the Advanced Access Manager shortcodes. Create a column in the table as usual (e.g. a custom field column), and add Advanced Access Manager shortcodes to this field. You’ll need to add a separate shortcode for each group of users who needs to see different content.
For example, you might be listing ebooks in a table and want to add a ‘Register’ button for visitors and a ‘Download’ button for logged in users. You can do this by adding both buttons to a field in your table. Wrap one in a shortcode that is only visible to visitors; and wrap the other in a shortcode that is only visible to logged in users.
If you use this option, make sure you disable the caching option and enable the ‘Shortcodes’ option on the Posts Table Pro settings page. You must also disable the lazy load option in Posts Table Pro because the shortcodes only work when lazy load is inactive.
Please note that AAM has a ‘Message’ option in its shortcodes which lets you specify a message that appears to users without access to the content of the shortcode. This does not work with Posts Table Pro – the column will simply appear blank to unauthorized users, with no message. Instead, you need to add multiple shortcodes – one for each user group.
I want to restrict entire categories, not individual posts
The free version of Advanced Access Manager forces you to create user specific content on a per-post basis. There are a few choices for restricting access to entire categories:
- Advanced Access Manager Pro has a category-wide option.
- Alternatively, you can achieve the same with our WordPress Password Protected Categories plugin, or the WooCommerce-specific version of this plugin. They all work with Posts Table Pro for listing user specific content in a table.
Can I hide my entire table at once?
By now, you’ve learned how to list posts, pages or custom post types in a table with user specific access restrictions. Each user sees different information in the table – or can access different links from the table – depending on the restrictions.
If you prefer, you can hide the page containing your Posts Table Pro table instead. Simply use the ‘Access Manager’ controls at the bottom of the page where you’re using Posts Table Pro. This will hide the entire page – including the table – from non-authorized users.
Can I use it to list WooCommerce products?
Yes, but you’d be better off with our dedicated WooCommerce table plugin instead of Posts Table Pro. This has extra support for WooCommerce, such as add to cart buttons and product variations.
WooCommerce Product Table works with Advanced Access Manager in exactly the same way as Posts Table Pro. This means that you can use the two plugins to control which products are shown in the table to different users. It’s the perfect way to sell WooCommerce user specific products.
Can I sell access to members-only content?
Yes, the Pro version of WP Advanced Access Manager has this feature. It lets you sell access to exclusive content. You can then restrict certain pages/posts/custom posts so that only people who have purchased access can view it in the table.
Does it work with other WordPress membership plugins?
There are dozens of WordPress membership plugins available, and we can’t realistically test with all of them. The other one that we have tested with is Groups, which also works nicely with Posts Table Pro.
With Groups, you have to create a ‘group’ (hence the name!) and add users to one or more groups. You can then restrict your content so that only logged in users in the correct group can see it. If you’re listing content using Posts Table Pro, then users will only see information that their group has access to.
We love Groups, but Advanced Access Manager is a simpler option for many people. This is because it lets you lock down content to specific user roles, so you don’t have to bother creating groups and adding users to the correct group.
Do you use Posts Table Pro with access restrictions?
We’d love to hear how you use Posts Table Pro to show different WordPress content to different types of user. Please add your comments below.