Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#349 2022-08-08 22:51:06

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Thanks demoncleaner & jakob.

Apologies for the delayed reply. Looks like you’ve fixed it without me! The relative_urls attribute is what I would’ve done anyway, so I’ll make a note for next time.

Offline

#350 2023-02-08 10:27:44

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Hi, I had to switch my install (4.8.8) to php 8.0 and now I ran into an error whenever opening (login!) the write-tab:

Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, bool given in /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_db.php:874 
Stack trace: 
#0 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_db.php(874): mysqli_num_rows() 
#1 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/plugins/adi_menu/adi_menu.php(1643): safe_field() 
#2 [internal function]: adi_menu_article_section_popup() 
#3 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/plugins/adi_menu/adi_menu.php(1613): preg_replace_callback() 
#4 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_misc.php(1589): adi_menu_article_tab() 
#5 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_admin.php(841): callback_event() 
#6 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/include/txp_article.php(1910): pluggable_ui() 
#7 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_admin.php(386): article_partial_section() 
#8 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/include/txp_article.php(769): updatePartials() 
#9 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/include/txp_article.php(119): article_edit() 
#10 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/index.php(230): include('...') 
#11 {main} 
thrown in /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_db.php on line 874

Last edited by saccade (2023-02-08 10:31:05)

Offline

#351 2023-02-08 17:04:40

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,476
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

I can confirm that, but I only get it with a new “Write” tab. If it’s an existing article, it works fine.

This is a quick fix until Adi shows us a better way. Find function adi_menu_article_section_popup() in the plugin and make the following two minor modifications:

if ($step == 'edit') { // editing existing ($step = GET var) or creating new article ($step = POST var)
	if (!empty($GLOBALS['ID'])) // newly-saved article, get section from POST vars
		$select_section = gps('Section');
	else { // existing article, get ID from GET vars & section from database
		$article_id = gps('ID');
		if (is_int($article_id)) $select_section = safe_field("section", "textpattern", "id=".$article_id);
	}
}
// else // empty article
if (!isset($select_section))
	$select_section = getDefaultSection(); // default section for articles (defined in Sections tab)
$out = '… … …

The modifications are:

  • Add if (is_int($article_id)) in front of $select_section = … to prevent Textpattern trying to find the section for a non-existent / non_integer current article id (i.e. in the case of a new empty Write tab).
  • Comment out the else statement for an empty article
  • Beneath it (or in its place), add the line if (!isset($select_section)) as the fallback for when no $select_section has been defined until that point. The following line starting $select_section can remain indented.

TXP Builders – finely-crafted code, design and txp

Offline

#352 2023-02-09 12:58:42

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Great! Jakob, thank you very much! Works fine!

Offline

Board footer

Powered by FluxBB