
The User methods allow you to access information about the users responsible for the content.
Return a list of all users in Director. The optional sort parameter 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.
<?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. It takes three parameters:
model The type of data to use. Either 'gallery' or 'album'.
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('album', 1);
$users = $director->user->all();
foreach($users as $user) {
echo $user->display_name;
}
?>
