Skip to content

General Discussion

A place to talk about whatever you want

3.8k Topics 23.3k Posts
  • How can I assign variable in .tpl?

    7
    0 Votes
    7 Posts
    314 Views
    G

    @PitaJ Thank you for reply.

  • Complex: having API call within widget

    16
    0 Votes
    16 Posts
    559 Views
    PitaJP

    Benchpress/templates.js has always used a single { to wrap variable substitution.

    I agree before is not commonly used, but using { is an industry standard for format strings and templates.

    Not sure what documents you read about escaping, it appears I don't actually have that documented. But to escape you should be able to add a single backslash before the opening {:

    if (something) \{ stuff() }

    But even just putting a semicolon in there should work

    if (something) { stuff(); }
  • 0 Votes
    12 Posts
    2k Views
    M

    @Nuran-Akimbek said in TypeError: Cannot read properties of undefined (reading 'split'):

    Hi, a have a same error (Cannot read properties of undefined (reading 'split')) on my forum. Please, write final solution have you solve it

    I solved it by doing a

    ./nodebb restart
  • 0 Votes
    6 Posts
    284 Views
    G

    @josef I got it, thanks.

  • startup nodebb after server reboot

    Solved
    7
    0 Votes
    7 Posts
    304 Views
    julianJ

    @陈洁 wow, that is definitely a power user setup!

    One thing I have struggled with is proper logging with systemd. At some point it seemed to stop emitting logs properly, and I could only either have logs sent to the journal for viewing with journalctl, or output to the regular log file at logs/output.log, not both. 🤷

    Regardless, @josef I'm glad you got it working 😄

  • Where to store persistent widget variable?

    2
    0 Votes
    2 Posts
    156 Views
    barisB

    For a counter like that you would need to create a custom widget that stores the counter in the database and increase it by 1 on the server side as well whenever the user renders it or performs whatever the action is. You can make custom socket.io events or create a new API route.

    Incrementing the value in the database is a simple db call like await db.incrObjectField('myCustomWidget', 'counter');

  • Change in "reply to xxxx" text

    9
    0 Votes
    9 Posts
    456 Views
    barisB

    Did you set the username field of all users to an email in the database? If that's the case and the old username isn't stored anywhere you can't bring it back. If you are just using a hook to set username to email then you can disable that code and username should go back to normal.

    The displayname property is calculated from user.fullname and user.username based on the user setting show my fullname and if they have entered a fullname in their edit profile page.

  • Gap in categories

    5
    0 Votes
    5 Posts
    199 Views
    D

    Yeah, all the same 🙂 Have just resized them though and all seems ok now. Thanks all.

  • 0 Votes
    11 Posts
    542 Views
    julianJ

    @eeeee Cool! We both learned something new today.

  • Nodebb API development history

    10
    0 Votes
    10 Posts
    482 Views
    julianJ

    @eeeee re: auto upgrade button

    We don't implement this because of the customizable nature of NodeBB. It is possible that if someone had a lot of plugins and they upgraded to a version that was incompatible, NodeBB might go down and not come back up.

    So it'd be like a "shoot yourself in the foot" button 😆

  • New admin panel

    5
    4 Votes
    5 Posts
    335 Views
    julianJ

    Hey, you guys were supposed to be teased about this coming up, but then I got busy and didn't finish writing the post...

    Then @baris finished the refresh 😆

  • Custom javascript, why is it not running?

    10
    0 Votes
    10 Posts
    404 Views
    julianJ

    @phenomlab Doesn't hurt.

    If you execute .ready() and the page is already ready, then it will just fire the callback immediately.

  • 0 Votes
    8 Posts
    358 Views
    vijay kumavatV

    I am trying to add this code in custom plugin file => library.js file

    For every reply should add reputation point in Topic author.

    'use strict'; var Topics = require.main.require('./src/topics'); var User = require.main.require('./src/user'); var meta = require.main.require('./src/meta'); var reputationPoints = 1; // Number of reputation points to award per reply var plugin = {}; plugin.postReply = async function (payload) { var tid = payload.topic.tid; var topic = await Topics.getTopicFields(tid, ['uid']); await User.incrementUserReputationBy(topic.uid, reputationPoints); // Increase reputation points by the specified amount }; module.exports = plugin;

    But no luck.. 😞

  • 0 Votes
    4 Posts
    200 Views
    barisB

    Publish your plugin to npm then install it with npm install nodebb-plugin-posters then it shouldn't get removed.

  • Best solution to this

    3
    0 Votes
    3 Posts
    247 Views
    carlm7C

    @baris said in Best solution to this:

    You need something like https://github.com/NodeBB-Community/nodebb-plugin-assign-newuser-to-group, maybe fork and modify that to your needs.

    Thanks a lot. I wish I could modify it but unfortunately, I can't.

    Maybe someone else will see a need for the same feature.

  • use fullname rather than using username

    2
    0 Votes
    2 Posts
    127 Views
    phenomlabP

    @vijay-kumavat This is set in two places. The first is /admin/settings/user

    4d836a36-d35e-412f-80fd-6e34b1727483-image.png

    The other is in /user/theuser/settings

    abf184f4-7cde-412d-ac67-912d9f796bab-image.png

    I'm certain that the user settings override what is in the site (but I may be wrong). However, you can use the admin level to set it for everyone, but it can be overridden.

  • Where is html file?

    8
    0 Votes
    8 Posts
    343 Views
    G

    @baris Thank you so much

  • "who" heas read a thread

    6
    0 Votes
    6 Posts
    417 Views
    q16marvinQ

    @baris i take your plugin "browsing-users" and create a new one "who-read-it". I hope it is okay for you 🐞

    currently it looks like this:

    5cde4deb-ef7d-46f6-ba70-04b7d340522d-grafik.png

    the timestamp i like to have in the tooltip behind the username, but i dont know who, maybe you have a idea?

    <div component="topic/who-read-it" class="d-flex gap-1"> <i class="fa fa-check fa-fw" title="Who Read It"></i> <br> {{{ each whoreadit }}} <div data-uid="{./uid}"> <a class="text-decoration-none" href="{{{ if ./userslug }}}{config.relative_path}/user/{./userslug}{{{ else }}}#{{{ end }}}"> {buildAvatar(whoreadit, "24px", true, "avatar-tooltip","title=test")}{./readtimestamp} </a> </div> {{{ end }}} </div>
  • Emoji issue

    9
    0 Votes
    9 Posts
    529 Views
    vijay kumavatV

    @PitaJ ,

    Its working now. Thank you

    I select "Parse emojis in topic tiles" from Admin of Emoji setting page.
    Then click on -> Build Emoji Assets -> then Save -> then Rebuild & Restart.

  • NodeBB Versioning Protocol?

    5
    0 Votes
    5 Posts
    296 Views
    barisB

    We try to keep master branch stable and release patch versions from there, for example 3.1.6. Develop branch is for the next minor release (3.2.0) and contains new features. Major versions contain breaking changes ie 4.x