PDA

View Full Version : Fetch current node and channelid


delicjous
07-04-2017, 07:08 AM
Hi everyone,

I want to do my first real mod includes an API call.
I read about a mod-request which should list all Moderators of a Forum.
Thought it should be easy enough to start with.

But I did'nt find the API-call of the current channel and nodeid.
I need to set the current nodeid and current channelid to a variable

$nodeid =?
$channelid =?

I would show all usernames where moderator for nodeid and nodeid = channelid.
So if the User is moderator in nodeid = 3 (db-table moderator) the Moderatorbar should be visible at channel 3 pages.

Could anybody help me please :-)

delicjous
07-09-2017, 04:28 PM
nobody?

Ok, I will explain it a little bit more specific.

I want to use the hook 'forumitem_below_description' to show a list of the forums mods.
But to use the class "vB_Library::instance('node')->getNodeModerators($nodeid);" I need the forum.nodeid of each forum.

$channels = vB::getDbAssertor()->getRows('vBForum:getChannelTree', array());
$nodeid = $channels['nodeid']

$moderators = vB_Library::instance('node')->getNodeModerators($nodeid);
foreach ($moderators as $moderator)
{
$mod_id = $moderator['userid']
$mod_name = vB_Api::instanceInternal("user")->fetchMusername($moderator['userid']);
$mods[] = ['mod_id' => $$mod_id, 'mod_name' => $mod_name];
}

Could I fetch one nodeid by this and get it to getNodeModerators or do I have to do one more foreach?

I spend ours on it and don't know how to do it... :confused:

Edit: And how could I put an argument like forum=forum to the hook at product-file .
Edit and try this, because I found it at vbulletin_styles: <arguments><![CDATA[a:1:{s:8:"forum";a:1:{s:8:"forum";i:1;}}]]></arguments>

Edit 2.0:
Got it all by my self spending one day with vBulletin stuff!

After I got it I saw the mod already exist:
vbmods.rocks - Forum moderator-list (https://vbmods.rocks/forum/vbulletin-5-modifications/vbulletin-5-products-and-extensions/5285-forum-moderator-list)