• Resolved Peja

    (@peja1389)


    I get this for every category on the edit screen.

    Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/mysite/public_html/wp-content/plugins/restrict-categories/restrict-categories.php on line 204

Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author Matthew Muro

    (@mmuro)

    Some have reported that selecting a category and saving fixes this.

    If not, I’m working on some updates and will hopefully get them released soon.

    exact same problem here just after installing the plugin the very first time on a new wordpress site.

    the error is shown next to every unchecked checkbox, if you chack it the error is gone for that checkbox, anyway the plugin doesn’t work. No category is restricted.

    Thank you for the support

    Plugin Author Matthew Muro

    (@mmuro)

    I just pushed out Version 1.3 that hopefully fixes this error.

    @misthero: can you provide me the PHP version you are running (eg. 5.2.1, 5.3.2)?

    Thank you for your answer,

    I just udpdated but:

    Downloading update from http://downloads.wp.xz.cn/plugin/restrict-categories.1.3.zip…
    
    Unpacking the update…
    
    Installing the latest version…
    
    Deactivating the plugin…
    
    Removing the old version of the plugin…
    
    Plugin upgraded successfully.
    
    Reactivating the plugin…
    
    Warning: Invalid argument supplied for foreach() in /home/www/test-site/public_html/wp-content/plugins/restrict-categories/restrict-categories.php on line 277

    I see this error on top of every page in the dashboard now….

    PHP Version 5.2.6-1+lenny9

    I tried to disable every plugin but restrict categories, no good.

    anyway the previous error is gone, still no gategory restricted.

    Thank you again.

    Plugin Author Matthew Muro

    (@mmuro)

    Hmm…

    You shouldn’t be getting an error on that line. The only reason you’d be getting that error is if get_user_meta is not returning an array.

    Can you add var_dump($user_cap); right before line 277 and tell me what it outputs?

    Also, you may want to download a fresh copy of the plugin again.

    Tis is what I get adding that line

    string(0) ""
    Warning: Invalid argument supplied for foreach() in /home/www/test-site/public_html/wp-content/plugins/restrict-categories/restrict-categories.php on line 279

    Like I said is a fresh installation with untouched wordpress running Twentyten theme, I’ll try deleting and uploading the plugin manually and let you know what happens.

    ok, deleted the plugin , uploaded again via ftp and activated, the error is still there…

    If you want me to try anything else I’m here.

    Thank you again

    Plugin Author Matthew Muro

    (@mmuro)

    For some reason, get_user_meta is returning an empty string. What version of WordPress are you running?

    oh sorry, I went to sleep, the wordpress version is the last, 3.0.1 english languange, the theme is twentyten,it is a test server, I’m testing some functionalities I want to include in a real theme, if it’s important the istallation for now includes just 6 users I created for testing a 2 categories.

    if you want I can give you access to the dashboard, no problem for me if you have some spare time..

    Thank you.

    Plugin Author Matthew Muro

    (@mmuro)

    How comfortable are you with MySQL?

    If you can use phpMyAdmin or something similar to access your database, open the wp_usermeta table and find the wp_capabilities entries under the meta_key column. You should have one for each user role. Paste in one of the meta_value here. It’ll look something like this: a:1:{s:13:"administrator";s:1:"1";}

    Hi Matthew,

    I have 2 roles set up right now, the meta values are:

    a:1:{s:13:"administrator";s:1:"1";}
    for the default admin

    a:1:{s:11:"contributor";s:1:"1";}
    for the 6 contributors i created

    but now looking at the database one thing maybe you should know, in this database the prefix is not “wp_” many of us change the default table prefix inside config.php file

    in my case the prefix is “test_” because I specified the var:
    $table_prefix = 'test_';
    in config.php

    so I do not have wp_usermeta nor wp_capabilities but
    but test_usermeta and test_capabilities, and so on…

    Could this be the problem with the plugin??

    Thank you.

    Plugin Author Matthew Muro

    (@mmuro)

    Is the meta_key called wp_capabilities?

    Plugin Author Matthew Muro

    (@mmuro)

    I’m sorry, I should have read your response more carefully.

    Yes, that seems to be the problem with the plugin on your server. I’m able to reproduce the error.

    A short term fix will be to change line 275 from $user_cap = get_user_meta( $current_user->ID, 'wp_capabilities', true ); to $user_cap = get_user_meta( $current_user->ID, 'test_capabilities', true );.

    I will work on getting a permanent fix online if you want to wait for the official download, though.

    nope, is test_capabilities

    as a side note I tried the bad way :p

    changing any istance of wp_capabilities in the plugin with test_capabilities, the plugin seem to start working, it restrict categories, but I get another error:

    Warning: Invalid argument supplied for foreach() in /home/www/test-site/public_html/wp-content/plugins/restrict-categories/restrict-categories.php on line 280

    Line280:
    foreach ( $settings[$key . '_cats'] as $category ) {

    maybe mine is not the best solution…

    edit: sorry I wrote while you where posting

    Plugin Author Matthew Muro

    (@mmuro)

    Cool.

    I pushed out a fix for that other error you are getting yesterday right around the time I told you to grab a fresh copy. You may want to try that again and reapply the test_capabilities fix.

    Sorry for all the trouble, but you are helping make it a better plugin 🙂

Viewing 15 replies - 1 through 15 (of 22 total)

The topic ‘[Plugin: Restrict Categories] Error when using plugin…’ is closed to new replies.