WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Facebook: Advanced Social SEO for WordPress
[resolved] error when reading the 'ngfb_options' array from the database (27 posts)

  1. rlaflamme
    Member
    Posted 1 year ago #

    Ok, so I appear to have fubared this one up something fierce.

    As of this morning I had version 2.40 working fine, with no issues.

    I attempted to update to the latest version with 2 other plugins, and in doing so ended up with the "0 is a protected WP option and may not be modified" error that took my entire site down.

    I removed the plugin for NGFB by deleting the plugin folder and everything came back up. I updated each of the other plugins in question individually, and the second time 3.1.1 installed correctly. However, when activating, I am getting the warning message that

    WordPress returned an error when reading the 'ngfb_options' array from the database.

    Moreover, the settings page once active does not go beyond the Default Image ID line (the rest of the settings are not loading), and any attempt to change them results in:

    Using $this when not in object context in /wp-content/plugins/nextgen-facebook/nextgen-facebook.php on line 402"

    Attempting to put 2.4 back generates an error

    Warning: array_key_exists(): The second argument should be either an array or an object in wp-content/plugins/nextgen-facebook/nextgen-facebook.php on line 277

    2.41 generates a similar error:

    Warning: array_key_exists() expects parameter 2 to be array, wp-content/plugins/nextgen-facebook/nextgen-facebook.php on line 275

    What should be next step be here? Thanks.

    http://wordpress.org/extend/plugins/nextgen-facebook/

  2. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Hmmmm... I might have gotten a little too fancy in calling sanitize_options() (in the NGFB class) from the ngfbAdmin class.

    Give the dev version a spin and let me know if that fixes your problem:

    http://downloads.wordpress.org/plugin/nextgen-facebook.zip

    If you're still having an issue, here's what you can try:

    - Remove the plugin and visit the admin settings page. This should deactivate the plugin (WP will detect that it is no longer there and de-activate it automatically).

    - Then extract the dev version back into the plugins folder.

    - Then in your wp-config.php file, add the following:

    define('NGFB_RESET', true);

    - Then go back to the plugins admin page, and activate NextGEN Facebook OG.

    NGFB should re-create the default options.

    - Go to the NGFB settings page and save them.

    - Then remove the NGFB_RESET constant you defined earlier.

    Hopefully that'll clear-up whatever pesky issue there is with NGFB's option entry in the database...

    Thanks,

    js.

  3. rlaflamme
    Member
    Posted 1 year ago #

    Thanks.

    This was a partial fix. I did use the reset line in wp-config and managed to have it save the settings. I am now able to activate and deactivate the dev (3.1.2) without error messages.

    However, in the plugin settings area while active, I am not seeing any of the settings below "Default Image ID ". So instead of getting the laundry list if buttons, meta-tags, etc., I am only seeing the first 5 or so options.

    It's a big step in the right direction though.

  4. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, I've added even more checks around the options-related methods.

    Download the dev version again and let me know if you get a little farther.

    If you don't, then I'll need a little more info... Would you mind installing and activating the "BlackBox Debug Bar" plugin? It'll show you all PHP related errors as you move from page to page. When you visit the NGFB settings page, hopefully it'll show an error that I can use to track down the source (normally there shouldn't be any errors from NGFB).

    Don't be surprised if you see a lot of errors from other plugins... Not everyone checks their code for PHP error msgs. ;-)

    Thanks,

    js.

  5. rlaflamme
    Member
    Posted 1 year ago #

    I'm guessing I use the same link as the post above? I did manually remove and re-add it. I had to do the wp-config reset again though.

    No luck on getting the settings page to show all of the settings. I did install the BlackBox plugin, but it didn't seem to load the toolbar for the NGFB settings page. All of the other settings pages and menu pages within the admin menu seem to load the bar and mention at least 1 error, so I found that a bit strange it wouldn't even load the bar...

  6. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, the dev link always points to the current dev code.

    Ok, then I guess you can de-activate Blackbox. It's a little odd that it doesn't load, but then again, we're tracking down what's probably a code WP bug or somekind...

    Let's at least try and rule out any issue with the NGFB options...

    Do you have phpmyadmin installed to manage your MySQL database? If so, you could try to:

    1) Deactivate NGFB.
    2) Sort the {prefix}_options table in MySQL by name, then look for an entry called 'ngfb_options', and delete it.
    3) Activate NGFB again.

    If you don't have phpmyadmin installed, or you don't feel comfortable with it, you could try:

    1) Deactivate NGFB.
    2) Define the following constant.
    3) Activate NGFB again.

    define( 'NGFB_OPTIONS_NAME', 'ngfb_options_new' );

    If that works, then we know it's something in the options. If it doesn't, then the problem is somewhere else... Somekind of incompatibility maybe...

    BTW, are you running NextGEN Gallery, and if so, what version?

    Hm. Have you tried disabling other plugins to see if NGFB starts working? Maybe another plugin is getting in the way...

    Thanks,

    js.

  7. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    BTW, you might also want to take a look at WP-DBManager, and WP Clean Up. ;-)

    js.

  8. rlaflamme
    Member
    Posted 1 year ago #

    Okay, I went and removed the options table and then re-activated. Alas, no change there. I also went through and de-activated each plugin-in one by one with no change.

    I also have a test blog I use as a sandbox that is a separate database. I installed the official 3.1.1 version there as well as 2.4 and 2.41. For each of them, I am getting the same behavior as described here.

    Neither of the installations have any other NextGen plugin besides the FB one.

  9. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, well, at least we're taking some things off the table. ;-)

    Thanks for being patient.

    I'm thinking maybe it's a PHP issue, so re-wrote some of the code around the "Default Image ID" section -- same thing, just written different. ;-)

    Download the current dev version ( http://downloads.wordpress.org/plugin/nextgen-facebook.zip ) and let me know if you get a little farther... :)

    Thanks,

    js.

  10. rlaflamme
    Member
    Posted 1 year ago #

    Oh I am nothing if not patient, and I appreciate the effort.

    I tried the one provided. Alas, no change.

  11. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Well, since Blackbox didn't work, and you have a sandbox, you might as well turn WP_DEBUG on. ;-)

    define('WP_DEBUG', true);

    Let me know if you get a little more info and I'll continue to investigate on this end...

    Thanks,

    js.

  12. rlaflamme
    Member
    Posted 1 year ago #

    The only debug messages that appear from what I see include:

    register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. on line 2824 in file /wp-includes/functions.php (twice)

    and

    has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. on line 2908 in file /wp-includes/functions.php

    The first message appears both in the admin console and the main page itself. The second only appears in the admin console.

    Lastly, I don't know if it means anything, but on the main page (not on the admin console), I do see these three:

    Undefined index: og_img_max on line 562 in file /wp-content/plugins/nextgen-facebook/nextgen-facebook.php
    Undefined index: og_vid_max on line 565 in file /wp-content/plugins/nextgen-facebook/nextgen-facebook.php
    Undefined index: link_publisher_url on line 1110 in file /wp-content/plugins/nextgen-facebook/nextgen-facebook.php
  13. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, those first ones are not NGFB, but the Undefined index stuff is. ;-)

    It shouldn't be an issue, but I went and rewrote the whole NGFB::sanitize_options() method -- it's more streamlined now, and missing options are added, so those warnings shouldn't pop up.

    Hopefully we've got a winner now. :)

    Try out the dev version and let me know how it goes...

    http://downloads.wordpress.org/plugin/nextgen-facebook.zip

    Thanks,

    js.

  14. rlaflamme
    Member
    Posted 1 year ago #

    Gave it a shot. Still no dice I'm afraid.

    I did notice that the settings page was not loading the PHP beyond the Image ID line, so it isn't an issue of the settings not displaying properly. For sake of testing I also tried on different browsers with no change.

    For me the biggest variable I notice is that that every single other page in the admin panel Blackbox is active and working fine on. I went so far as to test out NextGen gallery and some add-ons for that, and those also show Blackbox. It is only the NGFB one that doesn't.

    I don't know if Blackbox loads before the page or after, but I'm guessing the two symptoms are related.

  15. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Would you mind doing a view source and pasting the last line(s)? Knowing exactly where it stops would help...

    What's the WP debug output like?

    Thanks,

    js.

  16. rlaflamme
    Member
    Posted 1 year ago #

    From what I can see of the list, only the ones you mentioned that weren't NGFB related are showing. I do get a
    Warning: Cannot modify header information - headers already sent by (output started at /wp-includes/functions.php:2824) in /wp-includes/pluggable.php on line 876

    when activating the plugin but I'm guessing that isn't pertaining to much. The plugin still starts and I can go to the settings page.

    The code for the page ends at:

    <tr>
    				<th>Default Image ID</th>
    				<td><input type="text" name="ngfb_options[og_def_img_id]" class="number" value="" /> in the <select name="ngfb_options[og_def_img_id_pre]" style="width:160px;">
    <option value="wp" >Media Library</option>
  17. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, now we're getting somewhere... I think. :)

    Looks like your website doesn't like this:

    if ( method_exists( 'nggdb', 'find_image' ) ) :

    Odd, but no problem. I'll just change it into a 'class_exists' test instead...

    Give the new dev code a try and let me know. ;-)

    Thanks,

    js.

  18. rlaflamme
    Member
    Posted 1 year ago #

    No such luck on that, but it feels like a step in the right direction! No changes on the debug list either.

  19. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, I think we might have a winner here... Aside from a multitude of other small changes (mostly variable checks etc), I also moved the options load from the __construct() method to a WP init() method. This should load the options a little later, which might give more time for other WP related stuff to load (I hope). ;-)

    I QA the plugin on 5 different websites, so seeing these issues in the wild is a little frustrating. :) I might be away until tomorrow morning. Let me know how the current dev version fares.

    http://downloads.wordpress.org/plugin/nextgen-facebook.zip

    Thanks!

    js.

  20. rlaflamme
    Member
    Posted 1 year ago #

    As often things can get worse right before they get better. That latest iteration makes the admin section crash. I had to manually remove it. So the code's definitely different ;)

  21. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    I've tweaked the code a bit more - would you mind giving v3.1.2b2 a try?

    http://downloads.wordpress.org/plugin/nextgen-facebook.3.1.2b2.zip

    Let me know if you see anything in your webserver's error log (as well as WP's debug.log)...

    BTW, if it still doesn't work, you could try commenting line #177 in nextgen-facebook.php:

    $this->load_is_active();

    From what I can see, your website might have a problem with some class/method checks (it's a theory)...

    Thanks,

    js.

  22. rlaflamme
    Member
    Posted 1 year ago #

    Alright, so progress:

    When trying this version after installation I get the debug message:
    Notice: register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.) in /wp-includes/functions.php on line 2944

    This crashes the admin console again. However, when commenting out 177, I can get back in to the admin section. The debug list still shows the error, but I can navigate. (Webserver error log shows none, which is how I like it!)

    More useful, is that the NGFB menu shows the entire contents, and if I turn Blackbox on, it works on the NGFB options page like it's supposed to.

    I hope that helps narrow down what could be causing it.

  23. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Yeah, I've been trying to streamline the activate/deactivate methods. That error is already fixed in 3.1.2b3. ;-)

    So, it's as I suspected, there's some function/method/class check, that for some reason, your PHP / WP installation doesn't like... I'll need your help on this one. ;-)

    Here's the method in question in nextgen-facebook.php:

    function load_is_active() {
    
                            $this->is_active['ngg'] = method_exists( 'nggdb', 'find_image' ) ? 1 : 0;
                            $this->is_active['cdnlink'] = class_exists( 'CDNLinksRewriterWordpress' ) ? 1 : 0;
                            $this->is_active['wikibox'] = function_exists( 'wikibox_summary' ) ? 1 : 0;
                            $this->is_active['expages'] = function_exists( 'ep_get_excluded_ids' ) ? 1 : 0;
                            $this->is_active['postthumb'] = function_exists( 'has_post_thumbnail' ) ? 1 : 0;
    
                            $this->print_debug( '$this->is_active', $this->is_active );
                    }

    I would like you to comment each line, one by one, and see which one breaks the settings page.

    Once we know, I can see if there's another way to code the check.

    Here's the latest version:

    http://downloads.wordpress.org/plugin/nextgen-facebook.3.1.2b3.zip

    Thanks,

    js.

  24. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Also, in case it's the method_exists() check, you could try changing this line:

    $this->is_active['ngg'] = method_exists( 'nggdb', 'find_image' ) ? 1 : 0;

    To this:

    $this->is_active['ngg'] = class_exists( 'nggdb' ) && method_exists( 'nggdb', 'find_image' ) ? 1 : 0;

    Thanks,

    js.

  25. rlaflamme
    Member
    Posted 1 year ago #

    Not a problem.

    I commented out each line to be sure, but it is indeed the 'ngg' line call that is crashing it.

    Changing it to the latter code from the "method_exists" start to the "class_exists" start seems to correct that. All settings load and Blackbox reports no issues.

  26. JS Morisset
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, so you're using the combination I suggested above ( class_exists( 'nggdb' ) && method_exists( 'nggdb', 'find_image' ) )?

    On the NGFB settings page, is "NextGEN Gallery" one of the choice for the Default Image ID?

    If you're still running in NGFB_DEBUG mode, you should see something like the following (if you have NextGEN Gallery activated) at the top of your page source:

    <!-- NextGEN Facebook OG debug from load_is_active() $this->is_active :
    	cdnlink = 0
    	expages = 0
    	ngg = 1
    	postthumb = 1
    	wikibox = 0
     -->

    Thanks,

    js.

  27. rlaflamme
    Member
    Posted 1 year ago #

    Correct, I was using the combination you suggested.

    I added the Gallery plugin for testing purposes, but I didn't have in installed initially.

    With the plugin installed, yes, I see Gallery for Default ID.

    And in the debug mode with the plugin activated, it shows as you show it:

    <!-- NextGEN Facebook OG debug from load_is_active() $this->is_active :
    	cdnlink = 0
    	expages = 0
    	ngg = 1
    	postthumb = 1
    	wikibox = 0
     -->

    With the plugin not active, it shows ngg= 0 and the option in Default ID isn't there (naturally).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.