WordPress.org

Support

Support » Plugins and Hacks » Gravity Forms - Update Post » Restricting Update Post to Post Author

Restricting Update Post to Post Author

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, this post is quite old but it still needs an answer.

    I figured out how to change this settings, for example:

    add_filter('gform_update_post_options', 'gform_update_post_options');
    
    	public function gform_update_post_options($options)
    	{
    	  $options['capabilities'] =  array(
    	      'update' => 'author',
    	      'delete' => 'author'
          );
    	  return $options;
    	}

    With this (you can put it in your theme’s functions.php), authors can edit (and delete) their posts.

    Hey, thanks for the follow up. That is probably the best route. I couldn’t figure out the options so I wrote a work around. I’ll post it so if anyone wants it:

    function gf_update_author_check(){
    
    	if (isset($_GET["gform_post_id"])){ 
    
    		$id = $_GET["gform_post_id"];
    		$post = get_post( $id );
    		$user = wp_get_current_user();
    
    			if($user->ID != $post->post_author){ 
    
    					wp_redirect(home_url());
    					exit;
    
    		}  
    
    	} 
    
    }
    add_action('template_redirect', 'gf_update_author_check', 1);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Restricting Update Post to Post Author’ is closed to new replies.
Skip to toolbar