# give/4.16.9/src/TestData/Framework/Provider/RandomAuthor.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 23 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/TestData/Framework/Provider/RandomAuthor.php
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/TestData/Framework/Provider/RandomAuthor.php
- Modified: 2021-11-23T23:55:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.9/code/src/TestData/Framework/Provider/RandomAuthor.php#L10-L20`.

```php
<?php

namespace Give\TestData\Framework\Provider;

/**
 * Returns a random Author ID from the users table.
 */
class RandomAuthor extends RandomProvider
{

    public function __invoke()
    {
        $authorIDs = get_users(
            [
                'fields' => 'ID',
                'role__in' => ['administrator', 'editor', 'author'],
            ]
        );

        return $this->faker->randomElement($authorIDs);
    }
}

```
