Forum Replies Created
-
AuthorPosts
-
ederingParticipant
Vladimir,
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?
ederingParticipantWow, I never knew that. Thanks. I wonder why full Admins don’t need to do that.
ederingParticipantHi Vladimir. The host provides the Event Calendar Pro so I don’t have access to get you a download. What I did was clone our Production site to Staging (via Kinsta) and gave your support address access as an Admin (username is userroleeditor). You should get the password reset email. My suggestion is you then create another user with the Role of “IU13 Admin”. That is role that cannot add Events to Appearance > Menus. Feel free to email direct if that is better. And thanks.
ederingParticipantHi. You reference WooCommerce. We are not using WooCommerce. The main issue is Modern Tribe’s Event Calendar Pro.
ederingParticipantVladamir, I have something similar going on for the GTranslate plugin – https://wordpress.org/support/plugin/gtranslate/. I don’t see it in Admin Menu, and when I go to Administrator and look at Admin Menu, it shows “administrator.” https://www.screencast.com/t/s87umrEtcrHG How do I add access to that for a Role created in URE (one that is not the full-rights admin)?
ederingParticipantthanks!
16/10/2019 at 16:58 in reply to: Give a role access to edit a spesific menu in Appearance > Menu #6039ederingParticipantThanks for the update
16/10/2019 at 16:10 in reply to: Give a role access to edit a spesific menu in Appearance > Menu #6037ederingParticipantHi Vladamir. I was looking for this too. I would love it. Has it been added as a Setting?
ederingParticipantThanks! That did it. You are amazing. I got confused because I did something similar for the Scholarships CPT but I guess the difference is that the filter/function for Scholarships was only because I did NOT want to restrict those at all by Post/Page ID and Users that have that role ALSO have Page ID Restrictions, so that separated it. Now I get it! Thanks
ederingParticipantok, I will try that. Do I get rid of only the entire add_filter line and keep the function as is? https://www.screencast.com/t/hpt7aZDzvXd
ederingParticipantWhere is it that I turned off Edit Restrictions for ‘news”? In the filter? In the code you just sent me in the other forum topic, you still have restrict_it=false. Is that right? Now when i login and test a user with SDoL Page Editor and News (with restrictions to a single category, I still see the News that has that category, but I still can add ore than one News Category, beyond the one I Allowed. in this screen, it shows the User I described above and it shows that I was able to publish to a category that I did set to be Allowed. Only McCaskey should be allowed. https://www.screencast.com/t/84YqUIGu3k8
ederingParticipantPlease look with the Admin rights I just emailed you. I created a user (which you can create one too if you want) that was a SDoL Page Editor, and News for the other Role. And I have one Page/Post ID Allowed (but it is showing All Pages), and one Category ID (for “McCaskey Campus” in the News categories). https://www.screencast.com/t/eG2WTzPPzb When I go to News and click Add New, this is what happens – https://www.screencast.com/t/QH2I2cz6z – it preselects the one Category I had in the Allow, but it let’s me see and choose any of the others.
-
AuthorPosts