- Posts: 4
COMMUNITY FORUM
Frontend Editing - Hide Disabled Categories
- Rodrigo Moragas
-
Topic Author
- Offline
- New Member
I found a topic for this, but only for the 2.4.1 editing the form.php.
I'm using joomla 1.7 and K2 2.5.4 and the file form.php don't axist anymore. The file that I have found was itenform.php, but I coundn't found the code they talk about.
This is the post I found: community.getk2.org/forum/topics/frontend-editing-hide?commentId=3536014%3AComment%3A57384
I have search this for many days and try lots of combinations with those codes, but I just starting at php.
Thanks in advance.
Rodrigo Moragas
Please Log in or Create an account to join the conversation.
- Rodrigo Moragas
-
Topic Author
- Offline
- New Member
- Posts: 4
Thanks..
Please Log in or Create an account to join the conversation.
- Rodrigo Moragas
-
Topic Author
- Offline
- New Member
- Posts: 4
I search the web trying to find an answer, but without luck.
I talk to some friends to see if they know how to solve this but no could help.
If anyone have this same issue and solve it, please help.
I'm only dependinng on this to finish this project.
Thanks again,
Rodrigo Moragas
Please Log in or Create an account to join the conversation.
- Mircea Rusu
-
- Offline
- New Member
- Posts: 6
community.getk2.org/forum/topics/remove-not-assigned-categories-1?commentId=3536014:Comment:85244
is not working
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
You can do it like this :
- Override the core K2 item form layout by copying the file 'components/com_k2/views/item/tmpl/form.php' to 'templates/YOURJOOMLATEMPLATE/html/com_k2/item/form.php'
- Edit this new file and add this js code to it (in 2.4.1, i've added this in line 208, just before the end of the K2 js part) :
window.addEvent('domready',function () {
$$('#catid option').each(function(item, index){
if (item.getProperty('disabled'))
item.remove();
});
});
I've just tested on a local website with Joomla! 1.5.20, K2 v2.4.1 and mootools 1.1/1.2
Please Log in or Create an account to join the conversation.
- Mircea Rusu
-
- Offline
- New Member
- Posts: 6
Is Joomla 1.5.26 with k2 2.5.5 ( just upgraded from 2.4.1)
Please Log in or Create an account to join the conversation.
- Mircea Rusu
-
- Offline
- New Member
- Posts: 6
I have edited ..\media\k2\assets\js\k2.js at the line 239 from
$K2('#catid option[disabled]').css('color', '#808080');
to
$K2('#catid option[disabled]').css('font-size', '0px');
not nice but is working on Firefox. Not working on IE9, Chrome, etc.
Still need a solution for this
Please Log in or Create an account to join the conversation.
- robm
-
- Offline
- Senior Member
- Posts: 74
Done:
I have edited ..\media\k2\assets\js\k2.js at the line 239 from
$K2('#catid option[disabled]').css('color', '#808080');
to
$K2('#catid option[disabled]').css('font-size', '0px');
is not a good solutution.
Anyone knows how to hide the disabled categories when adding an article? (disabled = depending on usergroup)
Thanks for your help
Rob
Please Log in or Create an account to join the conversation.
- robm
-
- Offline
- Senior Member
- Posts: 74
It now works with IE9, Firefox and Chrome.
Go to \media\k2\assets\js\k2.js
Copy this code..
window.addEvent('domready',function () {
$$('#catid option').each(function(item, index){
if (item.getProperty('disabled'))
item.remove();
});
});
before this
$K2('#catid').change(function(){
if($K2(this).find('option:selected').attr('disabled')){
alert(K2Language[4]);
$K2(this).val('0');
return;
}
Please Log in or Create an account to join the conversation.
- robm
-
- Offline
- Senior Member
- Posts: 74
Please Log in or Create an account to join the conversation.
- Thomas
-
- Offline
- New Member
- Posts: 3
Please Log in or Create an account to join the conversation.
- megana
-
- Offline
- New Member
- Posts: 4
First, copy /components/com_k2/templates/default/itemform.php to /templates/(yourtemplate)/html/com_k2/default/itemform.php.
Then in your new file, near the top is a $document->addScriptDeclaration:
Log in or Create an account to join the conversation.
- N
-
- Offline
- New Member
- Posts: 5
Megan Valentine wrote: Here is what I did on my Joomla 2.5.6 with K2 2.5.7. Tested in Firefox and IE9.
First, copy /components/com_k2/templates/default/itemform.php to /templates/(yourtemplate)/html/com_k2/default/itemform.php.
Then in your new file, near the top is a $document->addScriptDeclaration:
Log in or Create an account to join the conversation.
- mili
-
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.