Restrict access to specific content
You should be able to do this with Role Scoper plugin.
You should be able to do this with Role Scoper plugin.
funtion add_profile_page(){ $title_of_page = “page name”; if( null == get_page_by_title( $title_of_page ) ) { $post_id = wp_insert_post( array( ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’, ‘post_author’ => ‘1’, ‘post_name’ => ‘namehere’, ‘post_title’ => $title_of_page, ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’ ) ); update_post_meta($post_id, ‘_wp_page_template’, ‘mycustomprofile’); } } add_filter( ‘after_setup_theme’, ‘add_profile_page’ ); your template page /* Template … Read more
No plugin or PHP code is needed to do this. If you look at your HTML body class, you will see that WP helpfully adds the class of “logged-in” for any users who are registered and logged into the site. With this info along with the class name you give for the particular menu link … Read more
Assign specific editor with custom user meta “A” to all authors with custom user meta “A” and exclude all other author access
Essentially, you need: A global role-category relationship list, and/or… A per-user category list For per-user categories, hook onto the relevant profile actions: show_user_profile & edit_user_profile for displaying the field (use wp_terms_checklist()) personal_options_update & edit_user_profile_update for saving the data For the role-category data, use an options page. Loop over all roles ($wp_roles->roles) with a term checklist … Read more
You could use Buddypress to achieve this along with this plugin: https://wordpress.org/plugins/bp-redirect-to-profile/ Hope that helps.
You can use WP_Query to get the posts created by user in a specific category as well as a post type. To find posts of a specific category you can use the following snippet: $query = new WP_Query( ‘category_name=staff’ ); Where as to find posts of an author you can use the following snippet: $query … Read more
You are using an undefined variable in your code ($padeid), it can be causing you problems. Try this code instead: add_action(‘template_redirect’,’wpse16975_check_if_logged_in’); function wpse16975_check_if_logged_in(){ global $wp; if( ! is_user_logged_in() ) { $url = wp_login_url( site_url( add_query_arg( array(), $wp->request ) ) ); wp_redirect( $url ); exit; } }
Restrict access to custom post type and filter from every query
You´ll need to save some metadata for the user, possibly in two fields, like member_from and member_until which will hold your issue numbers. In your “issue view”, check whether the current issues number is between the values of those fields. If that´s the case allow access, otherwise show some “meh, no access” or “buy access” … Read more