@baris Done Bro
vijay kumavat
Posts
-
Vote for NodeBB -
In nodeBB how to display last five participants avatar in topic list pageHi,
In nodeBB how to display last / most five participants avatar in topic list page. Is their any plugin for this ?
For example :-
-
In nodeBB how to display last five participants avatar in topic list pageHi Baris,
thank you for sharing code...I add this using create custom plugin nodebb-plugin-posters in directory "..\NodeBB\node_modules\nodebb-plugin-posters", and then create two new files plugin.json , and index.js
in plugin.json -
{ "id": "nodebb-plugin-posters", "name": "Posters", "description": "This is the custom plugin designed for display top most 5 active users poster / avatar will be display in the topic list column.", "url": "https://github.com/NodeBB/nodebb-plugin-posters", "library": "./library.js", "hooks": [ { "hook": "filter:topics.get", "method": "filterTopics" } ] }
And in index.js
/** * You can run these tests by executing `npx mocha test/plugins-installed.js` * from the NodeBB root folder. The regular test runner will also run these * tests. * * Keep in mind tests do not activate all plugins, so if you are testing * hook listeners, socket.io, or mounted routes, you will need to add your * plugin to `config.json`, e.g. * * { * "test_plugins": [ * "nodebb-plugin-posters" * ] * } */ "use strict"; const Plugin = {}; myPlugin.filterTopicsGet = async (hookData) => { // get the posters of the topics const keys = hookData.topics.map(t => `tid:${t.tid}:posters`); const posters = await db.getSortedSetsMembers(keys); // get the uniq uids const uniqUids = _.uniq(_.flatten(posters)); // load the data for the uniq uids const userData = await users.getUsersFields(uniqUids, ['username', 'userslug', 'picture']); const uidToUserData = _.zipObject(uniqUids, userData); // set the 'posters' field on each topic hookData.topics.forEach((t, index) => { const posterUids = posters[index].reverse().slice(0, 4); t.posters = posterUids.map(uid => uidToUserData[uid]); }); return hookData; };
and for front end topic-list.tpl
<div class="col-md-2 content"> <ul> {topic.posters.forEach(function(poster) { <li> <a href="{config.relative_path}/user/{poster.username}"> <img src="{poster.picture}" alt="{poster.username}" /> {poster.username} </a> ({poster.postCount} posts) </li> })} </ul> </div>
Din't get result as expected .
Could you please guide me where i made mistakes ?
-
In nodeBB how to display last five participants avatar in topic list pageThanks @baris ,
i got it now, i was made mistake here
{{{each topic.posters}}}
it should be like this
{{{each topics.posters}}}
Thanks again you save me here..
-
In nodeBB how to display last five participants avatar in topic list pageHi
I dont have experience in this, but i stored this files on my git acc. https://github.com/KumavatVjy/nodebb-plugin-posters . Here you will find the plugin files "nodebb-plugin-posters". -
Topic form set show preview by defaultHi
How can i set by default to "show preview" in topic form as well as post form.
-
How can i set badges on most likes and most replies@phenomlab , Thank you sir
I will check this one.
-
textcomplete-itemHay @baris ,
(https://github.com/julianlam/nodebb-plugin-mentions/blob/master/static/autofill.js#L94)
This works for me for this . Thanks
-
Process "18736" from pidfile not found, deleting pidfileThank you @Teemberland
-
rss feed url's showing in the pageHi
rss feed url's showing in the page even after disable from backend. -
Serach by letters rather than wordsHi
how can i set search form to search by letters rather than search by a complete word.
also anything it should search with related keywords.. in topic/post/users/categories tags default.
-
In nodeBB how to display last five participants avatar in topic list pageHay @baris ,
I did this Plugin is activated now, but on the front end users posters are not displaying ,
<ul> {topic.posters.forEach(function(poster) { <li> <a href="{config.relative_path}/user/{poster.userslug}"> <img src="{poster.picture}" alt="{poster.userslug}" /> {poster.username} </a> ({poster.postCount} posts) </li> })} </ul>
O/P :-
-
In nodeBB how to display last five participants avatar in topic list pageHi @baris ,
Now hook is executed properly after removing some errors shown in log section, then after
console.log(hookData);
before return hookData, its showing me as well in log section.
but i think .tpl code is not showing anything i am using this in topics_list.tpl
<ul> {{{each topic.posters}}} <li> <a href="./user/{./userslug}"> <img src="{./picture}" alt="{./userslug}" /> {./username} </a> ({/.postCount} posts) </li> {{{ end }}} </ul>
Its shows me empty like <ul></ul> this in inspect element.
I can share you my custom plugin file as well. please help me to rectify this one.
-
Social Share of Topics / PostsThank you @baris
Done