WordPress.org

Ready to get started?Download WordPress

Forums

Lightbox Plus ColorBox
actions.class.php on line 139 (20 posts)

  1. jollymoon
    Member
    Posted 1 year ago #

    Now I am getting a weird error message.
    When you do a search and have several results to display the error does not appear.

    It only appears when you do a SEARCH on my blog and returns a NO RESULT or blank search query...

    here is the whole line from the page:

    Notice: Trying to get property of non-object in .../htdocs/blog/wp-content/plugins/lightbox-plus/classes/actions.class.php on line 139
    <!-- Lightbox Plus ColorBox v2.6/1.3.32 - 2013.01.24 - Message: -->
    <script type="text/javascript">
    jQuery(document).ready(function($){
    $("a[rel*=lightbox]").colorbox({initialWidth:"30%",initialHeight:"30%",maxWidth:"90%",maxHeight:"90%",opacity:0.8});
    });
    </script>
    <script type='text/javascript' src='http://www.edparton.com/blog/wp-content/plugins/lightbox-plus/js/jquery.colorbox.1.3.32.js?ver=1.3.32'></script>

    A small nuisance but I can't find out why Lightbox Plus is giving an error on a Search and not anywhere else??

    Thanks!

    http://wordpress.org/extend/plugins/lightbox-plus/

  2. jollymoon
    Member
    Posted 1 year ago #

    http://www.edparton.com/blog/?s=rrrr is a link to a search that returns an error..

    thanks!

  3. tzdk
    Member
    Posted 1 year ago #

    I think it check for posts ID and since there are none WordPress complains of being asked to do something stupid. If you check that file you can imagine error going away if he add && !is_404() to the !is_admin() part. Will Lightbox ever load on a 404 page? May be but not based on post IDs. Or you could show posts on a custom 404 page heh.

    But this is a notice not error or warning - and not uncommon. You can google it! but of course best to get it fixed by dev.

    May be you show message on purpose but best to hide PHP logging from public, http://codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG_DISPLAY Debug off is std. setting for working site as well.

    Check Hyper Cache changelog to find out why some devs. do not follow just ANY notice. He gave up but this was not news to him. I am fairly sure his "undefined index" "error" is in family with what you see. A typical notice.

    Until you find out what this dev. think fix this:

    $('a[@rel$='external']').click(function(){
    this.target = "_blank";
    });

    may be

    $("a[rel='external']").click(function(){
    this.target = "_blank";
    });

    but may be not at all because you already have a targetblank.js file loaded http://www.edparton.com/blog/targetblank.js So just remove not working snippet. Check Javascript Error Console in browser.

    Also http://www.edparton.com/blog/jbox/js/jquery1.7.js is not wanted as you alread load right one, version 1.8.3 from WordPress install. I dont know what jbox is, hopefully you do.

  4. jollymoon
    Member
    Posted 1 year ago #

    tzdk:
    Thanks! for all the input...

    I am a cut and paste web page maker not a coder...

    I think I understood all you wrote about but this:
    add && !is_404() to the !is_admin() part. Will Lightbox ever load on a 404 page?

    I set DEBUG OFF in the wp-config file, but the error still came up...

    I don't know why lightbox plus is looking for a IMAGE on a blank page for search.php/search anyway that causes this 139 error.

    The targetblank.js file stopped working about the same time this Lightbox Plus plugin updated a couple of times.

    I tried your suggestion of the snippet for the:
    $("a[rel='external']").click(function(){
    but it did not work on my rel="external" links ... with the targetblank.js on or off. I just went back to using "_blank" for all the links I needed for a new page. I have too many old posts with rel=external to go back and change all of them.

    This maybe for a different forum post, but I load jquery/jbox/1.7 because I never got the menu in the upper right to work without it... I was never able to combine the functions inside the JQUERY
    $(document).ready(function() {
    $('#mask').css({'height':$('#panel-1').height()});
    ETC.....

    Lucky my blog works with the two JQUERY files without conflict.

    Any more suggestions you could offer would be Most Appreciated!

  5. tzdk
    Member
    Posted 1 year ago #

    Well it is risky business running more than 1 jQuery, much worse than notices from PHP I think. Now I see why some freak out about notices because I feel your site is broken if it require 2 jQuery versions, heh. Actually it is very common to have 2 but then it will be because out of your control. If you embed what ever that external script can load version no. 2. I dont know how well jQuery or jQuery code can limit itself. I dont trust more than one.

    But there are more "errors" with Lightbox Plus :) I get 3 on a "rrr" search, 2 is pointing to same line though.

    Notice: Undefined property: WP_Query::$post in C:\UniServer\www\wp2\wp-content\plugins\lightbox-plus\lightboxplus.php on line 196
    
    Notice: Trying to get property of non-object in C:\UniServer\www\wp2\wp-content\plugins\lightbox-plus\lightboxplus.php on line 196
    
    Notice: Trying to get property of non-object in C:\UniServer\www\wp2\wp-content\plugins\lightbox-plus\classes\actions.class.php on line 78

    I did mean you can Google. See how WP core fixed the first, http://core.trac.wordpress.org/attachment/ticket/15059/fix-undefined-property-post.diff Undefined variable, undefined index, non-objects - all about the same I guess. Loads of hits. "Dont ask for what is not possible to answer or I will notify your logfile" seems to be what its about.

    Dont remember error but here is how I fixed one of them in another plugin

    //			if ( 'checked' == $widget_logic_options['widget_logic-options-filter'] )  {
    
    			if ( isset( $widget_logic_options['widget_logic-options-filter']) && 'checked' == $widget_logic_options['widget_logic-options-filter'] )  {

    First line give error so id commented out.

    So you can get the idea of this and race through all plugins. Or ignore until dev. fix. Of course not without risk to start editing source files.

    I use similar external trick but I think a better one, check this http://stackoverflow.com/a/12042162/1024532

    I cut it down a little. Also had to exclude things. Imagine a lightbox with a Youtube. That is not external and yet script think it is. Will I ever want what ever external action on a lightbox link? I think not. Check the link which is where I got it from.

    // http://stackoverflow.com/a/12042162/1024532
    $.expr[':'].external = function(obj) {
    	return (obj.hostname != location.hostname) && !obj.href.match(/^javascript\:/)
    }
    
    $("#content").find("a:external").not("#content a:external[rel^='lightbox']").attr('target', '_blank');

    Your theme is a bit weird as it use both #content and #content2 so above wont work. You should change #content to #contentwrap can use body as well but idea is to limit area of what to work on. To speed up jQuery 0.1ms. Just like with notices we aim high :)

  6. tzdk
    Member
    Posted 1 year ago #

    About the external trick I have used this plugin before http://wordpress.org/extend/plugins/wp-external-links/ Long time ago. It got some problems and dev. seem to be on long vacation. Now updated several times, last time minutes ago. Pretty sure I did some extensive plugin testing and this won. Another is http://wordpress.org/extend/plugins/bwp-external-links/ - a bit more features than one would expect :)

    If you test make sure you remove targetblank.js and what I think is broken snippet.

    Own snippet must be wrapped between

    jQuery(document).ready(function($) {
    // here goes your code
    });

    See http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers You soon find out if there are errors.

  7. jollymoon
    Member
    Posted 1 year ago #

    thanks... almost over my head ... will work through your suggestions...

  8. tzdk
    Member
    Posted 1 year ago #

    One more post as I just had an idea. Remove both jQuery 1.8.3 and jQuery 1.7.1. Then load jQuery 1.9.1 + migrate.js http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/

    Migrate.js is most interesting https://github.com/jquery/jquery-migrate/#readme

    What make me confused about what it can do is this

    The plugin can be included with versions of jQuery as old as 1.6.4 to identify potential upgrade issues via its JQMIGRATE console warnings. However, the plugin is only required for version 1.9.0 or higher to restore deprecated and removed functionality.

    So there might be a chance migrate.js fix compatibility issues between jQuery 1.7.1 and 1.8.3 - or what? It is only active on 1.9.x?, logs on older? How much does it "migrate"? I dont know. You cant fix script code so this is a workaround, may be... Best is you will only have 1 jQuery loaded.

    You have to deal with this as WordPress 3.6, may be even 3.5.2, will come with jQuery 1.9.x and migrate.js And then what? Test sooner than later is good tactic.

    Best is not to use conflicting deprecated wrong crappy code. Truth is you need new modern theme right? - except you dont want to change! And where did developer go btw? ;) Can almost only go downhill if you "dont want or can change" and code is dusty.

    If ??? then good because you should not risk breaking stuff, but all you need is a little plugin or functions.php, preferably one in a child theme but I somehow doubt that will be the case. Just make a plugin. https://codex.wordpress.org/Writing_a_Plugin#Standard_Plugin_Information and there it is. Under that you paste something like

    add_action( 'wp_enqueue_scripts', 'jqueryfix_perhaps' );
    function jqueryfix_perhaps() {
    	wp_deregister_script( 'jquery' );
    	wp_enqueue_script( 'jquery', 'http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js', array(), NULL, FALSE );
    	wp_enqueue_script( 'jquery-migrate', 'http://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.1.1/jquery-migrate.min.js', array(), NULL, FALSE );
    }

    Upload to a new folder under /wp-content/plugins/ and you can activate/disable as normal. You are now plugin author.

    No problem getting rid of jQuery from WordPress but I dont know how to remove the one from jbox. This you will have to remove:

    <!-- MAIN JQUERY LIBRARY  -- REQUIRED for menu !!
    --><script type="text/javascript" src="http://www.edparton.com/blog/jbox/js/jquery1.7.js"></script>

    Is what view source says. I smell old :) This is likely hardcoded and you might have to edit source file of plugin or what it is.

    What you say break "menu" might not be a whole lot, I bet it can work with jQuery 1.8.3 and 1.9.x but who is going to fix? And does it make sense if theme is abandoned? Seems to be? What else is outdated is relevant question. Forcing new jQuery 1.9.1 is not really a solid solution. Migrate.js is not permanent fix but a big hint you need to change/update code, contact dev. Here may be find new theme? Migrate.js will be essential file in upcoming WordPress but also kind of hide problems. Not sure you even see what it does unless "dev" version is used. In your case it might make sense to try this, but if theme dev. has site covered in old jQuery code, and is gone!, I think you should start looking for something current. If it works it is only temporary fix.

    I would try this trick though :) Some say dont even think about changing "core" jQuery, but right now that is bogus as TONS of issues will pop up with 1.9.x comes with latest WordPress. Devs. are "supposed" to test. And a minority will... You are also supposed to help developers right? ;) Be certain those coding WordPress code have tested already, are testing. You WILL get jQuery 1.9.x so deal with it, heh. If you soonish want to deregister jQuery 1.9.x + migrate.js on shiny WordPress 3.6, return to old "working" combo of jQuery 1.7.1 + 1.8.3 you will be on your own I think ;)

  9. jollymoon
    Member
    Posted 1 year ago #

    Great advice and I will try it...

    Need to get a new theme anyway...

    Thankx!

  10. jollymoon
    Member
    Posted 1 year ago #

    D U D E !

    I can't believe that actually worked!

    web page works nicely and so does menu!

    I called it jquery-fix-me.php uploaded to plugins, activated and 'voila!!

    I gave you credit for plugin author!

    Now, if I could just fix the "lightbox-plus/classes/actions.class.php on line 139" and convert all my old rel="external" links and I will be set

    Still need a new theme , but now I have a little more time to find one.

  11. jollymoon
    Member
    Posted 1 year ago #

    Now my menu "archives" doesn't work...

  12. jollymoon
    Member
    Posted 1 year ago #

    oh boy...

    I changed everything back to the old stuff...

    Now I cannot log in to the admin!!!!

  13. jollymoon
    Member
    Posted 1 year ago #

    OK...
    did a google for "wordpress cannot login" and found several suggestions about blank spaces and blank lines in the PHP files. WP-CONFIG.PHP and FUNCTIONS.PHP

    I found two blank spaces at the end of my functions.php and deleted them...don't know how they got there????

    !Viola!

    and archives work again as well...

    all this trouble for two little spaces in the php code!

  14. jollymoon
    Member
    Posted 1 year ago #

    AGAIN ...
    web page works nicely and so does menu!

    I called it jquery-fix-me.php uploaded to plugins, activated and 'voila!!

    I gave you credit for plugin author! addition of jquery 1.9 and migrate-jquery works just fine.

    Now, if I could just fix the "lightbox-plus/classes/actions.class.php on line 139" and convert all my old rel="external" links and I will be set

  15. jollymoon
    Member
    Posted 1 year ago #

    I used:

    http://wordpress.org/extend/plugins/wp-external-links/

    works pretty well and on all the old rel="external" links

    SUPER thanks for all your help...

  16. tzdk
    Member
    Posted 1 year ago #

    Sounds like a normal trial and error session ;) Yeah good code editor is a must. Automaticated removal of white space when saving is nice.

    Well I see latest jQuery + migrate.js loading and site is at least visible.

    This will work perfectly but weakness of this manual take over is of course you must also manually update version numbers - as jQuery and WordPress move on. Not doing that is why dusty themes/plugins doing this are horrible. Even worse if they hard code load. You can handle your self but never forget.

    Good you realize you need new updated theme - either that or extensive look under the hood which might not be fun. I tried to locate dev. but he seem to have moved on. Theme is a bit special so could be you would do what ever to avoid touching anything. Will go wrong at some point.

    You must have some tinkering needs inside or you could never have tried this. Or survived broken PHP. So may be get flexible theme, even a framework. Ready made themes can save you many hours though - each to their own.

    I dont really get why you see that notice if debug is off, display errors is off. Must be set by PHP.INI then. Try locate and check. This is from mine

    ; Print out errors (as a part of the output). For production web sites,
    ; you're strongly encouraged to turn this feature off, and use error logging
    ; instead (see below). Keeping display_errors enabled on a production web site
    ; may reveal security information to end users, such as file paths on your Web
    ; server, your database schema or other information.
    display_errors = Off

    Possible you have access to this setting via some control panel at host.

  17. jollymoon
    Member
    Posted 1 year ago #

    funny
    display_errors = Off is OFF in my php.ini

  18. jollymoon
    Member
    Posted 1 year ago #

    Trying to get property of non-object in ...
    /htdocs/blog/wp-content/plugins/lightbox-plus/classes/actions.class.php on line 139

    is the error I was getting on blank search or 404.php

    it only appears if the search is empty and on the 404 page.

    I commented OUT line:
    137 // if ( $lightboxPlusOptions['fixed'] == '1' ) { $lbpArrayPrimary[] = 'fixed:'.$this->setBoolean( //$lightboxPlusOptions['fixed'] ); }
    138 // if (!is_admin()) {
    139 // $lbp_autoload = get_post_meta( $post->ID, '_lbp_autoload', true );
    140 // if ( $lbp_autoload == '1' ) { $lbpArrayPrimary[] = 'open:true'; }
    141 // }

    and the error goes away...

    I also tested it in the default twentytwelve theme and got the same error...

    Doesn't seem to affect the lightbox plus functions on other pages.

    Any ideas??

  19. tzdk
    Member
    Posted 1 year ago #

    I would just ignore this - until dev. has made an update and error is still there. Then nagging starts for real :) Is not a permanent notice and is not even an error or warning. If it was why are there warnings and errors? A notice can be sign of something problematic that should get fixed but not like it break site.

    Reminds me of http://core.trac.wordpress.org/ticket/23255 I use a framework that allow you to filter in new get_template parts based on what ever you tell it to look for. This http://dev.themeblvd.com/tutorial/incorporating-post-formats/ show how to make new templates for specific post formats. Ok, so when told to add new template part for a format, like "link" - it will do that. Works 100% but there is a "Trying to get property of non-object, line 768" in post.php notice, only WHEN on a category index/archive page. "Checking of post format" in other words, see the file. I tried all sorts of things, thinking internals were broken. I dont think so as the "fix" in trac remove notice. "Fix" is not approved of, though core devs. also will say a notice is sort of an error right?, but in "nightly" WordPress 3.6 code for post-format checking in post.php is split out in to a new post-formats.php. So I wait it out.

    A bit more weird than what you have but things can be more complicated than they seem, also for plugin devs. ;)

  20. jollymoon
    Member
    Posted 1 year ago #

    Thanks TZDK for all your help...

    Maybe the DEV will notice the code snippet above and realize that the get_post_meta is unnecessary on a blank page and fix this error

    I tried to post over in the DEV DEBUG forum of this site, but I got bumped for having a double post...

    Things are working for now... hope you find your GREMLIN / BUG

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.