0.10.1 should fix I think.
yariplus
Posts
-
New install of 1.19.5 error -
Is it possible to access the user ID via a widget?The logged in user should be
app.user.uid
, if you are visiting a user, the id should beajaxify.data.theirid
Here's a small script for you.
<span id="myid" style="display:none;">My uid: </span> <span id="theirid" style="display:none;">Their uid: </span> <script> if (app.user.uid) { $('#myid').append(app.user.uid) $('#myid').show() } if (ajaxify.data.theirid) { $('#theirid').append(ajaxify.data.theirid) $('#theirid').show() } </script>
-
[nodebb-plugin-category-sort-by-title] Alphabetical topic sorting.Update v1.3.0
- Now compatible with NodeBB 1.5
-
How to use Write API to chat with user in a chat roomKinda got over-excited. Basically, just added a parameter
roomId
to the existing route. If it exists, it posts to the existing room. -
[nodebb-plugin-category-sort-by-title] Alphabetical topic sorting.Updated to latest NodeBB.
Fixed error when editing posts.
-
[nodebb-plugin-featured-topics-extended] Feature Topics in a News/Blog page and Widgets.Updated for 1.15.x/1.16.x LOL
-
[nodebb-plugin-newsletter] Send e-mail newsletters to your users.Version 0.10.0
Scuff update for nodebb 2.x
A bit late, but better than never. -
Saving settings back to the serverThe settings page could a bit of editing, it took me quite a while to understand everything that's happening.
On the server, you load the settings with something like:
var Settings = module.parent.require('./settings'); var mySettings = new Settings('myPlugin', '0.1', defaultSettings, function(){ console.log(mySettings.get('somesetting')); });
This will load the settings from the database into the mySettings object, but will not update them after they change.
To update the the mySettings object, you have to do sync:
mySettings.sync(function () { console.log(mySettings.get('somesetting')); // Updated });
Now on the client, when you do settings.persist(), the new settings are saved to the database, but the mySettings object on the server is not updated, so we need do a socket.emit() to let the server know that it needs to sync the mySettings object.
// Client admin page require(['settings'], function (settings) { var wrapper = $('#my_form_id'); // This loads the data from the database to the DOM. settings.sync('myPlugin', wrapper); $('#save').click(function(event) { event.preventDefault(); // This saves the settings from the DOM to the database. settings.persist('myPlugin', wrapper, function(){ // When we're done saving to the database, send a socket event to server so it can update it's mySettings object with the new values. socket.emit('admin.settings.syncMyPlugin'); }); }); });
// On the server var SocketAdmin = module.parent.require('./socket.io/admin'); // Socket event exposed to the client as 'admin.settings.syncMyPlugin' // It gets called when the client saves new settings to the database. SocketAdmin.settings.syncMyPlugin = function() { mySettings.sync(function () { // The mySettings object is updated, you can now call whatever functions you want to based on the new values. if (mySettings.get('somesetting') === 'justDoIt') doThing(); }); };
-
Login Unsuccessful Your account has been locked temporarilyShould be
db.objects.remove({_key: "lockout:1"})
and also may need
db.objects.remove({_key: "loginAttempts:1"})
-
Adding rewards breaks with rewards-essentials.Having an issue when I add another rewards plugin. Awards are no longer populated after you create the reward and go back to the page. This makes it impossible to edit rewards. It only seems to happen with reward essentials. Adding two rewards plugins and disabling rewards essentials works.
https://github.com/NodeBB/nodebb-rewards-essentials/issues/6
-
[nodebb-plugin-minecraft-integration] Minecraft Integration!v0.3.0 Changes
New Widgets:
Top Players Graph - Shows a Pie chart with top players and their total recorded play time.
Online Players Grid - Displays a player avatar grid, such as the one on the server status widget, but as it's own separate widget.Changes:
Widgets now respect the Widget Title and Widget Container, and will only override them when nothing is specified. Details:
- The Widget Container Will default to the panel + header container when the Container field is empty.
- The Widget Title Will default to the Server Name when the Title field is empty.
- The Server Name will default to "Server X" if none is specified.
The Widget container is now properly aligned with non-Minecraft Essentials widgets.
Changing the plugin settings no longer requires a restart or even a reload!
MOTD now has several options on where and how to display it.
Now works with 0.5.7 to 0.6.1 using MongoDB. (Should be compatible with any database now, as it uses Settings module for everything and never calls the database directly.)
No longer attempts to query a server if its ping fails.
Configurable ping delay. (Recommend one minute.)
COLORS! You can change colors for most widgets.
Avatar Borders. Select any type of border with a solid color or gradient.
Default settings for new installs should be fixed so as not to crash if the server not at localhost.
Default settings are more intelligent overall, such as not using the default port for queries if a non-default port is selected for pinging.
Most debug icons were removed. They will be returning in the future, but the current implementation was mostly useless.
ACP pages are more mobile-friendly.
Charts and tables now occupy the entire widget container.
Avatar Size can be adjusted.Experimental Stuff:
Added a widget preview pane.
Added Avatar CDN selection. (Only cravater currently works 100%) -
How can I make my own plugin which has a setting page?Two things. You need to add the route and controller for that url, and you need to add a link to the admin header.
Look at nodebb-plugin-quickstart
Add the routes in the load hook. The controller function is defined here, here is also where you render the template and can add additional data if you wish.
Use the hook
filter:admin.header.build
to add a link to the admin header. Like shown here. -
How can i update my persona themeHello, the package info for nodebb uses a specific version of persona, meaning NPM will not update it for you, nor will nodebb start if you manually download an updated version. This is likely because breaking changes occur often in the theme, and preventing manual updates prevents breaking your forum.
If you think your persona is outdated, updating nodebb itself will update persona to the latest recommended version.
-
Grabbing multiple database objectsI'll take a stab at this.
Since Redis isn't relational, you'll need to mimic relational behaviour by creating additional database entries. In theory, you'll want to avoid doing this as much as possible since it involves creating lots of duplicate data.
First, store your hashes (objects) like below, with the last word being the object's 'primary key'.
plugin:market:product:apple
plugin:market:product:orange
Next, to mimic a relationship, create a
sorted set
where the values are your 'primary keys' and the scores are your 'secondary keys'plugin:market:products:cost
Now, if you want to find all objects that have a certain cost, you can search this set ByScore and retrieve an array of the keys to the objects you want.
Example:
var db = module.parent.require('./database'); var async = require('async'); // Create the entries. async.waterfall([ async.apply(db.setObject, 'plugin:market:product:apple', {name: 'Red Apple', cost: 10}), async.apply(db.setObject, 'plugin:market:product:orange', {name: 'Orange Orange', cost: 5}), async.apply(db.sortedSetAdd, 'plugin:market:products:cost', 10, 'apple'), async.apply(db.sortedSetAdd, 'plugin:market:products:cost', 5, 'orange') ], function () { // Find the product key with a cost between 6-10 inclusive. db.getSortedSetRangeByScore('plugin:market:products:cost', 0, 1, 6, 10, function (err, result) { // Assuming no errors, result should be: ['apple'] // Now get the hash. db.getObject('plugin:market:product:' + result[0], function (err, product) { // Should print: 'Red Apple' console.log(product.name); }); }); });
Is it safe to just make an array of objects in a hash such as plugin:market:products and when I need to access it, grab the array parse it, remove/edit whatever data I need, and update the hash with the new array? Or would that be unsafe (Unsure how database calls are processed within NodeBB).
No. Don't do it. Only store regular strings in hashes. Although you can do what you say by stringifying and parsing json, you're asking for trouble.
-
How can I use lodash inside my plugin client side script?That's close. You would actually just put it in your define call.
define('forum/client/plugins/my-plugin', ['lodash'], function (_) { var Edit = {}; Edit.init = function () { // an exemple code from lodash usage var test = _.map([4, 8], function(n) { return n * n; }); console.log(test); }; return Edit; });
Assuming
'lodash'
is a url to lodash.js -
Can forum users aka members change text color in their replies aka comments and posts?It will always be black.
You need to add a plugin if you want to have colors.
-
[nodebb-plugin-camo] Make embedded images look secure!Installing Camo Standalone
Camo can be run as a standalone app if you would like run it on a another server or want more control, such as clustering.
See this guide for setup instructions.
https://community.nodebb.org/topic/8298/secure-images-for-nodebb-with-external-camoThen, uncheck the
Use internal Camo server
box and fill in the other fields. -
Importing tpl inside another tplThanks. That's actually more of a hack though, because you will doing two requests per page load.
Although that will work, I think the better solution is more complex.
You'll want to hook into the controller filter for the page in which you want the additional template, and append the new data for rendering. If you are importing a template that has any variables with the same name in the base template, you'll need to create a new template that has the additional data namespaced.
e.g.
your library.js
var Theme = module.exports = {}; var topics = require.main.require('./src/topics'); // filter:topic.build Theme.topicBuild = function(data, next){ topics.getTopicsFromSet('topics:recent', data.req.uid, 0, 5, function(err, recentData) { data.templateData.recent = recentData; next(null, data); }); };
add to your topics.tpl
<!-- IMPORT recentembed.tpl -->
in recentembed.tpl, copy recent.tpl but prefix the variables with your
recent
namespace<!-- BEGIN recent.topics --> {recent.topics.title} <!-- END recent.topics -->
There may be a way to explicitly declare the namespace too that I'm not aware of, something like
<!-- IMPORT recent.tpl USING recent -->
which would eliminate the need for an additional template if it exists. -
[nodebb-plugin-forms] Request for feedbackCould I get some opinions on this so far? or some people to try it out?
Most everything is drag and drop (I'll be adding a non-drag and drop mode), all of the standard inputs work and are fully editable. Still working on the html5 inputs. Most inputs can be edited in-place or via the modal dialog by clicking the green cog. Whatever you enter/select on the actual input will be the default value, which you can clear by clicking the pink eraser. The white checkbox requires the input, the blue files clone it, and the X deletes.
The live forms are viewable at the url forms/ID or parsed into a post. There's no backend, so if you submit a forum it should just reply with an empty page with the results.
I haven't pushed it to npm, so pull it from github to try it out.
https://github.com/pitaj/nodebb-plugin-forms -
How to use nodebb websocket with cdn which doesn't support websocket?You could just turn websockets to polling mode only, in your
config.json
file.https://nodebb.readthedocs.io/en/latest/configuring/config.html
It should look something like this:
{ ... "socket.io": { "transports": ["polling"] }, ... }
Performance for your users should remain mostly the same.