[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/cli/ -> upgrade-set-permissions.php (source)

   1  <?php
   2  
   3  class GP_CLI_Upgrade_Set_Permissions extends WP_CLI_Command {
   4  
   5  	public function __invoke() {
   6          $permissions = GP::$permission->find_many(
   7              array(
   8                  'object_type' => 'translation-set',
   9                  'action'      => 'approve',
  10              )
  11          );
  12          foreach ( $permissions as $permission ) {
  13              $set     = GP::$translation_set->get( $permission->object_id );
  14              $project = GP::$project->get( $set->project_id );
  15              GP::$permission->create(
  16                  array(
  17                      'user_id'     => $permission->user_id,
  18                      'action'      => 'approve',
  19                      'object_type' => 'project|locale|set-slug',
  20                      'object_id'   => $project->id . '|' . $set->locale . '|' . $set->slug,
  21                  )
  22              );
  23          }
  24      }
  25  }


Generated: Thu Nov 21 01:01:07 2024 Cross-referenced by PHPXref 0.7.1