Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpnf-disable-sessions.php: Fixed an issue where non privileged users are not able to edit or delete entries. #874

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions gp-nested-forms/gpnf-disable-sessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@
function gw_gpnf_disable_session() {
remove_action( 'wp_ajax_gpnf_session', array( gp_nested_forms(), 'ajax_session' ) );
remove_action( 'wp_ajax_nopriv_gpnf_session', array( gp_nested_forms(), 'ajax_session' ) );
// Delete previous stored session.
$session = new GPNF_Session( '4' ); // Update "4" to the ID of the parent form.
$session->delete_cookie();
}

// Allow non-admin users to edit or delete entry.
add_filter( 'gpnf_can_user_edit_entry', function( $can_user_edit_entry, $entry ) {
// Update "5" to the ID of the child form.
if ( $entry['form_id'] == '5' ) {
return true;
}

return $can_user_edit_entry;
}, 10 , 2);

Check failure on line 33 in gp-nested-forms/gpnf-disable-sessions.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Space found before comma in argument list
Loading