Viewing 15 replies - 1 through 15 (of 19 total)
  • I’ve got the same error

    Yep, same issue.

    Appears on all the settings pages for a specific type.

    I got it as well.

    Same here>
    Wordpress 3.1 upgrade and Multisite enabled. It happens when I open up the “More types” from settings in sidebar.
    “Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/hs0cgfpq/public_html/wp-content/plugins/more-types/more-types-settings.php on line 291”

    Any Ideas?

    any fix?

    Try This:
    Paste the following code after line 182 in more-types-object.php:
    $options[‘show_in_menu’] = true;
    $options[‘capability_type’] = ‘post’;

    http://more-plugins.se/forum/topic/more-types-new-post-type-not-appearing-on-left-side-admin-menu

    Thread Starter dgodfather

    (@dgodfather)

    So this should be line 183 & 184 respectively?

    Although not a perfect fix, I did manage to get rid of the error by editing more-type-settings.php from line 285 – 296 to this:

    $tax = array();
            $stax = array();
            $mytax = $more_types_settings->get_val('taxonomies');
            foreach($wp_taxonomies as $taxonomy) {
                if (!trim($taxonomy->label)) continue;
                $tax[$taxonomy->name] = $taxonomy->label;
                if(is_array($mytax)) {
                if (in_array($taxonomy->name, $mytax)) $stax[] = $taxonomy;
                } else {
                    $stax[] = NULL;
                }
            }

    This is =not= a perfect fix, but it did got rid of the error. I’m not 100% sure how your custom taxonomies will respond to this!

    Errr… don’t do this 🙂 It will wreck your site, sorry.

    This worked for me. And by worked, I mean the errors are not showing up and the plug-in continues to work. Right above more-types-settings.php >> 291…

    if(!isset($mytax)) {
       $mytax = array();
    } else if(!is_array($mytax)) {
       settype($mytax, "array");
    }

    This should not interfere with the plug-in (I think) as we are simply forcing $mytax into an array-type. If $mytax already exists as an array, nothing will change. The original in_array() test on 291 will have the proper conditions needed to complete it’s task.

    Thread Starter dgodfather

    (@dgodfather)

    Thanks TrevorNet, that does get rid of the errors for sure. I’ll let you know if I run across other errors.

    Working for me here. Will report errors if encountered.

    Volker E.

    (@volker_e-1)

    @trevornet’s fix works for me too (WP 3.1.1/More Types 1.1).

    awpile

    (@awpile)

    @trevornet’s fix also worked for me (WP 3.1.1 with two sites networked).

    Just to be clear, lines 285-292 originally look like this:

    $tax = array();
    $stax = array();
    $mytax = $more_types_settings->get_val(‘taxonomies’);
    foreach($wp_taxonomies as $taxonomy) {
    if (!trim($taxonomy->label)) continue;
    $tax[$taxonomy->name] = $taxonomy->label;
    if (in_array($taxonomy->name, $mytax)) $stax[] = $taxonomy;
    }

    You add in @trevornet’s code to line 291, pushing what’s on 291 down. So the above block of code now looks like this:

    $tax = array();
    $stax = array();
    $mytax = $more_types_settings->get_val(‘taxonomies’);
    foreach($wp_taxonomies as $taxonomy) {
    if (!trim($taxonomy->label)) continue;
    $tax[$taxonomy->name] = $taxonomy->label;
    if(!isset($mytax)) {
    $mytax = array();
    } else if(!is_array($mytax)) {
    settype($mytax, “array”);
    }
    if (in_array($taxonomy->name, $mytax)) $stax[] = $taxonomy;
    }

    rajaito

    (@rajaito)

    @awpile – this worked for me :0)

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Plugin: More Types] Wrong datatype?’ is closed to new replies.