• Resolved opus13i

    (@opus13i)


    My system is fully up and running, with the exception of viewing tickets that have been marked as ‘Closed’.

    An end-user sees the tickets in their ticket history, but as an admin, in the admin view, once a ticket is marked as closed there is no way to view any entries.

    Using the view filters, if I select:

    All Dates > Closed > All Status > All Activity and then <Filter> there are never any results. I feel like I gotta be missing something obvious, but I am just not getting there.

    My WP install and all tools are fully up to date.

    • This topic was modified 6 years, 4 months ago by opus13i.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author awesomesupport

    (@awesomesupport)

    Hmmmm….can you post an image that shows your filter bar with the settings? Maybe there’s something else in there that’s not supposed to be there (its a long shot but lets start with the basics).

    Thanks.

    Thread Starter opus13i

    (@opus13i)

    Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    Thanks for the video. The invalid post type is a clue. You’re likely looking at a conflict with another plugin that’s doing some sort of security thing. There are some plugins that try to do things with WP custom post types and sometimes they don’t quite get it right. So I’m afraid that you’re going to have to go through the whole arduous elimination process that is PITA. But its the fastest way to figure out which plugin is getting in the way (it could be the theme as well but that’s rarer).

    The way it works is like this:

    1. Backup your system just in case.
    2. Turn off all plugins besides awesome support. Does the issue go away? If not, switch your theme to a WP 2015/16/17 theme and try again.
    3. If after turning off the plugins and testing again, the problem did go away, just turn on each plugin one by one, testing as you go until it fails again. Then the last plugin you turned on is the culprit.

    I know its a pain but its the fastest way to figure out what’s getting in the way.

    Thanks.

    Thread Starter opus13i

    (@opus13i)

    Aha! The conflict is from a set of functions in my child theme. The functions are for automatically creating bi-directional ‘relationships’ for ACF and to merge values for searching compatibility.

    
    /* bidirectional relationships ---------------------------------------------------------- */
    
    function bidirectional_acf_update_value($value, $post_id, $field)
    
    {
    
        $field_name = $field['name'];
    
        $field_key = $field['key'];
    
        $global_name = 'is_updating_'.$field_name;
    
        if (!empty($GLOBALS[$global_name])) return $value;
    
        $GLOBALS[$global_name] = 1;
    
        if (is_array($value))
    
        {
    
            foreach($value as $post_id2)
    
            {
    
                $value2 = get_field($field_name, $post_id2, false);
    
                if (empty($value2))
    
                {
    
                    $value2 = array();
    
                }
    
                if (in_array($post_id, $value2)) continue;
    
                $value2[] = $post_id;
    
                update_field($field_key, $value2, $post_id2);
    
            }
    
        }
    
        $old_value = get_field($field_name, $post_id, false);
    
        if (is_array($old_value))
    
        {
    
            foreach($old_value as $post_id2)
    
            {
    
                if (is_array($value) && in_array($post_id2, $value)) continue;
    
                $value2 = get_field($field_name, $post_id2, false);
    
                if (empty($value2)) continue;
    
                $pos = array_search($post_id, $value2);
    
                unset($value2[$pos]);
    
                update_field($field_key, $value2, $post_id2);
    
            }
    
        }
    
        $GLOBALS[$global_name] = 0;
    
        return $value;
    
    }
    
    add_filter('acf/update_value/name=related_to', 'bidirectional_acf_update_value', 10, 3);
    
    /* add post types to search ---------------------------------------------------------- */
    
    function rc_add_cpts_to_search($query) {
    
        // Check to verify it's search page
    
        if (is_search()) {
    
            // Get post types
    
            $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects');
    
            $searchable_types = array();
    
            // Add available post types
    
            if ($post_types) {
    
                foreach($post_types as $type) {
    
                    $searchable_types[] = $type - > name;
    
                }
    
            }
    
            $query - > set('post_type', $searchable_types);
    
        }
    
        return $query;
    
    }
    
    add_action('pre_get_posts', 'rc_add_cpts_to_search');
    
    /* Combine fields for search --------------------------------------------------- */
    
    function cf_search_join($join) {
    
        global $wpdb;
    
        if (is_search()) {
    
            $join. = ' LEFT JOIN '.$wpdb - > postmeta.
            ' ON '.$wpdb - > posts.
            '.ID = '.$wpdb - > postmeta.
            '.post_id ';
    
        }
    
        return $join;
    
    }
    
    add_filter('posts_join', 'cf_search_join');
    
    function cf_search_where($where) {
    
        global $pagenow, $wpdb;
    
        if (is_search()) {
    
            $where = preg_replace(
    
                "/\(\s*".$wpdb - > posts.
                ".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
    
                "(".$wpdb - > posts.
                ".post_title LIKE $1) OR (".$wpdb - > postmeta.
                ".meta_value LIKE $1)", $where);
    
        }
    
        return $where;
    
    }
    
    add_filter('posts_where', 'cf_search_where');
    
    function cf_search_distinct($where) {
    
        global $wpdb;
    
        if (is_search()) {
    
            return "DISTINCT";
    
        }
    
        return $where;
    
    }
    
    add_filter('posts_distinct', 'cf_search_distinct');
    
    Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    I’m glad you were able to locate the issue. Unfortunately we’re not going to able to help you with that custom code. But maybe contacting the theme developers and asking them to exclude the AS post types is worth a shot. I suspect though that if this is happening to our post types that it could be happening to others and you might not have noticed it yet. So maybe encourage them to figure out the root cause of the issue?

    Thanks.

    Thread Starter opus13i

    (@opus13i)

    Ah, no, it was a custom code bit I had hired out many moons ago, and has since been proven to be way useful on a variety of projects. It has become a part of my default child theme template since, and this is the first time there has ever been a conflict with it.

    Thanks for the help!

    Thread Starter opus13i

    (@opus13i)

    (marking as closed)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can’t see closed tickets?’ is closed to new replies.