phppodio

How to apply Rich Text formatting in Podio comments while adding comments through comments API


I want to apply rich-text formatting (Markdown language) on comments which added through Podio-Comments API. I've added but it didn't work for me. How can I do that?

<?php

error_reporting(0);

require_once 'config.php';
include 'podio_api.php';
echo "START";

// Podio authentication 
podioAuthentication();
if (Podio::is_authenticated()) {
    $ref_type = "item";
    $ref_id = 603929471;
    $response = PodioComment::get_for($ref_type, $ref_id);

    $comments = '';
    foreach ($response as $object) {
        $comment = $object->value;
        $date = $object->created_on;
        $created_on = $date->format('Y-m-d H:i:s');

        // Add comment
        $comments .= "*[Created_On]* $created_on   <br /> **[Comment]** $comment   <br />";
    }
    $ref_id = 649113086;
    $attributes = ['alert_invite' => FALSE,
        'hook' => FALSE,
        'silent' => FALSE,
        'value' => $comments
    ];
    $comment_add = PodioComment::create($ref_type, $ref_id, $attributes);
    var_dump($comment_add);
    echo "DONE";
} else {
    echo "authentication error";
}

Solution

  • Formatting works when we leave a space before and after of a special charector, In this comment developer have to add space before & after * or \n then it would must work.

    $comments .= " **[Created_On]** $created_on \n **[Comment]** $comment \n ";