WordPress.org

Ready to get started?Download WordPress

Forums

View Own Posts Media Only
Conflict with Advanced Custom Fields (15 posts)

  1. josh_fester
    Member
    Posted 1 year ago #

    This plugin works great with media but it hides all the custom fields created with ACF, which makes it unusable for me

    http://wordpress.org/extend/plugins/view-own-posts-media-only/

  2. brasofilo
    Member
    Posted 1 year ago #

    @josh_fester, ACF is changing a lot of things in version 4, and many regarding media management.
    If you are able, test it out: https://github.com/elliotcondon/acf4

  3. Yaron Guez
    Member
    Posted 1 year ago #

    Josh, did you find a solution that is ACF compatible?

  4. Yaron Guez
    Member
    Posted 1 year ago #

    Actually, I just installed this plugin and ACF still works fine at least on custom post types (I don't have any custom fields set up for standard posts).

  5. hlotvonen@gmail.com
    Member
    Posted 1 year ago #

    Still not working with ACF, even with ACF 4.0 beta installed.

  6. coopersita
    Member
    Posted 1 year ago #

    For me it works only partially. It works with Administrator users, but my custom roles don't work. When I disable the plugin, my ACF works normally.

  7. CobraClutch
    Member
    Posted 1 year ago #

    Custom fields created by ACF are not showing up for me either with this plugin enabled.

  8. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, I should visit this page more often :).
    But I'm wonder, why nobody contact me directly or via shinephp.com?
    I just published version 1.1. with similar fix for "Contact Form 7" plugin. I can not release version 1.2 just after 10 minutes after version 1.1. So let's wait a week for the official update. For that time you may replace this function at includes/class-view-own-media-posts-only.php

    public function query_set_only_author($query) {
    
    		global $current_user;
    
    		// do not limit user with Administrator role
    		if ( current_user_can('administrator') ) {
    			return;
    		}
    
        // do not touch anything for listed custom post types:
        $do_not_touch = array(
           'wpcf7_contact_form', // Contact Form 7 requests
           'acf'  // Advanced Custom Fields
        );
        $post_type = $query->get('post_type');
        if (in_array( $post_type, $do_not_touch )) {
          return;
        }
    
    		$suppressing_filters = $query->get('suppress_filters');	// Filter suppression on?
    
    		if (!$suppressing_filters && is_admin() && current_user_can('edit_posts') && !current_user_can('edit_others_posts') ) {
    			$query->set('author', $current_user->ID);
    
    			add_filter('views_edit-post', array(&$this, 'fix_post_counts') );
    			add_filter('views_upload', array(&$this, 'fix_media_counts') );
    
    		}
    	}

    and use ACF without problem. Thanks.

  9. NikoV
    Member
    Posted 1 year ago #

    @Vladimir Garagulya

    Thank you for this fix code! It works like a charm with Advanced Custom fields. I hope we can see this included on the next patch straight prolly? Was really a life/user navigation saver :)

    Cheers,
    Niko

  10. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks, Niko, for your feedback.
    I plan to add the section to the plugin options page, where user could select yourself, what custom post types plugin should ignore.

  11. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Niko,

    Please share the result of testing version 1.2. You need manually turn on exclusion for the 'acf' custom post type at plugin Settings page.

    Regards,
    Vladimir.

  12. josh_fester
    Member
    Posted 1 year ago #

    @Vladimir Garagulya

    I apologize for not getting back sooner. I had an issue with my WordPress account and did not realize it.

    Version 1.2 resolves this problem. It's awesome to have the new options! However, I've noticed a new issue with ACF. Whenever a field in ACF is a post object, it shows up in the form as a list of every single post. Any thoughts on how to limit this dropdown box to just the posts created by the user? Thanks

  13. Vladimir Garagulya
    Member
    Plugin Author

    Posted 1 year ago #

    Could you provide more details with screenshots, what dropdown box, on what form, what items do you not wish to see there?

  14. josh_fester
    Member
    Posted 1 year ago #

    It turns out it wasn't an issue with ACF. It was just an issue with my user capabilities. I only want administrators to see other people's content, and other user groups have customized permissions.

    To solve it I changed line 209 of includes/class-view-own-posts-media-only.php from this:

    if (!$suppressing_filters && is_admin() && current_user_can('edit_posts') && !current_user_can('edit_others_posts'))

    to this:

    if (!$suppressing_filters && is_admin() && !current_user_can('administrator'))

  15. josh_fester
    Member
    Posted 1 year ago #

    It would be really sweet to have options asking which user roles we want to see others' posts :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.