Making WordPress.org


Ignore:
Timestamp:
10/11/2020 03:40:09 PM (4 years ago)
Author:
ocean90
Message:

Translate: Don't show suggestions if user cannot add/edit translations.

See #5471.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-suggestions/inc/class-plugin.php

    r9559 r10357  
    105105     */
    106106    public function pre_tmpl_load( $template, $args ) {
    107         if ( 'translations' !== $template || ! is_user_logged_in() ) {
     107        if ( 'translations' !== $template || ! isset( $args['translation_set']->id ) || ! GP::$permission->current_user_can( 'edit', 'translation-set', $args['translation_set']->id ) ) {
    108108            return;
    109109        }
     
    143143     */
    144144    public function extend_translation_suggestions( $entry ) {
    145         if ( ! is_user_logged_in() ) {
     145        if ( ! isset( $entry->translation_set_id ) || ! GP::$permission->current_user_can( 'edit', 'translation-set', $entry->translation_set_id ) ) {
    146146            return;
    147147        }
Note: See TracChangeset for help on using the changeset viewer.