WPIntell

Source evidence

Restrict with frontend forms

Access Areas for WordPress · support · 2014-10-08T18:47:00+00:00

mixedsentiment
mediumseverity
0.78relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 34 rows with source links

17.6% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

28 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
zwene resolved
Hi, for new posts created in the backend I can choose the standard read/write access group. That works well. If I create a new post/event eg. with Event Organiser Frontend Submission Form the option I made isn’t used. Instead read/write is “WordPress Standard” at this posts/events again. Is there a way to give a frontend made post/page the read/write option on there way? Eg. with a hidden field like <input type="hidden" name="access" value="logged-in"> ? Greetings, zwene https://wordpress.org/plugins/wp-access-areas/ Hi zwene, you may try <input type="hidden" name="post_view_cap" value="CAPABILITY" /> where the value of CAPABILITY is read for logged in users, exist for everybody, any WP rolename or Access Area capability (the userlabel_N_* things found in the right column under Users / Access Areas). I can’t really say if this will work with the EO Frontend Submissions (I did not buy it yet, and I don’t plan to do so.). Likely it won’t, because the plugin might only use those $_POST values it knows about. Hi podpirate, thank you for response. 🙂 I tested a lot of combination but it don’t work. 🙁 Where are you storing the *_view_cap values for a post? Wouldn’t it be easier to interact with other plugins and scripts to store them (alternatively) as a meta key? Or look if a meta key _post_view_cap _post_edit_cap _post_comment_cap like _wpaa_fallback_page _wpaa_post_behavior exists and use the values of this meta keys instead then? This would be a great help. 🙂 And btw.: On the option page I edit the standard value for the event post type. Have you an idea why the standard values aren’t used if you create a new object not in the backend? Greetings, zwene I think I got it. Being a bit savy on memory the plugin is not loading the admin classes in the frontend. I will think of a way to do this in a more generic way (like every time a post is saved). For now this one might help. Tested together with WP User Frontend , which might be a similar scenario to your use case: function wpaa_insert_post_data_filter() { // (a) in admin the filter is already set. (b) will be true if plugin is active: if ( ! is_admin() && class_exists(‘UndisclosedEditPost’)) add_filter(‘wp_insert_post_data’, array( ‘UndisclosedEditPost’ , ‘edit_post’) , 10 , 2 ); } add_action(‘init’,’wpaa_insert_post_data_filter’); The filter function UndisclosedEditPost::edit_post() will either set the default access from the settings on a new post or – if the user has permission – populate it from $_POST['post_*_cap'] . (“Permission” here means: being capable of the value in $_POST['post_*_cap'] AND being allowed to edit the *_cap.) FYI: The plugin is creating three additional columns in the posts table post_view_cap , post_edit_cap and post_comment_cap . This is mainly to avoid additional JOIN statements when retrieving large amounts of posts like on an archive page, but also for being safe from undefined or empty or invalid or multiple post_meta values. all the best, podpirate Hi podpirate, thank you so much, the filter function works perfectly. 🙂 >Tested together with WP User Frontend, >which might be a similar >scenario to your use case: This plugin looks interesting. I will have a look on it. Thank you for the tipp. 🙂 Greetings, zwene

Comments

4 shown
podpirate 2014-10-09T18:16:00+00:00

Hi zwene, you may try <input type="hidden" name="post_view_cap" value="CAPABILITY" /> where the value of CAPABILITY is read for logged in users, exist for everybody, any WP rolename or Access Area capability (the userlabel_N_* things found in the right column under Users / Access Areas). I can’t really say if this will work with the EO Frontend Submissions (I did not buy it yet, and I don’t plan to do so.). Likely it won’t, because the plugin might only use those $_POST values it knows about.

zwene 2014-10-09T21:38:00+00:00

Hi podpirate, thank you for response. 🙂 I tested a lot of combination but it don’t work. 🙁 Where are you storing the *_view_cap values for a post? Wouldn’t it be easier to interact with other plugins and scripts to store them (alternatively) as a meta key? Or look if a meta key _post_view_cap _post_edit_cap _post_comment_cap like _wpaa_fallback_page _wpaa_post_behavior exists and use the values of this meta keys instead then? This would be a great help. 🙂 And btw.: On the option page I edit the standard value for the event post type. Have you an idea why the standard values aren’t used if you create a new object not in the backend? Greetings, zwene

podpirate 2014-10-10T08:43:00+00:00

I think I got it. Being a bit savy on memory the plugin is not loading the admin classes in the frontend. I will think of a way to do this in a more generic way (like every time a post is saved). For now this one might help. Tested together with WP User Frontend , which might be a similar scenario to your use case: function wpaa_insert_post_data_filter() { // (a) in admin the filter is already set. (b) will be true if plugin is active: if ( ! is_admin() && class_exists(‘UndisclosedEditPost’)) add_filter(‘wp_insert_post_data’, array( ‘UndisclosedEditPost’ , ‘edit_post’) , 10 , 2 ); } add_action(‘init’,’wpaa_insert_post_data_filter’); The filter function UndisclosedEditPost::edit_post() will either set the default access from the settings on a new post or – if the user has permission – populate it from $_POST['post_*_cap'] . (“Permission” here means: being capable of the value in $_POST['post_*_cap'] AND being allowed to edit the *_cap.) FYI: The plugin is creating three additional columns in the posts table post_view_cap , post_edit_cap and post_comment_cap . This is mainly to avoid additional JOIN statements when retrieving large amounts of posts like on an archive page, but also for being safe from undefined or empty or invalid or multiple post_meta values. all the best, podpirate

zwene 2014-10-10T20:31:00+00:00

Hi podpirate, thank you so much, the filter function works perfectly. 🙂 >Tested together with WP User Frontend, >which might be a similar >scenario to your use case: This plugin looks interesting. I will have a look on it. Thank you for the tipp. 🙂 Greetings, zwene