Closed code200 closed 5 years ago
Hi, I see that you can create private boards: // Create a private board $bot->boards->createPrivate('Name', 'Description');
and pass more options in an update: $bot->boards->update($boardId, [ 'name' => 'New title', 'description' => 'New description', 'privacy' => 'secret', 'category' => 'sports', ]);
But I would like to select (get) boards that are NOT secret only.
Can you please tell me where to update this code? Or if this is possible?
Please assign the label for this post as a question.
Thank you.
Hi! There is no need to update the code. Just filter the received boards by privacy
field.
Hello! I would like to adjust the code in a plugin that someone created based on your code. I would only like to pull public boards and randomly pin to one of them. The plugin is pulling all boards (secret too). Basically I don't want to pin to secret boards.
Here's a snippet: $boards = $bot->boards->forMe(); $boards = $boards[array_rand($boards)]; $boardId = $boards['id'];
Any ideas how I can pull (or filter) so my array has only public boards (no secret boards)?
Thanks!
Try this:
$boards = $bot->boards->forMe();
$onlyPublicBoards = array_filter($boards, function (array $board) {
return $board['privacy'] === 'public';
});
I only got to test it once so far but it seems to be working well. Thank you very much!
Hello:
$boards = $bot->boards->forMe(); $boards = $bot->boards->forUser($me_username);
Is it possible to get a list of ONLY public boards (Not secret)?
If so, please share the code. Thanks!