WordPress.org

Ready to get started?Download WordPress

Forums

Radio Buttons for Taxonomies
[resolved] Notice on Most Used tab (15 posts)

  1. Brian Cruikshank
    Member
    Posted 1 year ago #

    Thanks so much Kathy!

    The plugin is much improved and working well.

    There is just one issue I'm seeing with define('WP_DEBUG', true); (plugin version 1.1):

    When clicking the "Most Used" tab I get this:

    Notice: Trying to get property of non-object in /var/www/site.dev/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 118 Notice: Undefined variable: disabled in /var/www/site.dev/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 118  Blog
    Notice: Trying to get property of non-object in /var/www/site.dev/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 118 Notice: Undefined variable: disabled in /var/www/site.dev/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 118  Op-ed
    Notice: Trying to get property of non-object in /var/www/site.dev/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 118 Notice: Undefined variable: disabled in /var/www/site.dev/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 118  Column

    "Blog" "Op-ed" and "Column" are the radio buttons.

    http://wordpress.org/extend/plugins/radio-buttons-for-taxonomies/

  2. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    no matter how hard one tries, one just can't catch all the little errors by oneself! :) thanks for the heads up. this is an easy fix, so I should be able to deal with it tomorrow. see anything else? it'd be better to bundle a bunch of bug-fixes together. how does it look on the edit.php screen?

  3. Brian Cruikshank
    Member
    Posted 1 year ago #

    I've just observed the warning only occurs when 'hierarchical' => false in the taxonomy declaration.

    When 'hierarchical' => true, there is no notice, but the plugin doesn't seem to work correctly. My article is in the 'Op-ed' category however, nothing is selected among the options on the main tab. The "Most Used" tab shows the correct type (Op-ed) selected, however all options show as check boxes rather than radio buttons.

    Brian

  4. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    that sounds serious. much more serious than i can contemplate at 1am. can you post a screenshot somewhere? are you running any other plugins? can you post your taxonomy code? i cannot reproduce this on my test install.

  5. Brian Cruikshank
    Member
    Posted 1 year ago #

    Interesting. I just tried installing the plugin on a fresh site (new site in a multisite install) and got this error on activation:

    Plugin could not be activated because it triggered a fatal error.
    Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home1/columbm2/public_html/wp3test.brianswebstudio.com/wp-content/plugins/radio-buttons-for-taxonomies/inc/class.WordPress_Radio_Taxonomy.php on line 223

    My single site local install, however, it's still working fine outside the stuff I mentioned above. There I disabled all the plugins but radio for tax. and took some screenshots.

    http://imgur.com/a/XBC4P
    First two hierarchical => false. Last two hierarchical => true.

    register_taxonomy('type',
    	array(0 => 'post'),
    	array( 'hierarchical' => false,
    		  'label' => 'Article Type',
    		  'show_ui' => true,
    		  'query_var' => true,
    		  'rewrite' => array('slug' => 'atype'),
    		  'singular_label' => 'Type',
    		  'single_value' => true,
    		  'required' => true,)
    	);

    define('WP_DEBUG', true);

  6. Brian Cruikshank
    Member
    Posted 1 year ago #

    OK, I'm sorry. I figured out what was causing the issue with hierarchical taxonomies. I was using some code I found at the bottom of stress press to clean up how categories display. See 'Show categories as tree in admin' at the bottom of this file.
    https://github.com/stresslimit/stresspress/blob/master/stresspress.php

    That was conflicting with your plugin.

    Disabling that code and the radio buttons now show fine however, the same notice you see in screenshot #1 still occur whether hierarchical is true or false. http://imgur.com/a/XBC4P

  7. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    Brian,

    Well I am relieved the checklist thing is a conflict. As for the other issues: would you try this version:

    https://github.com/helgatheviking/Radio-Buttons-for-Taxonomies/zipball/master

    and see if that resolves the problem?

  8. Brian Cruikshank
    Member
    Posted 1 year ago #

    Fatal error is still there on my multisite install (Bluehost PHP 5.2.17):

    Plugin could not be activated because it triggered a fatal error.
    
    Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home1/columbm2/public_html/mysite.com/wp-content/plugins/helgatheviking-Radio-Buttons-for-Taxonomies-10602d9/inc/class.WordPress_Radio_Taxonomy.php on line 218

    Notice is gone and everything looks good on my single site install!(local PHP 5.3.10-1ubuntu3.4)

    Cheers,
    Brian

  9. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    I cannot replicate this on the test multisite I just set up at Koding.com. From the code, looking at the line in question, there is the ) that it is expecting.

    // WordPress always saves a zero/null integer which we will want to skip
    	  	if ( is_array( $terms ) ) {
    	  		sort( $terms );
    	  		$terms = array_slice( $terms, 1, 1 ); //make sure we're only saving 1 term, but not index 0
    
    	  		//if hierarchical we need to ensure integers!
    	  		if ( is_taxonomy_hierarchical( $this->taxonomy ) ) { $terms = array_map( 'intval', $terms ); }
    
    	  	} else {
    
    	  		//if somehow user is saving string of tags, split string and grab first
    	  		$terms = explode( ',' , $terms ) ;
    		    $terms = array_map(
    		        function( $n ) { return trim( $n ); },
    		        $terms
    		    );   // line 218
    
    		    $terms = $terms[0];
    
    	  	}

    Could you try updating from github again? I'm not actually sure that I pushed my updates last time. ( #facepalm ) However, I still don't know why that'd be a fatal error in MU but not in regular WP.

    Thanks for helping me work this out.

  10. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    Brian, I tested this on multisite and had someone else do it too. Neither of us ran into problems so I pushed the update to the WordPress repo. I hope it fixes your problem.

  11. Brian Cruikshank
    Member
    Posted 1 year ago #

    So I think the reason is the code uses an anonymous function and anonymous functions aren't available until PHP 5.3 according to the docs.
    http://php.net/manual/en/functions.anonymous.php

    I've tried installing the plugin on some PHP 5.3 multisites and it works fine. The plugin just fatal errors in PHP 5.2 and below.

    Hope that helps.

    Cheers,
    Brian

  12. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    That helps a lot actually, I never would've found that. I will endeavor to make the function non-anonymous later on today.

  13. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    @Brian,

    If you are around today, could you re-download the github zipball? The array_map callback is no longer an anonymous function. Please let me know if that solves the issue for you and I will push out the update.

    Cheers!

  14. Brian Cruikshank
    Member
    Posted 1 year ago #

    Works great. Thanks!

  15. helgatheviking
    Member
    Plugin Author

    Posted 1 year ago #

    Phew! That is a relief.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.