class UserPicture

Same name and namespace in other branches
  1. 11.x core/modules/user/src/Plugin/migrate/source/d6/UserPicture.php \Drupal\user\Plugin\migrate\source\d6\UserPicture

Drupal 6 user picture source from database.

For available configuration keys, refer to the parent classes.

@todo Support default picture?

Plugin annotation


@MigrateSource(
  id = "d6_user_picture",
  source_module = "user"
)

Hierarchy

Expanded class hierarchy of UserPicture

See also

\Drupal\migrate\Plugin\migrate\source\SqlBase

\Drupal\migrate\Plugin\migrate\source\SourcePluginBase

File

core/modules/user/src/Plugin/migrate/source/d6/UserPicture.php, line 22

Namespace

Drupal\user\Plugin\migrate\source\d6
View source
class UserPicture extends DrupalSqlBase {
  
  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->select('users', 'u')
      ->condition('picture', '', '<>')
      ->fields('u', [
      'uid',
      'access',
      'picture',
    ])
      ->orderBy('u.access');
    return $query;
  }
  
  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'uid' => 'Primary Key: Unique user ID.',
      'access' => 'Timestamp for previous time user accessed the site.',
      'picture' => "Path to the user's uploaded picture.",
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['uid']['type'] = 'integer';
    return $ids;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.