Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 7, 20186 yr Hi there, i'm trying to develop a plugin where the admin needs to set a forum id, and i wonder if i could do a select list like the one from when you create a new forum ( or edit one ). From what i've seen in the files of the Forums app i need the node form helper but i don't quite understand it. Could someone help me out?
March 7, 20186 yr Example: $form->add( new \IPS\Helpers\Form\Node( 'your_setting', \IPS\Settings::i()->your_setting ? \IPS\Settings::i()->your_setting : 0, FALSE, array( 'class' => '\IPS\forums\Forum', 'permissionCheck' => 'view' ) ) );
March 7, 20186 yr Author Something seems to be wrong, when i try to edit the settings of the pluing i get this error: There is an error in the plugin and it could not be loaded. Contact the author for further assistance.
March 7, 20186 yr Author I've done some quick testing. And looks like yes it's it. Not only that but even after i comment it my plugin is still broken, so i deleted it and done another one, same result, after using your code it broke, and after commenting it and replacing with a simple text field still not working, but using a text field before using your code does it fine, but still i would love that node ?
March 7, 20186 yr Another example: $form->add( new \IPS\Helpers\Form\Node( 'your_setting', \IPS\Settings::i()->your_setting, TRUE, array( 'class' => 'IPS\forums\Forum', 'permissionCheck' => function ( $forum ) { return $forum->sub_can_post and !$forum->redirect_url; } ) ) );
March 7, 20186 yr Author Nope it still doesn't work for some reason, i'm going to try a clean reinstall. Because i've been playing with the dev mode so much... Coming back with an edit. Edit: Looks like there was some weird invisible spacing before the $form variable, literally they where invisible, i just figured it out randomly lol, thanks for the help
March 9, 20186 yr Author @Adriano Faria One last thing about this, i switched to building a app since it felt better for what i want to do and opened more doors, i still need to use a node form helper but this time when i get the value of it it returns an array which looks like this in json: { "noCopyButton": false,"_followData":null, "changed":[], "skipCloneDuplication":false } What i've observed is that if i give the option to select mutiple options the return will look something like this: { "8" : {"noCopyButton":false,"_followData":null,"changed":[],"skipCloneDuplication":false}, "10": {"noCopyButton":false,"_followData":null,"changed":[],"skipCloneDuplication":false} }
March 12, 20186 yr It's returning the actual node (what you are seeing is the json representation of the object). What you want to do is save $returnedValue->_id and use that later.
Archived
This topic is now archived and is closed to further replies.