- Posts: 11
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Joomfish mystery - only able to edit K2 extra fields in some K2 items?
Joomfish mystery - only able to edit K2 extra fields in some K2 items?
- Nathan Brown
- Topic Author
- Offline
- New Member
Less
More
14 years 4 months ago #83773
by Nathan Brown
Joomfish mystery - only able to edit K2 extra fields in some K2 items? was created by Nathan Brown
Ok, this is kinda urgent, but I doubt i'll get a reply quick enough to solve my particular crisis, but maybe an answer will help some one else in the future...
So I've quite happily been creating articles in K2, and translating them using joomfish. Bloody brilliant. Until...
Where have my extra fields gone?
At first I thought it was something to do with a plugin switching off or something across the board, but it seems that it's only on some items, not all.
So then I think, maybe I haven't told some categories to use the right extra field sets - but no, I've been editing them fine in my default language, and only see the problem when using the joomfish translator.
Does anyone have an answer for this? You'd be saving my bacon if I get the answer in the next day... if not, I'm going underground, and hiding from my client... I hate missing deadlines :(
So I've quite happily been creating articles in K2, and translating them using joomfish. Bloody brilliant. Until...
Where have my extra fields gone?
At first I thought it was something to do with a plugin switching off or something across the board, but it seems that it's only on some items, not all.
So then I think, maybe I haven't told some categories to use the right extra field sets - but no, I've been editing them fine in my default language, and only see the problem when using the joomfish translator.
Does anyone have an answer for this? You'd be saving my bacon if I get the answer in the next day... if not, I'm going underground, and hiding from my client... I hate missing deadlines :(
Please Log in or Create an account to join the conversation.
- Nathan Brown
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
14 years 4 months ago #83774
by Nathan Brown
Replied by Nathan Brown on topic Joomfish mystery - only able to edit K2 extra fields in some K2 items?
Ok, again driven by desperation, I've solved the problem of disappearing extra fields in the admin interface.
After following the trail of breadcrumbs from PHP to Javascript (tinyMCE code) and then back to PHP again I've found the route of the problem and a fix (core hack). I'm amazed that this wasn't included in the K2 joomfish code, bearing in mind that the purpose of this code is for multi-lingual which can includes special characters outside of the normal sets... darn it, I've spoiled the surprise.
Yes, the problem is due to certain special escape characters killing the Javascript ( joomfish/k2 calls javascript code to populate the form fields) that adds the extra fields to the forms in Joomfish.
Fixing this only takes a couple of extra lines, but in the right place... so be careful ;-)
Here we go:
You need to edit one file:
plugins/system/k2.php
in two places.
Find the two function definitions:
function renderOriginal(....
function renderTranslated(...
and in each function find the line:
$output = '';
and add an extra line before it:
$active = addslashes($active);//this fixes the problem
$output = '';
And that's it, all done! Now you won't have to worry about escape characters messing up your translation process :D
NOTE: this only fixes for data that you enter into the forms. if your extra field names (or default values) have escape characters, you have to also add the addslashes fix to a few more points in the same functions. But I'm sure you can figure that out for yourself now ;-)
Now, I only have 130+ translations to do in the next few hours :'(
After following the trail of breadcrumbs from PHP to Javascript (tinyMCE code) and then back to PHP again I've found the route of the problem and a fix (core hack). I'm amazed that this wasn't included in the K2 joomfish code, bearing in mind that the purpose of this code is for multi-lingual which can includes special characters outside of the normal sets... darn it, I've spoiled the surprise.
Yes, the problem is due to certain special escape characters killing the Javascript ( joomfish/k2 calls javascript code to populate the form fields) that adds the extra fields to the forms in Joomfish.
Fixing this only takes a couple of extra lines, but in the right place... so be careful ;-)
Here we go:
You need to edit one file:
plugins/system/k2.php
in two places.
Find the two function definitions:
function renderOriginal(....
function renderTranslated(...
and in each function find the line:
$output = '';
and add an extra line before it:
$active = addslashes($active);//this fixes the problem
$output = '';
And that's it, all done! Now you won't have to worry about escape characters messing up your translation process :D
NOTE: this only fixes for data that you enter into the forms. if your extra field names (or default values) have escape characters, you have to also add the addslashes fix to a few more points in the same functions. But I'm sure you can figure that out for yourself now ;-)
Now, I only have 130+ translations to do in the next few hours :'(
Please Log in or Create an account to join the conversation.
- phproberto
- Offline
- New Member
Less
More
- Posts: 1
13 years 3 months ago #83775
by phproberto
Replied by phproberto on topic Joomfish mystery - only able to edit K2 extra fields in some K2 items?
Thanks for this Nathan. You saved me a lot of time of debug.
Please Log in or Create an account to join the conversation.
- Mohsen Babaei
- Offline
- Junior Member
Less
More
- Posts: 20
10 years 10 months ago #83776
by Mohsen Babaei
Replied by Mohsen Babaei on topic Re: Joomfish mystery - only able to edit K2 extra fields in some K2 items?
Hello Nathan Brown
I did it, but I still have problem.
some extra fields are disappear in second language. what is the problem?
I did it, but I still have problem.
some extra fields are disappear in second language. what is the problem?
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Joomfish mystery - only able to edit K2 extra fields in some K2 items?