Support » Plugin: FooGallery - Image Gallery WordPress Plugin » Hide Foogallery access in Media Modal

  • Resolved rpatwall1206

    (@rpatwall1206)


    Hello, I am using the Foogallery in a marketplace website. I was able to use additional plugins to hide access to the gallery from Vendors and customers from the main admin menu. However, Access to the gallery via the image/media library is still visible. I need to be able to hide the following fields from all others roles except admin: “FooGallery Custom URL”; Point your attachment to a custom URL;
    Foogallery Custom Target; Set a custom target for your attachment

    Any help would be greatly appreciated

    https://wordpress.org/plugins/foogallery/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author bradvin

    (@bradvin)

    there is a filter “foogallery_attachment_custom_fields” that you can hook into for the particular roles and unset the following keys:

    foogallery_custom_url
    foogallery_custom_target

    Thank you for your quick response. Can you give me some direction on where to find this information and how to hook into the role and unset the keys.

    Thanks

    Plugin Author bradvin

    (@bradvin)

    you will need to create a plugin that hooks into the filter for all users that do not have admin capabilities:

    if ( is_admin() && current_user_can( 'manage_options' ) ) {
        /* A user with admin privileges - do not make any changes */
    } else {
        /* A user without admin privileges - remove the fields */
    
        add_filter( 'foogallery_attachment_custom_fields', 'my_custom_plugin_123_remove_foogallery_fields' );
    }
    
    function my_custom_plugin_123_remove_foogallery_fields( $fields ) {
        unset($fields['foogallery_custom_url']);
        unset($fields['foogallery_custom_target']);
        return $fields;
    }

    PLEASE NOTE : I have not tested this code, so please do so in a dev environment

    Excellent!!! Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide Foogallery access in Media Modal’ is closed to new replies.