Support Forum

Saving profile not working

MM Mike Miler
Mike Miler
Member

Hey,

I have a weird issue with simple-press on a client website: The URL of the form is translated into german (it is a german blog). Thats why the saving process doesnt work. Here the wrong url:

/wp-admin/admin-ajax.php?action=profile-save&form=accounteinstellungen&userid=397&_wpnonce=0169894455

And it should be this:

/wp-admin/admin-ajax.php?action=profile-save&form=account-settings&userid=397&_wpnonce=0169894455

I couldnt find any translations for this. Do you have an idea how I can fix this issue?

Thanks,

Mike

33 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Well SP does not translate it. And I know nothing in WordPress that would translate it. In fact nothing should translate it as it would no longer work – as you find.

Do other WordPress Ajax calls from other sources get translated like this? The same would apply – they should then fail.

I think you need to start by looking closer to home. What about WP plugins? Do you have any of those to do with automated translations?

MP Mr Papa
Mr Papa
Member

what version of simple press?  and wordpress?  I saw this happen once before on a much older version of simple press…

can you try going to forum – toolbox – housekeeping and reset the profile tabs…

MM Mike Miler
Mike Miler
Member

Thank you for your replys!

SimplePress is uptodate. And there were no other translation plugins.

But: I found the issue in the database. I changed the slugs manually in the table “sf_meta”.

meta_type: profile
meta_key: tabs

I could not figure out how the wrong slugs came to the db. When are the slugs written to the db? Is it save from updates in the future?

YE Yehonal
Yehonal
Member

Few minutes ago i’ve debugged the code to find the issue we’re discussing here: https://simple-press.com/support-forum/sp5-general-topics/various-issues-on-uploader-and-profile-edit-after-upgrade/page-2/  and found that there’s a translation problem on form name that doesn’t allow the ajax call to work properly:

on line 55 of sp-ajax-profile-save.php:

if (isset($_GET[‘form’])) { if (isset($_GET[‘form’])) { $thisForm = sp_esc_str($_GET[‘form’]);

but sp_esc_str doesn’t translate the GET variable so the switch below doesn’t work returning an empty result.

then i’ve noticed this post and i don’t feel alone now 

YS Yellow Swordfish
Yellow Swordfish
Member

The question is why are Mike’s profile strings translated in the first place? SP does not do this. These form name strings are not in the PO files. And to answer MIke’s question – no – they are not protected from future updates. A few of our plugins will re-run the code to rebuild the sfmeta record.

@mr-papa – so are you saying that you have seen these strings translated before?

MM Mike Miler
Mike Miler
Member

I also checked the po files and could not find any translations for them.

Is it possible that the slugs are taken from the titles? It was always the title in small letters with a minus instead of the space.

@yehonal I might be wrong but think the ajax-save file takes the slug from the form url which is already wrong. So there we already have the translated slug.

@yellow-swordfish Is there a hook where I could temporarly change the slugs to the right one after every update? Probably not the cleanest solution but to make it save for the next updates it could be a workaround.

YE Yehonal
Yehonal
Member

I’ve noticed that even if i change the language site in english, all strings are displayed in english except profile menu item on left (screenshot)

so i think that meta-values are already translated in db (maybe a wrong upgrade?)

@wpmike did you fix it?

 

all my users can’t update their profiles from many days :-/

YS Yellow Swordfish
Yellow Swordfish
Member

For a plugin that is awash with hooks I am surprised to find there is not one there. That’s OK as we can add one easily enough. But don’t misunderstand me… normal SP updates will not rebuild the tabs record – they only change when one of plugins adds a new tab on activation. And actually – this does not rebuild the whole record – just adds a new entry or two.

On the slug/title question, it uses the ‘slug’ element of the array you found in the sfmeta table. And that is because the title CAN be translated but the slug should never be. 

By the way – I am aware that @mr-papa said above that he recalls this happening before a long time ago but i have to say that I can not and it is, I believe, a unique issue. We have lots of users in Germany and Italy (for example) who do not report such a problem and many have bene users for some years. And this is in my view we need to look a little closer to home to see if there is some unique circumstance in your WP site that is responsible in some way.

I will talk this over with Mr Papa later today…

YE Yehonal
Yehonal
Member

Ok thanks @yellow-swordfish 

Meanwhile is there a way to restore original meta-values for core metadata?

YS Yellow Swordfish
Yellow Swordfish
Member

Yehonal said
Ok thanks @yellow-swordfish 

Meanwhile is there a way to restore original meta-values for core metadata?  

If you mean the profile menus and tabs then forum admin > toolbox > housekeeping has a task to rebuild them.

Could we take your issue back to your original thread? Less confusing that way. And have you investigated the mod_security question?

YE Yehonal
Yehonal
Member

It’s useless to continue there since i ve the same problem of mike.

I thought it was something wrong with ajax call security since it returned empty strings. But it just try to send a translated form name that is not recognized by the script (but without any php errors).

I tried to rebuild profile tabs before but unsuccesfully. Are you sure that method can restore slugs?

MM Mike Miler
Mike Miler
Member

The toolbox didnt help in my case…

I fixed the issue by replacing the strings in the db. Here what I did:

1. I customized the following entry in table “sfmeta”:
meta_type: profile
meta_key: tabs
There we have a serialized entry. To edit the slugs, I used this tool (do not just replace string in the serialized entry. It will break then): 
http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Just upload this tool to the root directory of your website and navigate to the directory in your browser.

2. Check the url in the form-tag of your website and search with the tool above for the string after “form=”. This is the string to be replaced.

3. I got the right strings from the file /wp-content/plugins/simple-press/forum/profile/ajax/sp-ajax-profile-save.php. Here you see the correct slugs after the “case: “. Copy the depending string to the replacement field at the tool.

4. Select only the table “sfmeta” for the replacements and make a dry run (nothing will be replace). There should be only one result. Now you can check if the replacement was correct. If it is correct, you can run the live run.

5. Repeat this replacement for every string (step 2-4).

6. Delete this tool again! It is public and everyone can change everything in the database if you keep it online!

7. Make a copy of the db entry. If it breaks after the next update, you can replace the serialized string if there are no changes because of the update.

As a long term solution we could make a php functions to unserialize the string, search and replace the depending slugs and overwrite it again. And maybe there is even a hook to automate this. For sure not the cleanest solution. But until we know where this issue comes from this would help…

MP Mr Papa
Mr Papa
Member

Yes, ran across this once before…  we were not able to replicate it at the time, but the user clearly had the problem…  we could go through the same sequence of translating tabs/menus with same strings and not have the issue…

here is link to how we could correct on his site:  https://simple-press.com/support-forum/sp5-general-topics/ok-i-translated-a-theme-now-what/page-3/#p165207

so perhaps we could get more info here to track down…   like that user, are you translating the sp admin?  by that I mean, do you have translations enabled and are you showing the admin in the translated language?  if the sp admin is in English, can you check forum – integration – language translations and see if the sp admin translation is shown as being there?

MM Mike Miler
Mike Miler
Member

Yes I use the admin translations. But I checked the po files and could not find for e.g. “account-settings” in there. Maybe I just did not find it (?). Here a screenshot of the translation page.Screenshot-2017-06-13-16.10.58.png