Changeset 3732047 for langforge/trunk/includes/class-rest-api.php
- Timestamp:
- 10/07/2026 07:51:21 AM (3 weeks ago)
- File:
-
- 1 edited
-
langforge/trunk/includes/class-rest-api.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
langforge/trunk/includes/class-rest-api.php
r3628343 r3732047 179 179 'title' => $trans_post->post_title, 180 180 'status' => $trans_post->post_status, 181 'edit_link' => get_edit_post_link($trans_id, 'raw'), 181 // '' (never null) when the user has no edit screen for it: the sidebar prints no Edit link then. 182 'edit_link' => LANGFORGE_Post_Translation::edit_url($trans_id, 'raw'), 182 183 'permalink' => get_permalink($trans_id), 183 184 ]; … … 359 360 // Only expose translations the requester may read, so a public post's 360 361 // REST entry doesn't leak draft/private translation topology. 362 // A member whose post type WordPress does not know (the plugin that registered it is 363 // deactivated, or it registers later than this request asks) is left out without being 364 // asked about: current_user_can('read_post') for such a post is a _doing_it_wrong in 365 // map_meta_cap and judged by another capability. No type, no right to read. 366 $pt = LANGFORGE_Post_Translation::instance(); 361 367 $visible = []; 362 368 foreach ($translations as $lang => $tid) { 363 if ( current_user_can('read_post', (int) $tid)) {369 if ($pt->translation_type_is_registered((int) $tid) && current_user_can('read_post', (int) $tid)) { 364 370 $visible[$lang] = $tid; 365 371 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)