
The User methods allow you to access information about the users responsible for the content.
Return a list of all users in Director. This function accepts an options array that can include any of the following parameters.
sort Defines how the users are returned. 'name' returns the users in ascending order by name while 'activity' returns the users in descending order beginning with the user who has uploaded the most content. Defaults to 'name'.
<?php
include('classes/DirectorPHP.php');
$director = new Director('your-api-key', 'your-api-path');
$users = $director->user->all();
foreach($users as $user) {
echo $user->display_name;
}
?>
The scope method is to be called before the all method above, and defines the scope of the users returned. This function accepts an options array that can include any of the following parameters.
model The type of data to use. Either 'gallery' or 'album'. This parameter is required.
id The id of the model.
all Whether to return only users who have created content (false) or any user who has created or updated content (true). This parameter is optional and defaults to false.
<?php
include('classes/DirectorPHP.php');
$director = new Director('your-api-key', 'your-api-path');
# Return only users who have created content in the album with ID = 1
$director->user->scope(array('model' => 'album', 'id' => 1));
$users = $director->user->all();
foreach($users as $user) {
echo $user->display_name;
}
?>