WordPress.org

Ready to get started?Download WordPress

Forums

More Types
Fatal error: Call to a member function add_cap() (25 posts)

  1. horria
    Member
    Posted 4 years ago #

    After defining a new post type, i get this error on every admin page. deleting/reinstalling the plugin does not resolve the problem.

    Fatal error: Call to a member function add_cap() on a non-object in ..\wp-content\plugins\more-types\more-types-object.php on line 121

    Thanks

  2. gervasioantonio
    Member
    Posted 4 years ago #

    I'm having this issue too.
    In fact this error only shows up if up change something in the 'Advanced Settings' page while creating/editng a new type, specifically if you assign some capabilities to the listed roles.

  3. henrikmelin
    Member
    Plugin Author

    Posted 4 years ago #

    Thanks for the bug report - I'll be fixing this in the next version. We're in the process of ironing stuff like this out, preparing for 1.0 which'll be out this week!

  4. gervasioantonio
    Member
    Posted 4 years ago #

    Thanks for the fast response. I'll wait patiently :)

    BTW, big thanks for the awesome "More..." suite!

  5. cvernon
    Member
    Posted 3 years ago #

    Hello,

    Still having this error:

    Fatal error: Call to a member function add_cap() on a non-object in /%SERVERPATH%/wp-content/plugins/more-types/more-types-object.php on line 135

    Is this the same error? I just downloaded this and set it up yesterday. It works fine until I log out of admin, at which point all is broken...

    Please let me know asap if you are going to be able to fix this soon, or if the community can help resolve this for us all,

    Thanks,

  6. theb
    Member
    Posted 3 years ago #

    Hey,

    I just comment out the line and it seems to work. What kind of capability do this line add (to what?!)?

    Posts with this "more type" Type are not displayed in the frontend. Also with that error line enabled.

    TheB

  7. effi10
    Member
    Posted 3 years ago #

    Hello

    If roles aren't important for you, you just have to comment line 135 in more-types-object.php file ;)

  8. Taylor Baybutt
    Member
    Posted 3 years ago #

    my apologies, commenting out works!

    Roles are important to me but I am willing to sacrifice them in this instance to get the plugin working. However, commenting it out is not working, did you try logging out and logging back in? It only seems to happen on the login screen.

    even when I delete the whole line, the error still shows up and says its on that line. so strange.

  9. rnconfalonieri
    Member
    Posted 3 years ago #

    Hello:

    I'm working with WordPress 3.1 and the more-tipes plugin throws the following error:

    Fatal error: Call to a member function add_cap() on a non-object in /%SERVERPATH%/wp-content/plugins/more-types/more-types-object.php on line 135

    I need the complete functionality of the plugin, so I would like how to fix it or if it will be fixed in a short period of time.

    Thank you very much.

  10. Taylor Baybutt
    Member
    Posted 3 years ago #

    You'll have better luck asking on the More Plugins support forums: http://labs.dagensskiva.com/forum/

    This function would only be useful if you were setting roles i think.

  11. Upstreet Media
    Member
    Posted 3 years ago #

    Find line 135.

    Chang: $wp_roles->add_cap($role, $capability);

    To:

    if(is_object($mp_roles) && method_exists($wp_roles,'add_cap'))
    {
    	$wp_roles->add_cap($role, $capability);
    }
  12. Andrew Martin
    Member
    Posted 3 years ago #

    @phxvyper Thanks so much, that fixed my issue. It was strange, it was only breaking in IE. Glad it's fixed now!

  13. pete-sch
    Member
    Posted 3 years ago #

    Bug is still present in the latest version.

    Plugin version 2.0.3
    WordPress version 3.0.1

    Reproduction: Install and activate the plugin, set up some types and LOG OUT.

    $wp_roles global variable is available only for the logged-on user.

  14. parisvega
    Member
    Posted 3 years ago #

    I'm having this same problem

  15. parisvega
    Member
    Posted 3 years ago #

    Find line 135.

    Chang: $wp_roles->add_cap($role, $capability);

    To:
    if(is_object($mp_roles) && method_exists($wp_roles,'add_cap'))
    {
    $wp_roles->add_cap($role, $capability);
    }

    That totally worked. Thanks phxvyper!

  16. 2046
    Member
    Posted 3 years ago #

    works for me too
    thx

  17. wpeck
    Member
    Posted 3 years ago #

    Change to line 135 in more-types-object.php worked for me, too. Thanks for the fix to the only problem I had moving to 3.1.

  18. Donald Gilbert
    Member
    Posted 3 years ago #

    This is still an issue in the latest release of the plugin - please test before you release. - just add this into the core on line 135 of more-types-objects.php - if(is_object($wp_roles))

  19. shrinidhi
    Member
    Posted 3 years ago #

    atlast worked...thanks for the help phxvyper..from: HackHow :P!!!

  20. maximlubyanov
    Member
    Posted 3 years ago #

    Please add the line to the more-types-object.php at line 182
    elseif ($page['rewrite_bool']) $options['rewrite'] = array('slug' => $name);
    Because now there is an error with rewrite.

  21. ptroxler
    Member
    Posted 3 years ago #

    Wow, this issue is still not resolved despite the "programmers" of this plugin promising otherwise MONTHS ago ...

    would stronlgly advise against using the more suite, they're just not up to speed

  22. thedax
    Member
    Posted 3 years ago #

    I have problems too. I get a Internal server error when I have these plugins installed.At the moment I only have 2 plugins. The more fields and the more types plugin. After some testing I found out that it starts working again after this:

    1. Rename the plugins folder
    2. Reload the page (now the white screen of death is gone)
    3. log in to wp-admin
    4. Rename the plugins folder back to plugins
    5. Activate the plugins from the wp-admin
    6. It works again.

    BUT...

    ONLY in the browser that you logged in to.

  23. thedax
    Member
    Posted 3 years ago #

    Bug is still present in the latest version.

    Plugin version 2.0.3
    WordPress version 3.0.1

    Reproduction: Install and activate the plugin, set up some types and LOG OUT.

    $wp_roles global variable is available only for the logged-on user.

    Yes I noticed. how do I resolve this global to be cut the head off?

  24. dki
    Member
    Posted 3 years ago #

    sigh, good plugin but too bad the developers are not as good :(

    not working at all, messing up encodings on site and so on

  25. Joy
    Member
    Posted 3 years ago #

    Looks like the latest version included the fix from phxvyper above.
    Unfortunately, that fix had a typo in it. It says $mp_roles instead of $wp_roles for the is_object call.
    And besides, why would you want to check that each time through the inner loop? Put the check outside the loops, as far up as possible.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags