Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new tag created with wrong slug #366

Open
herrvigg opened this issue Jun 23, 2018 · 30 comments
Open

new tag created with wrong slug #366

herrvigg opened this issue Jun 23, 2018 · 30 comments
Labels
bug Something isn't working, reproducible enhancement New feature or request legacy issue Legacy issue imported from original repo

Comments

@herrvigg
Copy link
Collaborator

Issue by picasso
Thursday Mar 24, 2016 at 10:08 GMT
Originally opened as qTranslate-Team/qtranslate-x#366


The problem is the following:

I have tags which are linked to post with custom type (in my case 'movie').

For example tag with Name

[:en]Barolo[:ru]Бароло[:]

and with Slug in English

barolo

When I change something in my post with this tag (the content for example) and then update it

  • if my WordPress Admin interface is English everything is OK.
  • if my WordPress Admin interface is Russian then a new tag created with the same Name ([:en]Barolo[:ru]Бароло[:]) but with Slug in Russian (Бароло). Old tag with English slug (barolo) is unlinked from the post and the new tag with Russian slug is linked.

Could you check it? It's very annoying to re-check all tags and delete/relink them...

@herrvigg herrvigg added the bug Something isn't working, reproducible label Jun 23, 2018
@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Wednesday Apr 27, 2016 at 03:37 GMT


Do you use QTranslate-Slug?

@herrvigg herrvigg added enhancement New feature or request legacy issue Legacy issue imported from original repo labels Jun 23, 2018
@herrvigg
Copy link
Collaborator Author

Comment by picasso
Thursday Apr 28, 2016 at 13:17 GMT


No... It's another plugin? I use qtranslate-x only

@herrvigg
Copy link
Collaborator Author

Comment by floopyzicer
Thursday Apr 28, 2016 at 20:13 GMT


Than that plugin is not compatible with q-translate-x
also q-translate slug is somewhat 80% compatible tags work but it does
break the site.

On Thu, Apr 28, 2016 at 3:17 PM, Dmitry notifications@github.com wrote:

No... It's another plugin? I use qtranslate-x only


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
qTranslate-Team/qtranslate-x#366 (comment)

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Friday Apr 29, 2016 at 08:12 GMT


I do not use QTranslate-Slug

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Saturday Apr 30, 2016 at 23:34 GMT


Is this only happening for custom types? Which plugin do you use to manage custom types?

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Monday May 02, 2016 at 09:33 GMT


I have not tried this with a regular post... I will try it today.
I use Types plugin to manage custom types.

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Saturday May 07, 2016 at 22:34 GMT


Hi Dmitry, could you test if your problem solved here: https://github.com/qTranslate-Team/qtranslate-x/archive/stable.zip ?

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Sunday May 08, 2016 at 11:50 GMT


Hi John, I've tried it with a regular post - the same result, a new tag created with a wrong slug.
The link you provided - is it 3.4.6.7?
I have qtranslate-x 3.4.6.7 installed on my site and I tested a regular post on this version... that means the problem not solved yet...

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Sunday May 08, 2016 at 14:22 GMT


Link I gave you is the latest updated https://github.com/qTranslate-Team/qtranslate-x/blob/stable/qtranslate.php#L6

You probably looked in readme https://github.com/qTranslate-Team/qtranslate-x/blob/stable/readme.txt#L7, which I have not finalized yet.

The changes made which should target your problem is qTranslate-Team/qtranslate-x@ad28ac4

;-)

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Sunday May 08, 2016 at 18:52 GMT


Ok, I've tried this 3.4.6.8
But the problem is still here... :(

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Sunday May 08, 2016 at 19:06 GMT


Are you sure? Did you do deactivation/activation? I cannot reproduce it anymore. You may need some clean up on older tags. Did you try a brand new tag and post?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Monday May 09, 2016 at 19:23 GMT


Hi Dmitry, would you have time to test it deeper soon enough? I want to release 3.4.6.8, but I wish to make sure that you are ok first. I cannot reproduce the problem anymore by the steps you listed. Am I doing something else than you do? Could you think of a better way for me to reproduce if the problem is indeed still there? Thanks a lot.

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Wednesday May 11, 2016 at 14:01 GMT


Hi John,

sorry, I was away from my computer for 2 days...
Ok, I tested it again.

What I found out:

  • if I use a brand new tag (one I created after install of 3.4.6.8) the problem is solved.
  • if I add to a brand new post an old tag (one of I created before 3.4.6.8) - the problem is still here.

I'm glad that with new tags it works, but what should I do with my old tags?
I have 540 tags and all of them are linked many times to different posts... I cannot recreate them and relink again... Maybe you could write some kind of script which I could use to "heal" my old tags?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Wednesday May 11, 2016 at 15:11 GMT


Wow, sorry about this. I guess, the easy way would be to fix it in db. I assume you know how to edit database, right? Fix table wp_terms first. Edit names and slugs as you wish them to be. Names should be in the default language without any "[]", same way as they would be without qtx. Then copy content of option 'qtranslate_term_name' into a text file to be able to edit it. It is a hash with keys to be the term name and value is a hash of "xx" => "name translation". Make sure the keys are the same as names in wp_terms table. I assume you know how to edit hashes in db? The tricky part is to adjust the length if you change some string.

If you think it is too complex, send me .sql file with wp_terms and value of option 'qtranslate_term_name' via qtranslateteam at gm ail d c om. I will try to fix id and may come up with some cleaning script, as I assume some other people would have this problem too. Interesting that you are the only one so far to notice this trouble. I guess, people do not use tags much, or do not translate them.

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Friday May 13, 2016 at 07:36 GMT


Hi John, I've sent you a mail with .sql files.

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Monday May 16, 2016 at 17:10 GMT


Hi, Dmitry, we are working on an option to clean up term translations, as it seems to be a problem inherited from old qt-. Now WordPress did so many changes, that old way, qt- was dealing with term translations, is totally obsolete now and needs to be re-designed anyway.

Does this issue hold you from going ahead with your development? Your db file shows just a few broken tags, which you may edit manually in a normal way at /wp-admin/term.php page and it should correct the problem from now on. Is that right?

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Tuesday May 17, 2016 at 13:41 GMT


Hi John,

no, this issue does not hold me. I just found out that I need regularly check the terms after my editors made some changes in the posts. I takes 5-10 minutes to clean up after them.

But certainly I prefer to resolve this problem in the future and forget about it.
What do you mean under "you may edit manually in a normal way at /wp-admin/term.php page and it should correct the problem from now on"?

Could you give me some clues how manually correct my old tags? Just "Edit Tag" and then press "Update"?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Tuesday May 17, 2016 at 17:40 GMT


Yes, I think just making sure that all the values, including slug, are correct at term.php and pressing "Update" should fix database entry. All ids and relationship with posts are staying the same this way, only tags names and slug get adjusted in a correct way. I did not try though. What does that do for you? You should use LSB mode at term.php. Raw Editor Mode is discovered broken at term.php and we are working on fixing it too.

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Monday May 30, 2016 at 18:39 GMT


Hi Dmitry, could you please test https://github.com/qTranslate-Team/qtranslate-x/archive/stable.zip as much as you can? This should be a fix for your issue, as well as editing of tags in Raw Editor Mode, etc. It should even allow you now to add a new tag on /wp-admin/post.php?post=xx&action=edit using Raw ML format. Naturally, you cannot control slug auto-generated in this case and you may need to adjust it later on /wp-admin/term.php

Apply database operation "Clean Legacy Term Names" from page /wp-admin/options-general.php?page=qtranslate-x#import (keep backup before, of course).

Please, try really hard to break it for a few days and let me know if you find problems. Thank you very much.

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Monday May 30, 2016 at 18:45 GMT


I have published pre-release with that version: https://github.com/qTranslate-Team/qtranslate-x/releases/tag/3.4.6.9

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Tuesday May 31, 2016 at 21:51 GMT


Hi John,
I was away from computer...
I will try this pre-release really hard :)

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Tuesday Jun 14, 2016 at 20:23 GMT


Any news?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Saturday Jun 18, 2016 at 00:57 GMT


I hope you are ok, Dmitry, are you? Have you gotten a chance to test at least a little bit?

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Sunday Jun 19, 2016 at 23:53 GMT


Sorry. I'm ok now...

I've tried operation "Clean Legacy Term Names" and after that I get the following log:

Error: Term "layout" (id=509) cannot be loaded. Error message:
"Invalid taxonomy"
This term has been removed.

Legacy term names have been cleaned up:
Term "Бургундия" (id=6) has been modified from:
"Burgundy" => { en => "Burgundy", ru => "Бургундия" }
to:
"Бургундия" => { en => "Burgundy", ru => "Бургундия" }
Term "Кло де Реа" (id=9) has been modified from:
"Clos de Reas" => { en => "Clos de Reas", ru => "Кло де Реа" }
to:
"Кло де Реа" => { en => "Clos de Reas", ru => "Кло де Реа" }
Term "Анна-Франсуаза Гро" (id=11) has been modified from:
"Anne-Francoise Gros" => { en => "Anne-Francoise Gros", ru => "Анна-Франсуаза Гро" }
to:
"Анна-Франсуаза Гро" => { en => "Anne-Francoise Gros", ru => "Анна-Франсуаза Гро" }
Term "Жан Гро" (id=12) has been modified from:
"Jean Gros" => { en => "Jean Gros", ru => "Жан Гро" }
to:
"Жан Гро" => { en => "Jean Gros", ru => "Жан Гро" }

.....and so on...

It's strange how it was modified (or maybe it's only wrong way to write in the log)...
but the problem is that after this operation all my tags are in Russian. The slug is english but the name is Russian and it does not change if I switch the language. Either in admin or in front.

So I restored the database from backup.

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Monday Jun 20, 2016 at 00:04 GMT


But then I found out that tag names do not change when I switch the language even after restore the database.
I returned to version 3.4.6.8
Now tag name is changed after the switch.
Something is wrong with the new release...

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Monday Jun 20, 2016 at 00:17 GMT


Yeah, the "Clean Legacy Term Names" did not seem to work ... I did not have a way to really test it.
What is your default language, en or ru? Also, what is your first language in the list in the configuration?

Did you try to do anything else besides "Clean Legacy Term Names" before you gave up?

That operation was not the main point of the update at all, but it is for you ... I am sorry. Anyway we'll take a look why it did not work.

Thanks a lot for the testing!

@herrvigg
Copy link
Collaborator Author

Comment by picasso
Monday Jun 20, 2016 at 17:42 GMT


My default language is English. My first language in the list is also English.
No, I have not tried anything else. As I remember the previous release solved the problem with a new created tag. And only problem I have now - my legacy term names.
I could test tomorrow but what concrete I should test if not "Clean legacy term names"?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Wednesday Jun 29, 2016 at 05:03 GMT


Hi Dmitry, we cannot find what is wrong. The only explanation would be that you call some filters in your other code which we remove during the run of "Clean Legacy Term Names".

Unfortunately, we do not have a good testing case and you will probably be the only user of this code in the nearest future. This makes it hard for us to test and puts a pressure on you ;) Please help us to resolve this.

We altered the code a bit to allow filters, but still not sure if that was a real cause. In order to save your time on db recovery in case it is still not working right, please, after you dowload the latest stable branch, https://github.com/qTranslate-Team/qtranslate-x/archive/stable.zip, comment/uncomment the following lines of code in "qtranslate-x/admin/qtx_admin_utils_db.php" before running operation "Clean Legacy Term Names".

Comment lines:

L502: wp_update_term( $id, $taxonomy, array('name' => $nm) );
L530: update_option('qtranslate_term_name', $term_name);

which will prevent saving the result of the operation into the database. The report will still be generated.

Make sure to enable WP_DEBUG - change or add line as "define('WP_DEBUG', true);" in /wp-config.php. Then uncomment lines with calls to qtranxf_dbg_log: 434, 501, 528 and 529.

This will record additional debugging information in file /wp-content/debug-qtranslate.log. Then you can re-run this operation again and again without altering the database, until you get report and additional debugging information correctly.

Only the default language of all the terms have to be saved in db field wp_terms:name. Option "qtranslate_term_name" should have mapping like this:

"Burgundy" => { en => "Burgundy", ru => "Бургундия" }

where "Burgundy" is the term name in the default language.

Please, if the things go wrong again, troubleshoot it and let us know what needs to be fixed. I think that with that additional debugging output, the troubleshooting should not be difficult, I am sure you can do it quickly enough.

If all goes well, then continue testing all operations you normally do with terms like creation from different pages, alternation of them and so on. The whole term framework was changed comparing to the version you currently use. That is why the testing of all the operations is important - that is what I meant to test when I asked if you tested all the rest ;)

Thank you very much for your help. I hope it will take a bit quicker than a few weeks for you this time ;)

We would like to release the new version in a few days. I think you are the best case to test it all and I would not release it until you say that all is ok for you. A few other testers already reported "no problem". Please, I hope you can help us.

Thanks a lot.

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Thursday Jun 30, 2016 at 06:12 GMT


Any news?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Friday Jul 01, 2016 at 17:41 GMT


Dmitry, how is it going?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working, reproducible enhancement New feature or request legacy issue Legacy issue imported from original repo
Projects
None yet
Development

No branches or pull requests

1 participant