• I’ve found a bug in the plugin.

    If a user had a restriction on a term that is later deleted you cannot edit the user because of an error 500.

    The error log says: PHP Fatal error: Uncaught Error: Call to a member function setAttribute() on null in *path*/plugins/restrict-author-posting/restrict-author-posting.php:163

    I’ve found to add/change to the restrict-author-posting.php from line 159:

    foreach ($selected as $term_id) {
    			$current_term 	= get_term( $term_id );
    			$term_exists	= term_exists($term_id,$current_term->taxonomy);
    			// fixed delete category make error !
    			if (!empty($term_id) && get_the_category_by_ID($term_id) && $term_exists != 0){
    				$option = $xpath->query("//select[@id='allow']//option[@value='$term_id']");
    					$option->item(0)->setAttribute('selected', 'selected');
    			}
    		}

    I see the comment “/ fixed delete category make error !” but it doesn’t help apparently…

The topic ‘Bug fix in plugin line 163’ is closed to new replies.