cdaguerre / php-trello-api

A simple Object Oriented wrapper for the Trello API, written in PHP5.
http://cdaguerre.github.io/php-trello-api
MIT License
254 stars 120 forks source link

Can't add a member to board #43

Open Phantomea opened 8 years ago

Phantomea commented 8 years ago

Hello I have and issue with adding new member to board.

I can get board which I want, can use i.e. ->setLabelNames() but can't use setMemberships();

Is this function "that" function what I need to add new member to the board?

I used exactly this code $currentBoard->setMemberships([ 'idMembership' => 'id of member', 'type' => 'normal' ])->save();

Please help me :( I really need it to finish my work.

Phantomea commented 7 years ago

Oukey, I'm gonna answer myself, hope someone will need to use this and it will be useful.

This is how I did it:

  1. I get all my boards. $boards = $client->members()->boards()->all('me');
  2. By foreach loop I found the board I wanted foreach($boards as $board)
  3. Then I invited a user by his trello email: $client->boards()->members()->invite($board['id'], 'email of trello user', 'Full name of the person');