• Resolved KZeni

    (@kzeni)


    Here’s the full error:
    Warning: Missing argument 2 for current_user_can_for_blog(), called in /wp-content/plugins/collaboration/togetherjs.php on line 34 and defined in /wp-includes/capabilities.php on line 1362

    As it’s shown at the top of the admin & public pages whenever the plugin is active on a standard (not networked) WordPress site running 3.8.1.

    The Fix:
    A quick change of current_user_can_for_blog() to current_user_can() on line 34 of togetherjs.php fixed this issue. Should continue to work for networked sites as this function assumes the currently viewed site (which is what we want).

    https://www.ads-software.com/plugins/collaboration/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter KZeni

    (@kzeni)

    However…
    You’re not supposed to pass roles into current_user_can (more info). For example, I had it set to Subscriber and I couldn’t see it as an Administrator (on a non-multisite)… not good.

    So either the role setting should be switched to selecting a capability, or you can add a function that allows you to still ask for a role while the plugin then sorts the roles by user level & checks using that rather than using current_user_can().

    Seems like the quickest/easiest fix is to change to having it be a matter of selecting capabilities rather than roles (in addition to the bug fix above).

    If you’re looking of an example that uses the get_sorted_roles setup, AdRotate has this (you’ll find adrotate_get_sorted_roles as well as the other dependent functions in adrotate-functions.php [again, doesn’t seem like the quickest fix]).

    I’m here to help if you want me to dig deeper. I definitely like the idea behind the plugin & would love to see it furthered!

    Plugin Author Maxaud

    (@maxaud)

    I’ve fixed this for the next version. Thanks for the help.

    Thread Starter KZeni

    (@kzeni)

    Looking forward to what you come up with. Thanks again!

    Plugin Author Maxaud

    (@maxaud)

    v1.1 has been uploaded through SVN and should be live shortly.

    Plugin Author Maxaud

    (@maxaud)

    Please test it when it comes out and see if any issues still persist. Thank you.

    Thread Starter KZeni

    (@kzeni)

    Looks to be working perfectly. Much appreciated! Cheers!

    Plugin Author Maxaud

    (@maxaud)

    Yeah, thanks for your help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘"Missing argument 2 for current_user_can_for_blog()" error on non-multisite.’ is closed to new replies.