• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

[solved] Plugin not work

Scheduled Pinned Locked Moved NodeBB Plugins
3 Posts 2 Posters 1.3k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sergej-saveljevS Offline
    sergej-saveljevS Offline
    Cергей Савельев Plugin & Theme Dev
    wrote on last edited by sergej-saveljev
    #1

    I use NodeBB v0.7.0dev
    plugin.json:

    {
        "id": "nodebb-plugin-test",
        "name": "Plugin name",
        "url": "url to github",
        "library": "./index.js",
        "hooks": [
            {
                "hook": "filter:post.parse"
                , "method": "parse"
                , "callbacked": true
            }
        ]
    }
    

    index.js:

    (function(Preparsed) {
    'use strict'
    
    var async = module.parent.require('async'),
    	db = module.parent.require('./database');
    
    Preparsed.parse = function(postContent, callback) {
        postContent = postContent.replace(/123/g, "check")
        callback(null, postContent)
    }
    
    }(module.exports))
    

    package.json:

    {
      "name": "nodebb-plugin-test",
      "version": "1.0.0",
      "description": "Description plugin",
      "main": "index.js",
      "author": "I'm <[email protected]>",
      "license": "MIT",
      "dependencies": {
        "express": "^4.12.0",
        "passport-http-bearer": "^1.0.1"
      },
      "nbbpm": {
        "compatibility": "^0.6.0"
      }
    }
    

    I create topic. Topic name: 123123123, Content: 123 123 123
    123 should be replaced by check, but nothing happens.

    Please, tell me, what is wrong?

    1 Reply Last reply
    0
  • frissdiegurkeF Offline
    frissdiegurkeF Offline
    frissdiegurke Plugin & Theme Dev
    wrote on last edited by
    #2

    it's filter:parse.post, not filter:post.parse

    1 Reply Last reply
    1
  • sergej-saveljevS Offline
    sergej-saveljevS Offline
    Cергей Савельев Plugin & Theme Dev
    wrote on last edited by
    #3

    All is well! I helped @psychobunny https://github.com/NodeBB/NodeBB/issues/2869#event-255546006

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development