Created
November 12, 2015 01:17
-
-
Save joshfeck/5087273c0ef4e39b13d9 to your computer and use it in GitHub Desktop.
From: http://eventespresso.com/topic/wp-users-allows-editing-others-questions/ and more documentation here: http://developer.eventespresso.com/docs/ee-capability-system-overview/#Core_WP_Wrappers_for_user_check_functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
function ee_filter_edit_question_group( $cap, $question_group_id ) { | |
$question_group = EEM_Question_Group::instance()->get_one_by_ID( $question_group_id ); | |
$current_user = wp_get_current_user(); | |
$user_id = $current_user->ID; | |
if ( $question_group instanceof EE_Question_Group && $question_group->wp_user() != $user_id ) { | |
return 'balderdash'; | |
} | |
return $cap; | |
} | |
add_filter( 'FHEE__EE_Capabilities__current_user_can__cap__espresso_registration_form_edit_question_group', 'ee_filter_edit_question_group', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment