[ 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( array( 'object_type' => 'translation-set', 'action' => 'approve' ) );
   7          foreach( $permissions as $permission ) {
   8              $set = GP::$translation_set->get( $permission->object_id );
   9              $project = GP::$project->get( $set->project_id );
  10              GP::$permission->create( array(
  11                  'user_id' => $permission->user_id,
  12                  'action' => 'approve',
  13                  'object_type' => 'project|locale|set-slug',
  14                  'object_id' => $project->id.'|'.$set->locale.'|'.$set->slug,
  15              ) );
  16          }
  17      }
  18  }


Generated: Wed Nov 20 01:01:59 2019 Cross-referenced by PHPXref 0.7.1