Making WordPress.org

Changeset 10357


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

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

See #5471.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/translation-row-editor.php

    r9814 r10357  
    206206                                                                </div>
    207207                                                        <?php elseif ( is_user_logged_in() ) : ?>
    208                                                                 You are not allowed to edit this translation.
     208                                                                <?php echo apply_filters( 'wporg_translate_cannot_edit_translation_hint', '<p class="info">Sorry, you are not allowed to edit this translation.</p>', $translation ); ?>
    209209                                                        <?php else : ?>
    210210                                                                <p class="info">
    … …  
    221221
    222222                                        <?php
    223                                         if ( has_action( 'wporg_translate_suggestions' ) ) {
     223                                        if ( $can_edit && has_action( 'wporg_translate_suggestions' ) ) {
    224224                                                ?>
    225225                                                <div class="suggestions-wrapper">
  • 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.