Skip to content

createPost not working  #17

Description

@singhsurma

Thanks for nice work! I see your comments that below is not working:

/**
     * createPost
     *
     * NOT WORKING YET
     *
     * @param $bodyText
     * @param $topicId
     * @param $userName
     * @return \stdClass
     */
    public function createPost($bodyText, $topicId, $userName)
    {
        $params = [
          'raw'       => $bodyText,
          'archetype' => 'regular',
          'topic_id'  => $topicId
        ];

        return $this->_postRequest('/posts', [$params], $userName);
    }

I have written short function by using that below function we can reply to any Topic :

public function modified_createPost( $userName, $topicId, $post_number, $bodyText)
  {
    $params = [
      'username'  => $userName,
      'topic_id'  => $topicId,
      'post_number' => $post_number,
       'raw'       => $bodyText,
      'archetype' => 'regular'

    ];

    return $this->_postRequest('/posts', [$params], $userName);
  }

To debug parameters used we can see like : http://DISCOURSE_SITE_URL/t/TOPIC_ID.json for example in my case its : http://localhost:3000//t/14.json

screen shot 2018-06-14 at 2 24 03 pm

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions