Some quick questions on plugin development

General Discussion
  • Quick questions:

    1. In plugin code, what global variables or utility function can get the version of NodeBB, and the main URL of forum, without manually reading config.json?
    2. Can I get raw express request, response object in standard plugin hook "post:parse"?
    3. Plugin hook "post:parse" happened in editor page and topic view page, can I only get "post:parse" worked only on topic view page, how to differentiate it?
    1. var meta = module.parent.require('./meta');. Then, meta.config may have the configuration (might need to double-check that). var nconf = module.parent.require('nconf'); will allow you to hook into the configuration utility we use: nconf.get('url') returns the full url.
    2. Unfortunately not -- our hooks are designed to keep the information passed in to a minimum.
    3. The posts.parse hook is called whenever a piece of content needs to be "parsed like a post". It is not strictly a hook that is called whenever a topic is loaded. Perhaps you can look into filter:post.getPosts?

Suggested Topics