Extension talk:CategorySuggest

From MediaWiki.org
Jump to navigation Jump to search

Internationalisation German (Done)[edit]

$messages['en']['categorysuggest-title']        = 'KATEGORIE VERGABE';
$messages['en']['categorysuggest-subtitle']     = 'Bitte fügen sie den Namen der Kategorie ein.';
$messages['en']['categorysuggest-boxlabel']     = 'Kategorien';
$messages['en']['categorysuggest-taglabel']     = 'Beliebte Kategorie';
This is now available in the master branch on GitHub --Adamfranco (talk) 20:21, 26 March 2013 (UTC)
There is one typo. The correct sentence for 'categorysuggest-subtitle' is: 'Bitte fügen Sie den Namen der Kategorie ein.' (with a capital "S") --95.208.117.3 00:53, 9 August 2013 (UTC)
Typo now fixed. Adamfranco (talk) 15:35, 10 October 2014 (UTC)

Taking over maintenance of this extension (2012-08-01) (Done)[edit]

Dear CategorySuggest community,

Since it seems as though this extension has been abandoned and users are having trouble with the published release (marking the extension as broken), I'm volunteering to take over maintenance of this extension and have updated the main extension page to point to the new release I've hosted on GitHub. I don't wish this to be a hostile take-over, but rather a shift to help keep updates to the extension going. I'm happy to hand back the reins to Andreas or anyone else who wishes to carry the torch, but I'd hate to see this extension die. The 1.2 release I posted on GitHub works in MediaWiki-1.18. I welcome patches and bug reports that can help continue to make this extension valuable -- please submit them to the issue tracker on GitHub.

Best, Adam --Adamfranco (talk) 15:29, 1 August 2012 (UTC)

Thanks Adam for taking on the maintenance! --Lindele (talk) 16:25, 1 August 2012 (UTC)

Fixed version available for MediaWiki 1.18 (2012-02-23) (Done)[edit]

Hello all, I have updated this extension to support MediaWiki 1.18 and added a few usability improvements:

  • automatic delimiter insertion
  • keyboard access for selecting from search results
  • fixed case-insensitivity in search

https://github.com/middlebury/CategorySuggest

I'm not sure what the policy on taking over projects is, but I'd be happy to help maintain improvements to this extension (using Github for source and issue-tracking) if the original author has abandoned this project. Feel free to contact me at afranco@middlebury.edu. --Adamfranco (talk) 16:19, 23 February 2012 (UTC)


Hi! this works great! i would suggest making sure the first letter is capitalized. then it fits in perfectly with the Select Category extension
I'm running this extension on MW1.18 . I get a bug whereby the category suggester works after typing the first letter, but suggests nothing at all after the second (or more) letter. Any thoughts? Maximilianklein (talk) 00:16, 19 April 2012 (UTC)
Follow up posted on the GitHub issue. --Adamfranco (talk) 18:15, 25 April 2012 (UTC)
Have no github account, but want to share the solution ;-) As adamfranco already pointed ou this has to do with the field cl_to from table categorylinks beeing varbinary now, and not varchar as before. To use the MySQL ucase-function the content of the field has to be converted. Change line 68 in file CategorySuggest.php to
" UCASE(CONVERT(cl_to USING utf8)) LIKE UCASE('".$searchString."%')\n";

--217.19.182.9 13:19, 18 September 2012 (UTC)

it does not work on PHP 5.3 and newer (Done)[edit]

It works with PHP 5.2. But with PHP 5.3 and newer - no matter which version of MediaWiki I am using - I get this error:

Detected bug in an extension! Hook fnCategorySuggestOutputHook has invalid call signature; Parameter 2 to fnCategorySuggestOutputHook() expected to be a reference, value given

--> Can be fixed when you modify OutputPage.php from $parserOutput to &$parserOutput and EditPage.php (Line 877) $this to &$this

Better do not edit Core files. Instead write Adam Franco a mail, tell him about the error message and ask him to provide a fix.
It seems like this page contains helpful information on the error. If Adam removes the "&" in front of the second parameter of the function call, that should solve the issue. --88.130.96.183 11:43, 2 August 2013 (UTC)
* I believe this is resolved in the latest release. Please file an issue in the Github issue tracker if you find problems like this. -- Adamfranco (talk) 21:38, 17 February 2015 (UTC)

Strange behavior in Mediawiki 1.12 (Done)[edit]

For Mediawiki

Product Version
MediaWiki 1.12.0
PHP 5.2.5 (apache2handler)
MySQL 5.0.51a

When I edit an article, category frame is missing (see below) CategorySuggest Wiki 1 12 img01.jpg

Then after a showpreview, it's OK CategorySuggest Wiki 1 12 img02.jpg

Have you an idea how the issue could be fixed ? Thanks in advance

CKL

I get the same problem in MediaWiki 1.13.2 using CategorySuggest version 1.1

KMc

Remove space on a blank line (Done)[edit]

CategorySuggest extension removes spaces in a blank line.

This is for example annoying to display source code
For example
Source code Line 1
Source code Line 2
(1 Space at the beginning of the line)
Source code Line 4

will give

Source code Line 1
Source code Line 2
Source code Line 4
* This should no longer be an issue in the latest release -- Adamfranco (talk) 21:49, 17 February 2015 (UTC)


Possible Bug with NoWiki tags (Done)[edit]

I created a few articles that ranged in length from 18 to 35,000 characters on a private wiki I set up on my own server using MediaWiki 1.11. I realized afterward that I needed to add some <nowiki> tags to parts of the article to make it look right. The only problem is that after saving with these tags, when I go back and try to edit the articles again, I get this error:

Fatal error: Call to undefined function fnajaxsuggeststripcats() in /home/deepspac/public_html/aaronmatthias/extensions/CategorySuggest/CategorySuggestFunctions.php on line 170

At the current moment I don't have FTP access nor access to my webserver control panel, so I haven't tried disabling the extension yet. Any thoughts or suggestions??? --Ds093 15:06, 15 November 2007 (UTC)

  • I have the same error message as soon as <nowiki> tags are in an article. I use Mediawiki 1.11.0 and CategorySuggest 1.0 --Alex 10:42, 27 November 2007 (UTC)
  • solved: I checked the code and it looks like a typo in CategorySuggestFunctions.php. Please replace line 170 with the string below --Alex 11:04, 27 November 2007
  • $cleanedtext = fnCategorySuggestStripCats($regulartext,$arrAllCats);
Updated the code, thanks, Lindele 18:03, 10 March 2008 (UTC)

Suggest portion not showing? (Done)[edit]

I also am not seeing the Category Suggest portion showing up.

Same here. I have MediaWiki: 1.11.0 PHP: 5.2.5-tuxtools (cgi) and MySQL: 4.1.22 -- 141.30.75.108 13:11, 27 November 2007 (UTC)
  • You should both check if category suggest is correctly installed on Special:Version. Beside that, the portion only shows up in edit mode. --Alex 18:36, 30 November 2007 (UTC)
* This should no longer be an issue in the latest release -- Adamfranco (talk) 21:49, 17 February 2015 (UTC)

Previewing the changes (Done)[edit]

Would it be possible to make a patch where the categories that are currently written in the box don't get dumped when the article changes are previewed? I wind up having to copy and paste the category list every time on my Wiki each time I preview the page. 68.219.84.74 03:12, 21 December 2007 (UTC)

Completed, Lindele 18:03, 10 March 2008 (UTC)

Removing categories! (Out of date)[edit]

I installed this on Mediawiki 1.11 and while it adds a category to an article, if you preview it the categories go blank and when it is finally saves all the categories (new and old) are deleted. I think this may be a product of having to enter a captcha before saving.

Preformatted text problem.

I found a problem with preformatted text. When I click edit on a page with preformatted text, the leading spaces got trimmed. Looks like the $m_pageObj->textbox1 = trim( $finaltext ); line in CategorySuggestFunctions.php is causing problem.

We've encountered the same problem (categories were deleted from page at preview). A solution to this problem is very much appreciated.

I don't understand the problem. Can you please explain further? Lindele 18:03, 10 March 2008 (UTC)

List of issues (Done)[edit]

Andreas, there's a lot of interest in CategorySuggest where I work as a way of getting categories on pages. Unfortunately, in addition to the issues noted above (error in code, <nowiki> causes bad page processing, categories dropped on preview, leading spaces are removed), there's a few other things that came up:

  • adds a space after a </nowiki> tag for each time the page is edited,
  • adds a line break before each <nowiki> tag for each time the page is edited,
    • Tried to solve this, but haven't found a solution yet. Any suggestions are welcome.Lindele 18:03, 10 March 2008 (UTC)
  • it tricky to use with <includeonly> and <noinclude>tags, (perhaps there should be a user preference to turn it off, so they can prevent pages being parsed)
    • Can you explain further, please? Lindele 18:03, 10 March 2008 (UTC)
  • categories with characters other than spaces, letters and numbers are not found on the page (e.g. ".", "-"),
  • category lookup is case-sensitive,
  • hard to use with | to reorder categories
    • Any suggestions are welcome, Lindele 18:03, 10 March 2008 (UTC)
  • even if it doesn't use the API for queries, it should use the mediawiki database access functions rather than embedding the database user and password in the script,
  • the path to the javascript file could be a variable that could be set in localsettings.php,
  • sometimes does not show categories that have just been added (caching issue),
  • does not look up categories including some special characters when you type them (e.g. &),
  • inserts some special characters in markup format (e.g. & becomes &amp ;),
  • form should be created by javascript extension so it is not presented to users without javascript,
  • Soeren notes that the suggestions are currently sent with no charset specified,
  • should it make use of the Ajax library?

Are you still working on this extension? It seems that not parsing the page and adding the categories client-side (like the toolbar) could get rid of a number of problems. --JaredM 20:50, 15 February 2008 (UTC)

  • this extension seems to disable the special:allmessages function: the page comes up blank
I have moved most items to the To Do list, please check it out. Thanks for collecting this extensive list. Lindele 18:03, 10 March 2008 (UTC)

Passing SERVER, USERNAME, PASSWORD, DBNAME and DBPREFIX (Done)[edit]

Posted by --AuroraCA 18:46, 9 March 2008 (UTC)AuroraCA

I don't understand why the CategorySuggestSuggest.php needs to be edited to enter the server, USERNAME, PASSWORD, DBNAME and $wgDBprefix when these are specified by the variables $wgDBserver, $wgDBname, $wgDBuser, $wgDBpassword and $wgDBprefix in LocalSettings.php . Are these not passed or can they not be passed to CategorySuggestSuggest.php?

The code for CategorySuggestSuggest.php could be changed from:

//CONFIGURE WITH YOUR LOCAL CREDENTIALS
mysql_connect("localhost", "USERNAME", "PASSWORD");
mysql_select_db("DBNAME");
$wgPrefix = ''; //MediaWiki database prefix you selected during install

to:

//CONFIGURE WITH YOUR LOCAL CREDENTIALS
mysql_connect("$wgDBserver", "$wgDBuser", "$wgDBpassword");
mysql_select_db("$wgDBname");
$wgPrefix = ''; //MediaWiki database prefix you selected during install
The current implementation does not make use of the internal Ajax library. So the file CategorySuggestSuggest.php is called directly from the browser as part of the Ajax call. LocalSettings.php is not called by the procedure, so it has no idea of the MediaWiki globals. --JaredM 12:44, 10 March 2008 (UTC)
Completed (replaced with internal AJAX function, hence, this configuration and the file itself are obsolete), Lindele 18:03, 10 March 2008 (UTC)
* These configuration items have been removed in the latest release -- Adamfranco (talk) 21:33, 17 February 2015 (UTC)

Style not being applied[edit]

I was having a problem where the stylesheet css was not being loaded and therefore the box not being styled correctly. To fix this issue, I changed $wgHooks['OutputPageParserOutput'] in CategorySuggest.php to $wgHooks['BeforePageDisplay'] and removed the second parameter from fnCategorySuggestOutputHook in CategorySuggest.body.php.

  • Excellent, thanks! This solved numerous problems for me (using MediaWiki 1.13.1).

How to specify multiple categories? (Done)[edit]

How do I select multiple categories? Is there any seperator character?

Alain le Sage (212.178.122.3 13:56, 18 June 2008 (UTC))

I have the exact same question, hopefully someone still notices this. --DaPete 15:43, 3 April 2009 (UTC)

=> ";" does the trick, no space, just category1;category2;...

Internationalisation problems (Done)[edit]

Very nice extension and quite good until now, even if the bug with <nowiki> are still a bit problematic for me...

On Frenche, Category is replaced by Catégorie and this is a source of problems for me. I looked at the code, tried to replace the line 198 of CategorySuggest.body.php, but it didn't worked...

$m_pattern = "\[\[({$m_catString}|category):(.*)\]\]";

One other problem is that I'm not allowed to enter UTF characters like "é" in my i18n.fr.php file...

You may use html entities instead ;)

  • This should no longer be an issue in the latest release -- Adamfranco (talk) 22:04, 17 February 2015 (UTC)

Translation of CategorySuggest.i18n.php into french :

$messages['categorysuggest-title']	= 'CHOIX DES CATEGORIES (tags)';
$messages['categorysuggest-subtitle']	= 'Veuillez saisir le nom d\'une catégorie (tag) pour cet article.';
$messages['categorysuggest-boxlabel']	= 'Catégories';
$messages['categorysuggest-taglabel']	= 'Catégories populaires';
  • I've added this French translation the latest release -- Adamfranco (talk) 22:04, 17 February 2015 (UTC)

Problematic with Templates (Done)[edit]

it tricky to use with <includeonly> and <noinclude> tags, (perhaps there should be a user preference to turn it off, so they can prevent pages being parsed)

Can you explain further, please?

One example that might help; I'm writing a template that has different categories depending upon if it is included in a page or viewed as a template so I want categories inside <includeonly> and <noinclude> tags but this extension keeps stripping them out. The only solution I have found so far is disabling the extension while I create this template. It would be better to have it disabled on Template pages or, as the original poster suggested, allow the user to turn off the extension when they want.

Has there been and development on this issue? I am interested in any sort of solution.--Siadsuit 13:12, 27 September 2010 (UTC)
* This should now be fixed in the latest release. -- Adamfranco (talk) 21:31, 17 February 2015 (UTC)

CategorySuggest for Postgres (Done)[edit]

This category don't run on mediawiki 1.12 (and 1.13, 1.13.1) + postgres 8.1. I have saw that it call mysql function in the code.

The function was UCASE() (used in CategorySuggest.php:65) only available in MySQL, the equivalent in PostgreSQL is UPPER.

Another issue with PostgreSQL:

PHP Warning:  mysql_real_escape_string(): A link to the server could not be established in /CategorySuggest/CategorySuggest.php on line 52.

In CategorySuggest.php:52 the code is

$searchString = mysql_real_escape_string($query);

Exists any equivalent in PostgreSQL?


TESt—“‘«‹›»’”

* The new CategorySuggest-1.5 release should now work with PostGres. Please give it a try and report any bugs in the issue tracker on GitHub. -- Adamfranco (talk) 21:24, 17 February 2015 (UTC)

Problem if category has apostrophe (Done)[edit]

Big problems with support for categories that have apostrophes.

Fixed by wrapping category output in htmlentities (CategorySuggest.body.php:62)

htmlentities(implode(";", $arrExistingCats), ENT_QUOTES))

  • This has now been fixed in the latest release -- Adamfranco (talk) 22:04, 17 February 2015 (UTC)

Per Section Editing[edit]

Bug: suggests categories on pages which already have categories when author is making per section changes. Using MW 1.13.2 and CategorySuggest 1.1 (2008-03-10) --Robinson Weijman 14:18, 27 July 2009 (UTC)

I'm amazed there have been no responses to this. Has anyone else seen it? This is a critical error to me. --Robinson Weijman 15:34, 15 February 2010 (UTC)
maybe this is not really a problem, because categories only work for a whole page, not for a section? So if you enter an additional category this should not be a problem, right? Raimund 16:16, 17 February 2010 (UTC)
Thanks for the reply. The problem is that:
  1. categories that are on the page are not shown in the dialog. Which further means:
  2. if the user again enters the same category (in per section editing) then the page will show the same category twice (when page editing - not when viewing).

The solution (I think) is simple: when per section editing, show which categories are present. --Robinson Weijman 12:49, 18 February 2010 (UTC)

Category markup in the list when 3 or more categories (Done)[edit]

Bug: with the current implementation, the category list gets messed up with Wiki markup if there are more than 2 categories. For instance:

[[Category:A]] [[Category:B]] [[Category:C]] 

is displayed as:

