Forum Replies Created
-
AuthorPosts
-
ederingParticipant
Hi. I just sent you an admin password for doublec.us Thanks.
ederingParticipantI am using Admin Menu but using Block Selected. https://www.screencast.com/t/AzDL732iZNnL When logged in as this Role, I do see the YITH menu, and the Gift Cards choice. It just redirects me to main Dashboard. Also, I do have manage_options enabled.
ederingParticipantThanks, that worked!
31/03/2020 at 15:17 in reply to: Access to all Posts of a specific Custom Post Type and limit other Pages by ID #6736ederingParticipantThanks!
31/03/2020 at 14:46 in reply to: Access to all Posts of a specific Custom Post Type and limit other Pages by ID #6733ederingParticipantAlso, we already have this filter being used once for a different role/custom post type. How do we add it again, but make sure they run independently? See below.
// URE to allow Scholarship Role access to Scholarship plugin while restricting Pages for user add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions', 10, 1); function exclude_posts_from_edit_restrictions($post_type) { $restrict_it = $post_type; $user = wp_get_current_user(); if ( empty( $user) || !is_array( $user->roles ) ) { return $restrict_it; } if ( in_array( 'scholarships', $user->roles ) ) { // Role ID if ($post_type=='scholarship') { // CPT ID $restrict_it = false; } } return $restrict_it; } // end URE to allow Scholarship Role access
31/03/2020 at 14:35 in reply to: Access to all Posts of a specific Custom Post Type and limit other Pages by ID #6732ederingParticipantThanks! For the 2nd part, our SDoL Page Editor role ID is called sdol-page-editor. Would I use that for the Role, AND set the post_type to “post”? Or, is the idea to list the Role ID for Applications & Tools (applications_tools)? And do I list the post_type for the Applications & Tools custom post type?
31/03/2020 at 11:00 in reply to: Access to all Posts of a specific Custom Post Type and limit other Pages by ID #6730ederingParticipantThe user does not see any Pages menu item at all. I cloned Production to Staging and then disabled all plugins except URE. When testing a user as described above, now I don’t see any menu items except for Profile (not even the Applications & Tools, which I saw before). What would cause that? I had already given you access to this site before. You can access it at https://staging-sdlancaster.kinsta.cloud/ with userroleeditor (you can reset your password). I have enabled all Plugins again (except for 4 that are also deactivated on Production). I also removed the Post ID from the restrictions of the User called “icomm” (my test user). This is the user that should use the Applications & Tools Role (full access to that Custom Post Type) plus SDoL Page Editor role access for the post ID=28499. If you could look at that and test with icomm, I would appreciate it.
30/03/2020 at 15:18 in reply to: Access to all Posts of a specific Custom Post Type and limit other Pages by ID #6726ederingParticipantFor your first step, disabling the restrictions add-on does show all Posts in my specific Custom Post Type for that Role. But no pages show for the SDoL Page Editor Role at all. What would cause that? I don’t think Pages is being blocked in the Admin Menu (if you look at my links in my first post).
ederingParticipantThank you! This is working great now!
ederingParticipantVlad,
Thanks for your work on this. Unfortunately, the user group in question isn’t working. If you’re able, can you create a user with the role Program Editor and assign a
Analytics Group Name checkbox in the user profile? You should not be able to see all posts — only a limited number. The good news is that creating a post no longer fails, however, all posts should not show for non-admin roles. Are you able to take a look? Thanks for your help so far.ederingParticipantVladimir, I create an Admin user for you. Please look for an email to set your password. I am hoping you having access to the functions file and seeing where people assign the Analytics Group Name to a User will help you.
ederingParticipantVladimir,
I’ve determined that having the get_posts loop inside the function is causing issues, however, if I take it outside of the function, I can no longer access the values of the loop. Am I missing something?
ederingParticipantThanks. I have debugging turned on and the only errors logged are the ones are showing are the ones I’ve pasted above:
https://www.dropbox.com/s/wa0x9v892xrf0ua/server-errors.jpg?dl=0I’ll try turning off plugins and making the return adjustment above.
ederingParticipantVladimir,
Thanks for the response. I had it return early in the even tthat there the were no values assigned to the custom field. Should I not do that? Also, there are ~500 pages on the site. There are likely occasions that nearly all could be returned. Would that cause this to time out?
ederingParticipantHi Vladimir,
I took your recommendation above and to use the ure_edit_posts_access_id_list function and created this:
add_filter('ure_edit_posts_access_id_list', 'ure_edit_posts_access_set_id_list_cu'); function ure_edit_posts_access_set_id_list_cu($list) { $current_user = wp_get_current_user(); $ag = get_field('analytics_group_name','user_' . $current_user->ID); if(!isset($ag)){ return; }else{ $posts = get_posts(array( 'numberposts' => -1, 'post_type' => 'page', 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'analytics_group_name', 'value' => $ag, 'compare' => 'IN', ), ), )); foreach($posts as $post){ $list .= $post->ID.','; } $list = rtrim($list, ','); wp_reset_postdata(); return $list; } }
I’m able to return a list via echo and can see my comma separated list in the admin at the top of the page if I use init() temporarily. However, when I attempt to create a page (or any post type) as one of the role types that have a restriction by custom field, the page eventually runs out of memory (currently set to 1G) and we receive several fatal errors:
https://www.dropbox.com/s/wa0x9v892xrf0ua/server-errors.jpg?dl=0This role has what I believe to be everything needed for this role to create a post type:
create_pages
create_posts
create_tablepress_tables
create_tribe_eventsOther roles that we have set up do not have this issue, only this one. Any thoughts or recommendations on what we can try to resolve this issue?
-
AuthorPosts