Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by jin woo 5 years, 9 months ago.

Assigned support staff: Andrey.

Author Posts
January 29, 2014 at 3:17 am #329380

jin woo

We have roles and role names are in English...

We have some functions and if conditions are with the role names (in English)
like this...


// get a role of current user.
function theme_user_roles() {
	$current_user = wp_get_current_user();
	$user = new WP_User($current_user->id);
	if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
		foreach ( $user->roles as $role )
		echo kcm_translate_role($role);					
	}			
}



//If condition
if ($roles=="doctor") {   // role names has to be in original language only...
....................
}

But there is a problem in other languages.
in other languages, roles name gets translated names. so it's not working with this IF condition.
we want to keep it as English (default ones).

Is there any function, class to get original names (English)?

Is this for what we are looking for?

echo icl_t('theme_fr', '100c32289a98a4a064946ade8f08d7cf', 'Doctor');

ex) icl_get_original_name('our-themes-context', $roles, 'en');....

something like this..

Thanks,

January 29, 2014 at 3:45 am #329385

jin woo

I just found the solution. to get roles name is in English from wp table. and it's working now. I missed a part.

But I still want to know if there is that function or not for the future.

If not, I will close my question.

Thanks for all ur time.

January 29, 2014 at 11:33 am #329648

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

Dear jin woo ,

There is no function for that, basically it's custom work with using WPML Coding API. Glad to hear that your solution works.
http://wpml.org/documentation/support/wpml-coding-api/

Thanks,
Andrey

February 13, 2014 at 1:38 am #338744

jin woo

Thanks Andrey, you rock!