A]] [[Category:B;C

Solution: change the regexp line 201 in CategorySuggest.body.php as follows

$m_pattern = "\[\[({$m_catString}|category):(.*?)\]\]";

(new is the question mark after the asterisk. this makes it non-greedy) --User:moloch timur lenk

* This has been fixed in the latest release -- Adamfranco (talk) 22:05, 17 February 2015 (UTC)

How can I change the Category suggestion Text?[edit]

"CATEGORY ASSIGNMENT
 Please enter the name of a category for this article." 

How can I change the Text above the Category-Box? Raimund 16:21, 17 February 2010 (UTC)

I would like to edit this too, to include instructions on how to add multiple categories Helen 28 April 2010

I added the following line to the CategorySuggest.i18n.php file:
$messages['categorysuggest-instructions'] = '<ul> <li>To add one category, just type it and select it from the list.</li><li>To add more than one category, add a semicolon &quot;;&quot; after the last category, and then continue typing the desired category and select it from the list.</li><li>To add a subcategory, add a vertical bar &quot;|&quot; after the main category name and type the subcategory name.</li></ul>';

and then on CategorySuggest.body.php, line 61 add
$m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorysuggest-instructions' ). "</p>\");\n";

--Fladei 19:27, 26 May 2011 (UTC)

Add max results and fix capitalization problem (Done)[edit]

Nice plugin but too many bugs unfortunately. This code will fix capitalization problem as current code attempt at being case insensitive is broken and only picks up categories that are full caps

The second part of the fix is limiting the number of results returned. Macsux 21:46, 4 March 2010 (UTC)


function fnCategorySuggestAjax( $query ) {
	$wgCategorySuggestNumToSend = '10';
	if(isset($query) && $query != NULL) {
		$searchString = $query;
		# % and _ are not escaped so do it here
		$searchString = str_replace( '%' , '\%' , $searchString );
		//$searchString = str_replace( '_' , '\_' , $searchString );
		//$searchString = str_replace( '|' , '%' , $searchString );
		$dbr =& wfGetDB( DB_SLAVE );
		$categorylinks = $dbr->tableName('categorylinks');
		$page          = $dbr->tableName('page');
		$sql =
			"SELECT DISTINCT\n".
			"    cl_to AS cats\n".
			"  FROM $categorylinks\n".
			"  WHERE\n".
			"    UCASE(convert (cl_to using latin1)) LIKE '".$searchString."%'".
			" LIMIT $wgCategorySuggestNumToSend";
		$res = $dbr->query( $sql );
		$suggestStrings = array();
		for ( $i=0 ; $row = $dbr->fetchObject( $res )  ; $i++ ) {
			array_push($suggestStrings,$row->cats);
## Optional enhancement: Cutoff and rollover at max number of suggestions
## implement cutoff and rollover here
#			if ($i > 10) {
#				array_push($suggestStrings,'More...');
#				break;
#			}
		}
	        $text = implode("<",$suggestStrings);
		$dbr->freeResult( $res );
	}
	if ( !isset($text) || $text == NULL ) {
		$text = '<';
	}
	$response = new AjaxResponse($text);
	return $response;
}

Thank you very much for you code Macsux! It works! The above function is in the CategorySuggest.php file. 2013-01-27

* The capitalization fix was implemented previously, but LIMIT configuration is now added in the latest release -- Adamfranco (talk) 22:19, 17 February 2015 (UTC)

NoWiki new line bug (Done)[edit]

This code will solve the issue of new line being added before nowiki each time page is saved. There was also other formatting issues associated with it that I think I hammered out. There should be no wikitext changes around nowiki blocks now

Change line 177 to be

$finaltext .= '<nowiki>' . $nowikitext . '</nowiki>';

Change line 182 to be

$finaltext .= $cleanedtext;

Change line 209 to be

$m_cleanText .= preg_replace( "/{$m_pattern}/i", "", $m_textLine )."\n";

Add at line 226

$m_cleanText = substr($m_cleanText,0,strlen($m_cleanText) - 1);
* This should no longer be an issue in the latest release -- Adamfranco (talk) 21:49, 17 February 2015 (UTC)

Other comments[edit]

it's nice ,we hope the new version can like this Extension:ManageCategories,i think this extension is better.

hmmm it works for category inserting and retrieving. however, I dont see a the category preview with this extension I tried it on MW1.11 and MW1.93 both Firefox and IE6 fail to do this.

the extension on itself is quite nice I have to say User:Dynasource

The preview of Mediawiki doesn't show category links. There is nothing I can do. Lindele 18:03, 10 March 2008 (UTC)

Clone categories[edit]

Clone categories then using ConfrirmEdit + QuestyCaptcha for Edit pages

Change Color of Font (Done)[edit]

Is it possible to assign a variable where we can change the font color of the options available in the drop-down?

If not, in which file would I make the change, and where?

I'd like to change it from red to standard black.

Thank you in advance.

--Technomensch (talk) 15:05, 25 July 2013 (UTC)

The color can be changed by adding the following CSS to your theme or CategorySuggest.css:
span.highlight, p.highlight {
	background-color: black;
}
span.cs, p.cs {
	color: black;
}
-- Adamfranco (talk) 22:31, 17 February 2015 (UTC)

Inquiry regarding performance in 1.21 (Done)[edit]

Installed extension for first time ever in MW 1.21.

When I go to EDIT a page, and scroll down to the "Category Assignment" box, if a page already has been assigned to a Category, then the Categories appear in MW link text instead of basic text.

For example:

CATEGORIES: [[Category:Category1]] [[Category:Category2]] [[Category3]] etc...

The way I expected it to work, and I could be mistaken, would be:

CATEGORIES: Category1 Category2 Category3 etc....

Since I haven't tried it on an older version, is this expected behavior?

--Technomensch (talk) 15:11, 25 July 2013 (UTC)

In MediaWiki the categories are usually rendered as links to the category-page, so yes the behavior is as intended. -- Adamfranco (talk) 22:21, 17 February 2015 (UTC)

Doesn't work with MW 1.22 ? (Done)[edit]

Hi. I would like to know if someone has been able to use CategorySuggest with MW 1.22. Categories typed in the field are added, but when editing, the existing categories aren't displayed in the field. --Varlin (talk) 23:01, 3 January 2014 (UTC)

* The new CategorySuggest-1.5 release should now work with all recent versions of MediaWiki. -- Adamfranco (talk) 21:19, 17 February 2015 (UTC)

Category List doesn't re-sort when a Category name is entered[edit]

MW 1.22.6
CategorySuggest v.1.1

It seems to work but when you type in a Category Name into the Categories box, the long list of categories doesn't jump to the letter the Category Name begins with. Very frustrating when your list of categories is long. --Wmat (talk) 18:26, 1 May 2014 (UTC)

Upgraded to MW1.23 today and still experiencing this sorting issue.--Wmat (talk) 14:54, 5 June 2014 (UTC)


* Please try this in the latest 1.5 release or later. I believe that this might now be fixed. -- Adamfranco (talk) 22:23, 17 February 2015 (UTC)

Switch for upload German mediawiki Version 1.22.6[edit]

Hello from Berlin,

Is there a parameter to switch this extension on just for uploads?

Thank xou for your attention--[[User:Bmrberlin| Bernd M.]] (talk) 12:19, 10 October 2014 (UTC)

There is not such a parameter currently, though I'm happy to review and integrate Pull Requests submitted via Github. Adamfranco (talk) 15:38, 10 October 2014 (UTC)
I'm not at all familiar with this Github tool. So I do not know, how to address a request.--[[User:Bmrberlin| Bernd M.]] (talk) 16:08, 10 October 2014 (UTC)
There is not a parameter for this extension to just apply to uploads. -- Adamfranco (talk) 22:25, 17 February 2015 (UTC)

Useless files (Done)[edit]

CategorySuggestFunctions.php and CategorySuggestSuggest.php are useless files, as they define (with huge errors) the same functions defined in the main and in the body files. Please remove them from the package, they only improve the mess.

A lot of attention is paid to the whole XHTML matter, up to and including the CDATA section in the inline script... Then you end up with a bunch of useless document.write (.body.php, lines 58 and below). Document.write is not an allowed method in XHTML and for a lot of good reasons. I'm going to change it to innerHTML in my version, please do the same in the master.

Include a "margin-bottom:0" CSS statement in the stylesheet. Some skins add strange margins and the suggestion list appears detached from the input.

Add a new line of text in i18n for the suggestion title tooltip, and load it with an inline <script> tag so that the text does not appear in English (e.g.
$m_pageObj->$m_place .= "<script type=\"text/javascript\">/*<![CDATA[*/ var categorysuggestSelect = \"". wfMessage( 'categorysuggest-select' )->text() ."\"; /*]]>*/</script>\n"; (.body.php, line 55)
result.title = categorysuggestSelect; (js, line 75).

The extension experiences a bug: when the $wgDefaultUserOptions['forceeditsummary'] is enabled in localsettings, and the page is reloaded because no summary has been provided, the inserted categories wikitext ([[Category:]]) is displayed on top of the reloaded textarea, and categories are not stripped from text. I'm going to try and patch this. Feel free to give suggestions about how to do it, but I need it quite soon so I'll try it myself.

Categories are stripped from <includeonly> and <noinclude> sections, and then reinserted out of them. I'm going to insert a drag-and-drop JS mechanism to reinsert categories in specific places if needed.

I will submit all the changes as soon as they're done. Thanks for all your effort.

--AndySky21 (talk) 16:16, 17 February 2015 (UTC)

Hi AndySky21, the two useless files have been removed from the latest 1.5 release. I've also addressed the issue of categories getting striped from <noinclude> tags. Take a look at the latest release before you spend too much time on these. If there are additional improvements you are working on, please submit them as Pull Requests via Github. If you encounter issues that you aren't sure how to solve, create them as Github issues -- Adamfranco (talk) 17:09, 17 February 2015 (UTC)
Thank you so much, Adamfranco. I downloaded what was the "latest" version some days ago, I just had to wait a couple of days it seems :) ready to try!

Lost Translation (Done)[edit]

In the last version of the extension the French localisation has been inserted. However the Italian texts have gone lost.

If you are interested, you can merge the pull request I submitted, which also patches the title attribute on suggestions, now displayed in the proper language.

Side note: the JS of the extension, as well as the inline script, could benefit from using jQuery which is present in mediawiki by default. I can improve that as part of my bug fix if you like.

--AndySky21 (talk) 22:05, 19 February 2015 (UTC)

* Thanks, AndySky21, your updates have been merged into the master branch. -- Adamfranco (talk) 23:37, 19 February 2015 (UTC)
Just noticed! I like the extension and I'm working on a jQuery optimization of the JS, as well as bugfix (as discussed on Git issues). Let's see what I can do. Glad to help --AndySky21 (talk) 02:30, 20 February 2015 (UTC)

Erronious transposition of category definition from text[edit]

If the user has a link to a category page in the text and uses the wrong linking wiki text, the extensions will cut out this text and move it to the bottom of the page, as per it's design. The code isn't yet smart enough to distinguish between a category definition for the page and a user's link to a useful page, embedded within the body test. E.g "Take a look at [[category:Foo|My Foo]]." The extension will remove [[category:Foo|My Foo]] leaving you with the sentence, "Take a look at." Ideally the user should have put [[:category:Blah|My blah]], which works just fine, but users aren't always aware of this syntax. Ben (talk) 10:04, 02 June 2015 (GMT)

Warning: Illegal offset type[edit]

I'm using MW 1.23x and (soon) 1.25. With CategorySuggest 1.6 installed and enabled I was receiving the following error message when editing a page that contained 'nowiki' tags.

The Error:

Warning: Illegal offset type in C:\LG_WIKI_1-23\extensions\CategorySuggest\CategorySuggest.body.php on line 147

Warning: Illegal offset type in C:\LG_WIKI_1-23\extensions\CategorySuggest\CategorySuggest.body.php on line 158

Warning: array_pop() expects parameter 1 to be array, null given in C:\LG_WIKI_1-23\extensions\CategorySuggest\CategorySuggest.body.php on line 158

Warning: Illegal offset type in C:\LG_WIKI_1-23\extensions\CategorySuggest\CategorySuggest.body.php on line 147

Fatal error: [] operator not supported for strings in C:\LG_WIKI_1-23\extensions\CategorySuggest\CategorySuggest.body.php on line 147

The Fix:

I managed to fix this issue by casting the offending arrays to string. See below for the original and corrected code.

Original:
147: if(empty($stacklist['nowiki'])) $stacklist[$index][] = true;
158: if((empty($stacklist['nowiki'])) || ($index == 'nowiki')) array_pop($stacklist[$index]);

Corrected:
147: if(empty($stacklist['nowiki'])) $stacklist[serialize($index)][] = true;
158: if((empty($stacklist['nowiki'])) || ($index == 'nowiki')) array_pop($stacklist[serialize($index)]);

See the php manual regarding arrays for more info on this. Ben (talk) 15.40, 30 June 2015 (GMT)


@Adamfranco, mg169706: I also get the above errors usign categorysugget 1.9 and the above fix does not work:
Warning: Illegal offset type in /public_html/extensions/CategorySuggest/CategorySuggest.body.php on line 132
Warning: Illegal offset type in /public_html/extensions/CategorySuggest/CategorySuggest.body.php on line 143
Warning: array_pop() expects parameter 1 to be array, null given in /public_html/extensions/CategorySuggest/CategorySuggest.body.php on line 143

--Mshastchi (talk) 08:22, 17 July 2019 (UTC)

@Mshastchi: I've been getting this same warning recently. TBH I just turned off PHP error reporting in LocalSettings. It's only a warning. Perhaps someone with more knowledge/time can fix this permanently?