 krisztianK-4
|
I'm trying to get the job edit url by a function.
I'd like to provide this link for customer without the admin bar.
Thanks in advance for your help!
|
 Christopher Amirian
WPML Supporter since 07/2020
Languages:
English (English )
Timezone:
Asia/Yerevan (GMT+04:00)
|
Hi there,
It is not possible to do so. You can consider making the customer as a reviewer:
https://wpml.org/documentation/reviewers/how-to-work-as-a-reviewer/
The reviewer still needs to at least have the EDIT user role to be able to work on a translation.
Thanks.
|
 krisztianK-4
|
I mean customer = my client who has administrator user role.
I'd like to offer a direct link without admin bar.
|
 krisztianK-4
|
Is there a hook or function to get this by a job id? I didn't find yet.
admin.php?page=tm/menu/translations-queue.php&return_url&lang=en&job_id=68
|
 krisztianK-4
|
I attached an image where I'm so far.
I don't know how to get the missing piece $job_id.
|
 krisztianK-4
|
Here is my solution, if you can further increase the code for more stable version I'm happy to hear that. : )
// ? Is WPML active
if (function_exists('icl_object_id')) {
// Basics
$post_id = get_the_ID();
$post_type = get_post_type($post_id);
// Element type
$type = apply_filters('wpml_element_type', $post_type);
// Translation Group ID
$trid = apply_filters('wpml_element_trid', false, $post_id, $type);
// Current lang
$current_lang = apply_filters('wpml_current_language', NULL);
// Is translated
$is_translated = apply_filters('wpml_element_has_translations', NULL, $trid, get_post_type($trid));
if ('en' === $current_lang && true === $is_translated) {
// Job ID
$jobs = new Jobs;
$job_id = $jobs->getTridJob($trid, 'en')->job_id;
// Edit Url
$edit_url = admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/translations-queue.php&return_url=' . get_the_permalink($trid) . '?lang=en&referer=ate&lang=en&job_id=' . $job_id . '');
}
}
|
 Christopher Amirian
WPML Supporter since 07/2020
Languages:
English (English )
Timezone:
Asia/Yerevan (GMT+04:00)
|
Hi there,
Thank you for sharing the solution. I do not have anything to add to the code if it is a working solution.
Thanks.
|