# Multiple authors on a single post

**URL:** <https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892>\
**Category:** Questions\
**Tags:** v2\
**Created:** [April 18, 2016, 1:43am UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892 "2016-04-18T01:43:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![invasoria](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/invasoria/32/10898_2.png) [@invasoria](https://forum.getkirby.com/u/invasoria)\
**Post date:** [April 18, 2016, 1:43am UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/1 "2016-04-18T01:43:55Z")

</div>

Hello,

What is the best way to achieve this?

I’ve been trying to implement this with @distantnative’s **Multi Select** ([https://github.com/distantnative/multiselect](https://github.com/distantnative/multiselect)) by making an “authors-api” template to collect all users and return them as a JSON object for the field to work with but I’m stuck while trying to build the JSON.

The **$site-\>users()** variable returns a collection with only linebreaks such as:

`admin<br />user1<br />user2`

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 18, 2016, 5:48am UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/2 "2016-04-18T05:48:23Z")

</div>

`$site->users()->toJson()` should create the JSON array you need … [https://getkirby.com/docs/cheatsheet/users/to-json](https://getkirby.com/docs/cheatsheet/users/to-json)

---

<div class="post-metadata">

**Author:** ![invasoria](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/invasoria/32/10898_2.png) [@invasoria](https://forum.getkirby.com/u/invasoria)\
**Post date:** [April 19, 2016, 12:25am UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/4 "2016-04-19T00:25:34Z")

</div>

> [@texnixe](#):
>
> $site-\>users()-\>toJson() should create the JSON array you need … [$users-\>toJson() | Kirby CMS](https://getkirby.com/docs/cheatsheet/users/to-json)

Thank you! I tried that one before but kept getting errors. I ended up populating an array by myself, like this:

```
<?php
header('Content-type: application/json; charset=utf-8');

$data = kirby()->site()->users()->toArray();
$json = array();
foreach($data as $username) {
	$json[$username->username()] = $username->username();
}
echo json_encode($json);
?>

```

Forgot I had to see each user as an object. It must have been very late…

---

<div class="post-metadata">

**Author:** ![invasoria](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/invasoria/32/10898_2.png) [@invasoria](https://forum.getkirby.com/u/invasoria)\
**Post date:** [April 19, 2016, 12:30am UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/5 "2016-04-19T00:30:34Z")

</div>

Hi Roy. Wanted to try your field just for kicks but it didn’t seem to work:

 ![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/8/8472a4a98b56741eaac61e65c48a874af6ac80c9.jpg)

---

<div class="post-metadata">

**Author:** ![daybugging](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@daybugging](https://forum.getkirby.com/u/daybugging)\
**Post date:** [February 26, 2017, 9:13am UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/7 "2017-02-26T09:13:57Z")

</div>

Hey @invasoria, whats the solution you have come up with?

---

<div class="post-metadata">

**Author:** ![invasoria](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/invasoria/32/10898_2.png) [@invasoria](https://forum.getkirby.com/u/invasoria)\
**Post date:** [March 26, 2017, 10:17pm UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/8 "2017-03-26T22:17:58Z")

</div>

I remotely created a JSON output with the users array code I mentioned earlier in this thread ([Multiple authors on a single post](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/3)). That way I fetched each user and populated the Multiselect box, through the JSON API function.

Take a look at the **Dynamic options via JSON API** section:  
[https://getkirby.com/docs/cheatsheet/panel-fields/select](https://getkirby.com/docs/cheatsheet/panel-fields/select)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 26, 2017, 10:21pm UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/9 "2017-03-26T22:21:13Z")

</div>

The [Controlled List plugin](https://github.com/rasteiner/controlledlist) might be an alternative to using the JSON Query API

---

<div class="post-metadata">

**Author:** ![invasoria](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/invasoria/32/10898_2.png) [@invasoria](https://forum.getkirby.com/u/invasoria)\
**Post date:** [March 26, 2017, 10:26pm UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/10 "2017-03-26T22:26:56Z")

</div>

Yes! I was just looking at that plugin and was going to edit this post. As always, faster than lightning Sonja! 😄

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:50pm UTC](https://forum.getkirby.com/t/multiple-authors-on-a-single-post/3892/11 "2025-02-06T16:50:19Z")

</div>


