4 followers Follow

How to Add a Comment

Ive been at this for too long with no success ... hence the messy code ...

Im trying to add a comment to the item with "ref_id" produced from the below code of an item creation:


return $item; <<------ Products my ref_id

my code for adding:

function createComment($refid,$comment,$emailFrom,$vbDate)

$comment = new PodioComment('item',$refid,array('value'=> $emailFrom.' wrote on '.$vbdate.':'.ltrim($comment,400)));


Im definitely doing something wrong..this is the last part of my code i cant get right..


Albert Bunick Answered

Please sign in to leave a comment.



PodioComment objects does not currently have a save method, so you have to use the static method for sending values to the API. Merely creating an object does not send any data to the API. Some details around making API requests:

To create a comment:

PodioComment::create('item', $item_id, array('value'=> $emailFrom.' wrote on '.$vbdate.':'.ltrim($comment,400)));
Andreas Haugstrup Pedersen 0 votes

Using that method i got the following error.

Fatal error: Uncaught PodioForbiddenError: "The user with id #### does not have the right comment on item with id 173019127" Request URL: Stack Trace: #0 /home/public_html/podiophp/lib/Podio.php(293): Podio::request('POST', '/comment/item/1...', Array, Array) #1 /home/public_html/podiophp/models/PodioComment.php(52): Podio::post('/comment/item/1...', Array) #2 /home/public_html/podiophp/emailtoticket.php(94): PodioComment::create('item', '173019127', Array) #3 /home/public_html/podiophp/emailtoticket.php(33): createComment('######', 'Yes i will be w...', '*@*...', '2014-07-06 12:0...') #4 {main} thrown in /home/public_html/podiophp/lib/Podio.php on line 260

Albert Bunick 0 votes

As the error message suggests, the entity you are authenticating as does now have rights to add a comment on that item. Most likely because comments are disabled for that app or you are authenticating as a user who is not a member of the workspace the app resides in.

Andreas Haugstrup Pedersen 0 votes