Hot answers tagged

4 votes

Wordpress roles - Protect administrator role

It's a bit different in WP than in Drupal. First, the admin role is specifically designed to be the role that can do everything. Rather than try to restrict the admin role, it's best practice to ...
WebElaine's user avatar
  • 9,310
4 votes

Custom Roll/Custom Post Type - Can't Select Categories

I had the same problem, a custom role couldn't assign categories to my CPT. When doing register_taxonomy(), I added these capabilities: 'capabilities' => array ( '...
Helpful Lurker's user avatar
3 votes
Accepted

Private member page

You can do it without plugins, you just have to allow subscribers to see Private posts and pages, depending on what you want, so you have to put this code in your functions.php $subRole = get_role( '...
Castiblanco's user avatar
  • 2,164
2 votes
Accepted

Showing content to specific BuddyPress Member Types

Your answer is on the codex page link in your question. // Get the member type of user 5412. $member_type = bp_get_member_type( 5412 ); So you could do something like this: $member_type = ...
shanebp's user avatar
  • 5,048
2 votes

Wordpress roles - Protect administrator role

This is a perfect use for the map_meta_cap filter. function my_map_meta_cap( $caps, $cap, $user_id, $args ) { if( 'delete_user' !== $cap ) { return $caps; } if( isset( $args[0] ) && ...
Nathan Johnson's user avatar
1 vote

one time visit to the page

Although this is not a WP question, it could be done with some PHP/MySQL code. Just the psuedocode: generate a GUID value on each main page visit check if the GUID is already in the GUID database if ...
Rick Hellewell's user avatar
1 vote

Hiding posts from non logged in users

Use this code on your child theme’s functions.php file.. //Hide for non-logged-in users (public visitors) function bp_logged_out_page_template_redirect() { if( ! is_user_logged_in() && ...
MAN5's user avatar
  • 11
1 vote

Hiding posts from non logged in users

Fiddling with user roles would probably be the most robust solution, however a quick and dirty approach would be to set post meta-data to mark posts that should be hidden, then add a meta-query to ...
bosco's user avatar
  • 6,745

Only top scored, non community-wiki answers of a minimum length are eligible