Skip to content

Instantly share code, notes, and snippets.

@herewithme
Created September 23, 2013 09:13
Show Gist options
  • Save herewithme/6668210 to your computer and use it in GitHub Desktop.
Save herewithme/6668210 to your computer and use it in GitHub Desktop.
This plugin fix an issue with medias and content restriction on "Members" plugin WordPress (http://wordpress.org/plugins/members/). Allow to save correctly metabox data also for "attachment" post type.
<?php
/*
Plugin Name: Members - Fix for attachment
Plugin URI: http://www.beapi.fr
Description: This plugin fix an issue with medias and content restriction on "Members" plugin WordPress (http://wordpress.org/plugins/members/). Allow to save correctly metabox data also for "attachment" post type.
Author: BeAPI
Author URI: http://www.beapi.fr
Version: 0.1
----
Copyright 2012 Amaury Balmer ([email protected])
----
*/
add_action( 'add_attachment', 'members_content_permissions_save_meta_media', 10, 1 );
add_action( 'edit_attachment', 'members_content_permissions_save_meta_media', 10, 1 );
function members_content_permissions_save_meta_media( $post_id ) {
if ( !function_exists( 'members_content_permissions_save_meta' ) ) {
return false;
}
$post = get_post( $post_id );
members_content_permissions_save_meta( $post_id, $post );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment