Skip Navigation

[Resolved] Cred generic field won't change for all post translated

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 6 years ago.

Assisted by: Shane.

Author
Posts
#1172271

Hi!
I had an active website that have a problem with a cred generic field.
Time ago, with your help, i create a cred generic field to user can't change frontend the post status.
The function code it's:
function change_post_status($post_id, $form_data) {

if ($form_data['id']==1062){
$my_post['ID'] = $post_id;
$my_post['post_status'] = $_REQUEST['my_post_status'];
// Update the post into the database
wp_update_post( $my_post );
}
}

function func_get_post_status() {

$post_id = $_GET['_id'];
$x = get_post_status($post_id);
return '<input type="hidden" id="sel_post_status_value" name="sel_post_status_value" value="'.$x.'" />';

}
add_shortcode( 'get_current_post_status', 'func_get_post_status');

And in my cred form i have:
[cred_generic_field field='my_post_status' type='select' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"default":["publish"],
"options":[{"value":"draft","label":"No activada"},{"value":"publish","label":"Activada"}]
}
[/cred_generic_field]

My problem happens when the user/admin changes the post status in WPML base language, it change the post status, but I want this option changes the post status for all the languages (my base language is catalan, but website have english, french and spanish languages too).

There is a way to do it?

Thanks in advance.

#1172276

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oriol,

Thank you for contacting our support forum.

I believe this one is more of a WPML ticket but lets see if I can resolve this here before referring you to our WPML forums.

Are the post translations created as duplicates? or are they independent translations.

Please let me know.

Thanks,
Shane

#1172286

Are independent posts created via post form and a function.
But the cred generic field is the same used in all the languages. I want to know if there is a way to change the cred generic field database value for all languages.

#1172305

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oriol,

Actually this might be possible but you will need to create the same generic field for each language and add it to the form.

Using the views conditional to display the appropriate one based on the language.

What you need to do is to create a shortcode to get the current language and evaluate this shortcode in conditional to display the appropriate one.

Please let me know if you need some assistance with writing the shortcode.

Thanks,
Shane