Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trade Members Only Content

Featured Replies

Hi guys,

 

I'm in the process of developing a couple of websites for clients who only promote their products/services to trade customers. I need to figure out the best way to protect specific pages (and custom post types!) from visitors unless they're signed in as "trade members." I need the ability to redirect them to a trade member registration page if not logged in or registered, and then also need the ability to manually approve them.

 

There seem to be solid plugins for restricting content, but not ones that also handle the user registration side of things. WP-Members looked ok, but then it doesn't appear to support custom post types

I tried to do something similar in the past but didn't get that far like you say the WP-Members was ok depending what you wanted to do and also http://wordpress.org/plugins/wordpress-access-control/ wasn't bad either, I believe it redirected users to a login page.

 

It be good to know if you do come across a good solution though.

Edited by 1clickweb

Wordpress uses Roles and Capabilities to restrict and display content to members based on their roles. You basically display the content of the page based on the users role by using a conditional statement in the template. You can use a plugin if you like but since it is native functionality I find it just as easy to give the custom post type its own capabilities and use them in conditional statements like:

 

if ( current_user_can('read_custom_post') ) {
 echo 'The current user can read this post';
}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.