Lock Down by Entry Creator

Code

Filename: gppcmt-lock-down-by-entry-creator.php

<?php
/**
 * Gravity Perks // Post Content Merge Tags // Lock Down by Entry Creator
 * https://gravitywiz.com/documentation/gravity-forms-post-content-merge-tags/
 */
add_action( 'wp', function() {
	if ( ! is_callable( 'gp_post_content_merge_tags' ) ) {
		return;
	}
	$entry = gp_post_content_merge_tags()->get_entry();
	if ( ! $entry ) {
		return;
	}
	if ( get_current_user_id() !== (int) $entry['created_by'] && ! current_user_can( 'gform_edit_entries' ) ) {
		die( 'Bad boy!' );
	}
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.