Skip Navigation

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 6 replies, has 2 voices.

Last updated by Christopher Amirian 1 year ago.

Assisted by: Christopher Amirian.

Author Posts
May 8, 2024 at 9:50 am #15605247

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!

job_url.jpg
May 8, 2024 at 4:57 pm #15607445

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.

May 8, 2024 at 5:35 pm #15607491

krisztianK-4

I mean customer = my client who has administrator user role.
I'd like to offer a direct link without admin bar.

May 8, 2024 at 6:36 pm #15607590

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

May 8, 2024 at 8:05 pm #15607784

krisztianK-4

I attached an image where I'm so far.
I don't know how to get the missing piece $job_id.

job_id.jpg
May 8, 2024 at 9:07 pm #15607847

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 . '');

}
}

my_solution.jpg
May 11, 2024 at 5:22 pm #15617141

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.