Extension talk:SelectCategory

Is it possible to make the category listing with Select category look like Categorytree, so if you have 500 categories, you don't have to browse trough all but push the + symbol in front of the main category. --Aroekene 22:00, 5 June 2008 (UTC)
 * I have the same request! THis would be great!

Call-time pass-by-reference
Warning: Call-time pass-by-reference has been deprecated in ...\mediawiki\extensions\SelectCategory\SelectCategoryFunctions.php on line 21

Warning: Call-time pass-by-reference has been deprecated in ...\mediawiki\extensions\SelectCategory\SelectCategoryFunctions.php on line 103

I tried and
 * allow_call_time_pass_reference = On in php.ini
 * adding "?>" at the end of the php files

but this did not fix anything

Please suggest a fix, thank you.

Different version - same error
After upgrading to MediaWiki 1.15.1 and the concurrent extension-snapshot I get the same error-messages:

Deprecated: Call-time pass-by-reference has been deprecated in /opt/lampp/htdocs/_fhbwiki/extensions/SelectCategory/SelectCategoryFunctions.php on line 21 Deprecated: Call-time pass-by-reference has been deprecated in /opt/lampp/htdocs/_fhbwiki/extensions/SelectCategory/SelectCategoryFunctions.php on line 103

I've tried putting:

error_reporting(0);

at the beginning of SelectCategoryFunctions.php but that makes no difference whatsoeverer.

As far as I can say, the extension works, but instead of displaying the usual selection-window a long list with control-boxes appears.

Everything works ok with: MediaWiki 	1.14.0 PHP 	5.2.9 (apache2handler) MySQL 	5.1.33

But the error occurs with: MediaWiki 	1.15.1 PHP 	5.3.0 (apache2handler) MySQL 	5.1.37

I also need help with fixing this.

--Katwol 11:56, 17 August 2009 (UTC)

Download of tar does not work
Extraction error.

Please fix this thanks.



$wgSelectCategoryEnableSubpages ignored
I testet the extension under 1.10. But the disabling selection by subpages will be ignored if $wgSelectCategoryEnableSubpages = false; -- User:OZZ 18.052007

Seems to be just a typo in the code, just replace in the functions php $wgSelectCategoryEnableSubpage with the correct  $wgSelectCategoryEnableSubpages -- Venia 15:52, 10 December 2008 (UTC)

Has someone tried it on 1.6.8?
Is there a technical reason that it does not work there?


 * Yes, there is. We introduced new member variables which will be available in release 1.8.3. Otherwise it can't work. --80686 14:04, 29 November 2006 (UTC)

not removing categories
I think it's better if categories aren't removed from the edit box. I've sumitted a batch at 8359. It might also be nice if the categories had checkboxes next to them, but that seems a little more complicated; this simple solution makes the extension seem more useful for me. -Steve Sanbeg 20:06, 22 December 2006 (UTC)


 * working on it. It's not that easy, but it will work. On the other hand will this handling lack of the comfort the extension should provide. --Manuel Schneider(bla) (+/-) 21:57, 3 January 2007 (UTC)


 * Cool. For the uses I see for it now, it isn't necessary to completely hide the categories; and this option would prevent someone from clicking a category on the list and accidently removing all of the existing categories. -Steve Sanbeg 17:08, 5 January 2007 (UTC)


 * I upgraded my wiki, and was starting to test in production when I discovered the cycle bug. so I guess that will have to wait. But I wanted to mention (in case you didn't notice) that my patch also fixes one other, minor bug; there was a missing preg_quote on the custom namespace, which could break if someone names their namespaces oddly. -Steve Sanbeg 19:24, 19 January 2007 (UTC)


 * I just added a javascript file to my install of this extension that simulates the behavior of holding Ctrl when selecting categories in the multi-select box. This way selecting a new category does not unselect any existing selected categories.  -Jimmysessions


 * I added checkboxes and submitted a patch. Leon Weber was kind enough to add my patch to the next revision. --Emceelam 19:12, 25 July 2008 (UTC)

Fatal Error
I'm getting a fatal error when trying to create or edit a page using this extension. I'm Using Mediawiki 1.8.2.

Fatal error: Call to undefined method Title::isSubpage in /mounted-storage/home24b/sub001/sc112516-ZBLG/wiki/extensions/SelectCategory/SelectCategoryFunctions.php on line 25


 * SelectCategory doesn't work with MediaWiki 1.8.2. Go read the contents in the red box on SelectCategory. --Manuel Schneider(bla) (+/-) 19:25, 3 January 2007 (UTC)

Considerations
I was about to post about that which was mentioned above - this definately shouldn't remove the categories from the edit box itself. The reason *I* was going to bring forward was different - lots of templates place pages they are transcluded onto into categories, and most such templates have their categories in tags. There are also other such cases where the placement within a page of the category tag matters - so I would appreciate it if the previous poster's suggestion and/or patch are applied, for very good reasons. Secondly, again, sometimes categories are assigned to a page by way of templates transcluded onto it, or other things - so it may be a good idea to list below the box the categories that the page is in that aren't in the box. Maybe also remove them from the box, as they shouldn't be unselected (or selected, for that matter) there.

One other thing I was considering, is that it might be a good idea to make this a seperate page - as in, perhaps a 'categorization' caction tab, or a 'categorize' button under the edit form along with save, preview, and changes - that way, a user could go to a SEPERATE page to work on the categories using this cool method, then return and see the changes - we don't really want two ways to do the same thing on one page, and having the AJAXified box AND the normal text box is exactly that - two ways to do the same thing. Did that make sense? I mean like the user clicks a 'categorize' button under the edit summary box, they get taken to perhaps a special page, or just another page action, where there is nothing but the selectcategories box, and a list of categories the page is in - then they can change them, and click 'save categories' to return. Peerless 03:11, 6 January 2007 (UTC)


 * I agree with that. Although I don't think this extension could ever work well in template space, my patch would prevent it from being a complete disaster.  A categorization tab could be cool. -Steve Sanbeg 19:18, 19 January 2007 (UTC)

Enhancement
would a category cloud (like a delicious tag cloud) be possible. It strikes me that categories are equivalent to tag) and having the most popular ones most highlighted may be helpful.. (not so for esoteric subjects) but on the whole helpful. Perhaps mediawiki would be enhanced by tags as well as categories (sort of meta categories)


 * There are at least two extensions that already offer tag or category clouds, ie Extension:YetAnotherTagCloud and Extension:CategoryCloud. I don't think either of them offer them on the edit page though. pfctdayelise 04:19, 19 April 2007 (UTC)

It would also be helpful to remove "parent" categories, or the current category from the select list. This would prevent users from creating circular references.

Bug When Category Name Has Space In It
I've noticed a bug in the current version from SVN (haven't checked the latest stable). If an article is part of a Category which has a space in it's name (example: Category:Test Servers), it doesn't show as selected in the list when editing the page (although the Category does show up in the list). Haven't tested what happens when I hit save but I assume it would be removed from the Category. --128.233.131.139 21:46, 23 March 2007 (UTC)

I hit save - it removes any categories not selected, which makes this extension too dangerous to use on an existing wiki page for users who aren't aware of the bug. It seems that an underscore is an acceptable character instead of a space. --24.97.28.170 03:54, 22 June 2007 (UTC)


 * See Extension_talk:SelectCategory below.
 * This problem is fixed in SVN trunk. --Leon 17:32, 5 August 2008 (UTC)

New install - No category list
MW 1.9.3, apache, WinXP fairly new install

I have just downloaded the tarball and installed the extension. I have added the require_once. I have tried leaving the defaults and do not get anything when going into edit.

We have refreshed the browser and have tried a different browser and workstation. Still nothing.

Not sure what we might have missed. Ideas?--Dtsig 21:50, 30 April 2007 (UTC)


 * You have already created some categories... right? :) --pfctdayelise 11:29, 1 May 2007 (UTC)
 * Sorry should have said that. Yes.  We also use CategoryTree and it is working.  Is there anything else to do with the install other than putting the folder in extensions, add the require_once line to LocalSettings?  Just to be sure that it was firing I did put an echo at the beginning of SelectCategory.php and it did display (wasn't actually firing for the event but just the require fired it).  Any debug ideas?  problem with php .. it is like old languages where you had to debug to a line printer --Dtsig 12:23, 1 May 2007 (UTC)
 * Still trying to work this out. What would be the best way to debug this.  To get output of anything so we can be sure that the hook is firing?  Thanks --Dtsig 13:51, 11 May 2007 (UTC)


 * Further, I placed the following code at the start of each function (with correct function name) so i could see what the last function that was it was thinking this might help you know where it seems to be stopping. The file showed 'fnSelectCategoryOutputHook'.  Not sure if this helps but this appears to be the last thing that happens.

$rtn = file_put_contents ( 'phptest.log', 'got here - fnSelectCategoryOutputHook');
 * Ideas?? --Dtsig 15:11, 11 May 2007 (UTC)


 * And the answer is .. Conflict. We are also using DiscussionThread extension.  I am sending a note to its developer and hope that you and/or he can figure out where the conflict comes from.  Please let me know as both are great extensions for out users.  --Dtsig 15:34, 11 May 2007 (UTC)

Conflict Resolution?? --Dtsig 18:08, 11 May 2007 (UTC)
In working with the author of ThreadDiscussion we found that he had left 2 wfDebug functions in his code. Although this SHOULD NOT effect SelectCategory it appears that it does. This might be something you want to look into .. thanks

Sort
The category select box does not seem to sort ? is this a bug or will this be done in the future?

Mediawiki 1.9.2

Many thanks --Markw21 11:56, 8 May 2007 (UTC)

Preview removes all categories --Dtsig 18:09, 11 May 2007 (UTC)
It appears that using PREVIEW will remove the categories. My guess is that since you strip out the categories upon entering the editor, they are forgotten and lost during preview. This seems to be a problem.

Being Reviewed? --Dtsig 18:53, 17 May 2007 (UTC)
Has this been looked into? Can anyone else verify this?? thanks

Noted in Bugs on first page --Dtsig 19:19, 17 May 2007 (UTC)
Check out .. See bugzilla:9849 for a patch.

MW 1.10 and preview error --Dtsig 16:18, 20 June 2007 (UTC)
If you enter the following wrapped in pre tags (or code or geshi highlighting)

this starts on col 1 this starts on col 3 this starts on col 5

Then in edit/preview mode the spaces are all removed. If we comment out

then all works well


 * See Fix for trimming white space. --Bluefoxicy 18:22, 19 September 2007 (UTC)

Attachment 3600 Details for Bug 9848
after searching bugzilla I found this .. then noticed that there is a bug list on the extension page. Thought that this was usually on the discussion page. --Dtsig 16:23, 20 June 2007 (UTC)

Fix for multiple categories on one line --PaulHat 17:26, 13 July 2007 (UTC)
This is assuming you've done all the fixes from bugzilla. 241d240 < 243,247c242 <      #$m_pattern = "\[\[({$m_catString}|category):(.*)\]\]"; <      #PMH: BEGIN My fix for multiple categories on one line problem <              $m_pattern = "\[\[({$m_catString}|category):(.*?)\]\]"; <      #PMH: END My fix for multiple categories on one line problem < --- >      $m_pattern = "\[\[({$m_catString}|category):(.*)\]\]"; 249d243 < 265,275c259 < <              #$m_catLinks[ preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ) ] = true; <              #PMH: BEGIN My fix for multiple categories on one line problem <                      $cats = preg_replace("/.*?{$m_pattern}/i", "$2,", $m_textLine ); <                      $cats = preg_split('/,/', $cats, -1, PREG_SPLIT_NO_EMPTY); < <                      foreach( $cats as $cat ) { <                              $cat = preg_replace("/ /", '_', $cat);  #Fixes categories with spaces <                              $m_catLinks[ $cat ] = true; <                      } <               #PMH: END My fix for multiple categories on one one line problem --- >              $m_catLinks[ preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ) ] = true; I don't really like the comma I added to separate the categories in the preg_replace, but it works.

MW 1.10.1 / WinXP/IIS - Category not pre-selecting
Hi, i just dl'ed and installed this and followed the directions (which were very clear by the way-thanks) to install the extension. I have added the require_once.

Everything works except that if a page already has caterories in it then they are not pre-selected in the multi-select list.

Is this on purpose? Cheers, Wayne

Bug on no categories selected
The below patch fixes a bug for when a user selects 0 categories. Patches SelectCategoryFunctions.php

--- SelectCategoryFunctions.php	2006-12-17 12:27:48.000000000 -0500 +++ SelectCategoryFunctions.php.new	2007-09-18 16:20:29.000000000 -0400 @@ -88,6 +88,12 @@ function fnSelectCategorySaveHook( $m_is 	$m_catString = $wgContLang->getNsText( NS_CATEGORY );  	# Get some distance from the rest of the content:  	$m_text = "\n"; + +	# Check if the category list was left blank. +	if (empty($_POST['SelectCategoryList'])) { +		return true; +	} +  	# Iterate through all selected category entries:  	foreach( $_POST['SelectCategoryList'] as $m_cat ) {  		$m_text .= "\n$m_catString:$m_cat"; @@ -243,4 +249,4 @@ function fnSelectCategoryGetPageCategori  	# Return the list of categories as an array:  	return $m_catLinks;  } -?> \ No newline at end of file +?>

I submitted a patch to Leon Weber that fixes this bug. Not quite the same solution, but it fixes the bug nevertheless. My patch has been included in the current release. --Emceelam 05:42, 1 August 2008 (UTC)

Existing categories bug
The function fnSelectCategoryGetPageCategories needs to do a number of things to work correctly and efficiently:


 * Make a copy of the page text in another variable
 * Remove all lines not matching the category pattern
 * Split each line at and
 * Remove all lines not matching the category pattern
 * Convert spaces to '_'
 * For this last item, see Extension_talk:SelectCategory.

This will solve the following two problems:


 * Multiple categories on one line show up as only the last category link
 * Categories with spaces don't get selected

Note that the categories lists generated by the extension itself always work.

Critical Crash on Edit
Hi there, this has been a real pain to track down, but finally found that the SelectCategoryList was causing the problem.

Symptoms - cannot edit any wiki page.

Having reverted Apache versions and many other things, get php error output, can now see following errors...

[19-Sep-2007 14:12:21] PHP Notice: Undefined index:  SelectCategoryList in C:\htdocs\wkbv_wiki\extensions\SelectCategory\SelectCategoryFunctions.php on line 92

[19-Sep-2007 14:12:21] PHP Warning: Invalid argument supplied for foreach in C:\htdocs\wkbv_wiki\extensions\SelectCategory\SelectCategoryFunctions.php on line 92

If I remove SelectCategory extension from the LocalSettings.php all works fine....

Any ideas, or should I go back to manually editing categories. --Markw21 16:43, 19 September 2007 (UTC)


 * See the above patch about blank categories lists. --Bluefoxicy 18:20, 19 September 2007 (UTC)

Fix for trimming white space
If you trim the white space from the beginning and end of a line, you wind up killing indents (see the below diff? Edit the page and save with your extension and it becomes a big blob of text). You simply inappropriately used trim.

--- SelectCategoryFunctions.php.old	2007-09-19 14:17:49.000000000 -0400 +++ SelectCategoryFunctions.php	2007-09-19 14:19:07.000000000 -0400 @@ -237,7 +237,7 @@ function fnSelectCategoryGetPageCategori # Check linewise for category links: foreach( explode( "\n", $m_pageText ) as $m_textLine ) { # Filter line through pattern and store the result: -               $m_cleanText .= trim( preg_replace( "/{$m_pattern}/i", "", $m_textLine ) ). "\n"; +               $m_cleanText .= preg_replace( "/{$m_pattern}/i", "", $m_textLine ). "\n"; # Check if we have found a category, else proceed with next line: if( !preg_match( "/{$m_pattern}/i", $m_textLine) ) continue; # Get the category link from the original text and store it in our list:

Blank category page
tested with MW 1.11 getting the form on edit pages. but when click on a category link, getting a blank page. how to correct this?

--Jack

Added an add category inputbox and fixed uppercase bug and spanish i18n
There is a certain bug when a certain category has lowercase initial letter, the extension "forgets" to include it. Also added a box to make a new category

the diff script for SelectCategoryFunctions.php

51a52,53 >              $m_textBeforenew = '. wfMsg( 'selectcategory-new' ). :'; > $m_pageObj->$m_place .= "$m_textBeforenew &lt;br/>"; 90a93,98 >      if ( isset($_POST['NewCateg'])){ >      // add category >              $m_cat = $_POST['NewCateg']; >              $m_cat = strtoupper($m_cat[0]).substr($m_cat,1); >              $m_text .= "\n$m_catString:$m_cat"; >      } 238c246,248 <              $m_catLinks[ preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ) ] = true; --- >              $m_textLine2 =preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ); >              $m_textLine2 = strtoupper($m_textLine2[0]).substr($m_textLine2,1); >              $m_catLinks[ $m_textLine2 ] = true;

New file SelectCategory.i18n.es.php

$messages['selectcategory-title']	= 'Seleccione las categor&iacute;as'; $messages['selectcategory-subtitle']	= 'Para seleccionar m&uacute;ltiples categor&iacute;as contiguas use Shift-click, para categor&iacute;as no contiguas use Ctrl-click.'; $messages['selectcategory-new']	= 'Agregar categor&iacute;a';

Addition to SelectCategory.i18n.php

$messages['selectcategory-new']	= 'New category';

-- Miguel 189.181.98.205 20:12, 12 October 2007 (UTC)

Running problem
Hi all, i try tu use this extension but I have a sql error in the wiki page. show the message: Erreur base de données

//database error

Erreur de syntaxe dans la base de données. La dernière requête traitée par la base de données était :

(requête SQL cachée) //hidden sql request

depuis la fonction « fnSelectCategoryGetChildren ». MySQL a renvoyé l’erreur « 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'espace_"Portail"' AND tmpSelectCatPage.page_namespace = 14' at line 4 (localhost) ». thanks for your help.

Shilom 19:54, 14 October 2007 (UTC)

SelectCategoryTagCloud is stripping Leading spaces from text lines
Hey all, first off I just wanted to say I love this extension. I tend to forget the spelling of my categories and always get them messed up this is a huge help. That being said I discovered a problem with the extension. It strips out the leading text from your wiki page. This is only a problem if you are trying to use the leading spaces to create sections on the page. I tracked the problem back to "CategorySuggestFunctions.php" file. In here you are using the "trim" function which strips the blanks from BOTH the front and end of the lines. I changed all 4 "trim" commands to "rtrim" and the extension is now working fantastically. Anyway I wanted to pass this info on so it can be included into the new versions.

- John P 18 Nov 2007

Problem
Hey i had istalled this extension but it doesnt work there come some warings above my page:

1.     Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name]. If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /mnt/web5/20/83/51663183/htdocs/wiki/extensions/SelectCategory/SelectCategoryFunctions.php on line 21 2.  3.      Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name]. If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /mnt/web5/20/83/51663183/htdocs/wiki/extensions/SelectCategory/SelectCategoryFunctions.php on line 84 4.  5.      Warning: Cannot modify header information - headers already sent by (output started at /mnt/web5/20/83/51663183/htdocs/wiki/extensions/SelectCategory/SelectCategoryFunctions.php:21) in /mnt/web5/20/83/51663183/htdocs/wiki/includes/WebResponse.php on line 10 6.  7.      Warning: Cannot modify header information - headers already sent by (output started at /mnt/web5/20/83/51663183/htdocs/wiki/extensions/SelectCategory/SelectCategoryFunctions.php:21) in /mnt/web5/20/83/51663183/htdocs/wiki/includes/WebResponse.php on line 10

can anyone help me to solve this problem? thx :)


 * Add the following line to your php.ini:

allow_call_time_pass_reference = On
 * allow_call_time_pass_reference = On --> does not help
 * or try following solution --WIKImaniac 14:52, 14 January 2008 (UTC)


 * The headers errors can be solved by adding "?>" at the end of the php files of the extension. --Christian Ernst 00:15, 10 February 2008 (UTC)
 * --> does not help

is ignored
Hi there, if i use i a active Namespace, the extension also remove this categories, but do not place between after saving. Is there a other Solution, then the Patch above? --Ozz 19:46, 31 January 2008 (UTC)

No selection with FCKEDITOR Extension
I follow this FCKeditor_integration_guide. The FCKEDITOR shows the category in his text field but there was no selection in SelectCategory menu. I think it could be in the parser.php if i disable FCKEDITOR it works fine!

I use * MediaWiki: 1.10.2 * PHP: 5.2.4 (apache2handler) * MySQL: 5.0.45

Has anyone an idea to clean this problem ? Thank you very much for Help!

Try this: http://www.mwusers.com/forums/showthread.php?t=7257&highlight=category I haven't tested it but he claims it works. (Ed March 26, 2008)

Thomas: I will test it !! (March 27, 2008) I use * MediaWiki: 1.11.2 and 1.12.0 * PHP: 5.2.4 (apache2handler) * MySQL: 5.0.45


 * Hmm now i have this bug Bug when category has space in it
 * Only if i use select category and fckeditor 2.5.1
 * All other pages works fine!!

Thomas: Idea : It cuts the first part of the category name. For example the original:

PSP_Protokoll_2008

the result: _Protokoll_2008

Where is the first part "PSP" ??

Hy, I modified the Extension to work with FCKEditor, i made a update, now it should work with blanks in Categorynames:

I am sorry but it works only with the first space in the Name. The second space makes still the same problem. for example PSP_Protokoll_2008

the result: 2008

Patch to support categories with spaces
The following change seems to fix the problem where categories with spaces are silently ignored. Find the line preceded by "# Get the category link from the original text and store it in our list:" and change it to:

$m_catLinks[ preg_replace( '# #', '_', preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine ) ) ] = true;

Jlerner 16:02, 7 May 2008 (UTC)

Select category/Categorytree
Is it possible to make the category listing with Select category look like Categorytree, so if you have 500 categories, you don't have to browse trough all but push the + symbol in front of the main category. --Aroekene 22:00, 5 June 2008 (UTC)

PHP has encountered a Stack overflow
This is the message I get when I try to edit pages now. SelectCategory worked fine for some hours of work, but now I get this message. Is there a way that I can debug the problem?

Info from Speciel:Version
 * Produkt 	Version
 * MediaWiki 	1.12.0
 * PHP 	5.2.5 (isapi)
 * MySQL 	5.0.51b-community-nt

Installed extensions

Parser hooks Andre Lockdown 	per-namespace group permissions      --Asset 17:25, 18 July 2008 (UTC)
 * Configure (Version 0.5.7) 	Allow authorised users to configure the wiki by a web-based interface  	Alexandre Emsenhuber
 * SelectCategory 	Allows the user to select from existing categories when editing a page 	Leon Weber & Manuel Schneider
 * LinkSuggest (Version 0.2) 	Ajax-based link suggest that places results below tool bar. 	Adam Meyer


 * What version of the SelectCategory extension are you using? Try to use the current code from SVN trunk. --Leon 17:24, 5 August 2008 (UTC)

Did you consider users mistake?
Hi, If a user create a category and then directly or indirectly make this category as its subcategory for example:

book --somebooks -- -- book

your extension goes to an infinte loop, and mediawiki breaks. please let me know if you solve this type of problems.

How to have the category list to scroll ?
Hi, first of all excellent extension very pragmatic. I only have one problem, I'm not a software or developer or what not. My question is how to have the category list at the bottom to scroll?