Jyoti Rani Posted October 17, 2023 Posted October 17, 2023 Hi In the invision version 3.6 i have 2 hooks. During the upgrade these has been lost. Now in the version invision 4.7, How to implement the hooks? Any guide or link helps me a lot. konon 1
DawPi Posted October 17, 2023 Posted October 17, 2023 5 minutes ago, Jyoti Rani said: Any guide or link helps me a lot The only: https://invisioncommunity.com/developers/index/
Jyoti Rani Posted October 19, 2023 Author Posted October 19, 2023 On 10/17/2023 at 11:41 AM, DawPi said: The only: https://invisioncommunity.com/developers/index/ You have given the general link. Any specific link to convert the hooks in previous i.e. 3.6 version to new 4.7 version will help me a lot. Right now which I understand is that, I need to enable developer mode, then I can start creating plugins. But i m still not sure about what's next steps? Right now trying to setup developer mode at local.
Marc Posted October 19, 2023 Posted October 19, 2023 There is no specific link on how to convert from 3.4 to 4.7 hooks, no. Its an entirely different platform, so it wouldnt be so much 'conversion' as rewriting them entirely G17 Media and DawPi 1 1
Jyoti Rani Posted October 19, 2023 Author Posted October 19, 2023 Just now, Marc Stridgen said: There is no specific link on how to convert from 3.4 to 4.7 hooks, no. Its an entirely different platform, so it wouldnt be so much 'conversion' as rewriting them entirely So, if I had to perform an action when user creates a new Post, then can you suggest the process to be followed in new version?
Marc Posted October 19, 2023 Posted October 19, 2023 Im not a developer on the platform myself, but I would suggest going through the documentation that has been linked to above, as developing for 4 is very different to version 3. This is likely what you would need to do what you are looking to do there, but with going through all of it, you are going to hit things that make no sense until you do.
Adriano Faria Posted October 19, 2023 Posted October 19, 2023 8 minutes ago, Jyoti Rani said: So, if I had to perform an action when user creates a new Post, then can you suggest the process to be followed in new version? New post or new topic?
Jyoti Rani Posted October 19, 2023 Author Posted October 19, 2023 25 minutes ago, Adriano Faria said: New post or new topic? New Post as well as New Topic.
Adriano Faria Posted October 19, 2023 Posted October 19, 2023 - New topic: hook on \IPS\forums\Topic: public static function createFromForm( $values, \IPS\Node\Model $container = NULL, $sendNotification = TRUE ) { $item = parent::createFromForm( $values, $container, $sendNotification ); //do your stuff return $item; } - New post: hook on \IPS\forums\Topic\Post: public static function create( $item, $comment, $first=FALSE, $guestName=NULL, $incrementPostCount=NULL, $member=NULL, \IPS\DateTime $time=NULL, $ipAddress=NULL, $hiddenStatus=NULL, $anonymous=NULL ) { $reply = parent::create( $item, $comment, $first, $guestName, $incrementPostCount, $member, $time, $ipAddress, $hiddenStatus, $anonymous ); //do your stuff return $reply; }
Jyoti Rani Posted October 19, 2023 Author Posted October 19, 2023 14 minutes ago, Adriano Faria said: - New topic: hook on \IPS\forums\Topic: public static function createFromForm( $values, \IPS\Node\Model $container = NULL, $sendNotification = TRUE ) { $item = parent::createFromForm( $values, $container, $sendNotification ); //do your stuff return $item; } - New post: hook on \IPS\forums\Topic\Post: public static function create( $item, $comment, $first=FALSE, $guestName=NULL, $incrementPostCount=NULL, $member=NULL, \IPS\DateTime $time=NULL, $ipAddress=NULL, $hiddenStatus=NULL, $anonymous=NULL ) { $reply = parent::create( $item, $comment, $first, $guestName, $incrementPostCount, $member, $time, $ipAddress, $hiddenStatus, $anonymous ); //do your stuff return $reply; } Hey Adriano, I have to write the above code in which file? As per the guide i m setting up developer mode at local. Do i need developer mode at local to write above code? Or there is any other way to do this?
Adriano Faria Posted October 19, 2023 Posted October 19, 2023 1: You need to have a local install of the board (with Apache PHP/MySQL, or a Wampserver, etc.). 2: upload the dev tools: 3: Enable the developer mode: 4: create a plugin with 2 code hooks in the classes I pointed above. Meddysong 1
Jyoti Rani Posted October 20, 2023 Author Posted October 20, 2023 After doing the steps given the articles and suggested by you. When i run the folder at my local, i am getting below error. I checked in the specified location but could not found the file specified. Can someone guide please? file_get_contents(D:\wamp64\www\marketing_version4.7/applications/forums/data/versions.json): Failed to open stream: No such file or directory
Jyoti Rani Posted October 23, 2023 Author Posted October 23, 2023 On 10/19/2023 at 5:13 PM, Adriano Faria said: 1: You need to have a local install of the board (with Apache PHP/MySQL, or a Wampserver, etc.). 2: upload the dev tools: 3: Enable the developer mode: 4: create a plugin with 2 code hooks in the classes I pointed above. Hello adriano, I am able to complete step 1,2,3 specified. But as you mentioned I have to write the code in which file among the below plugins\hooks.php file '\\IPS\\forums\\Forum' => array ( 2 => array ( 'file' => 'applications/cms/hooks/Forum.php', 'class' => 'cms_hook_Forum', ), ), '\\IPS\\forums\\modules\\admin\\forums\\forums' => array ( 3 => array ( 'file' => 'applications/cms/hooks/forums.php', 'class' => 'cms_hook_forums', ), ),
Adriano Faria Posted October 23, 2023 Posted October 23, 2023 Create an application or a plugin. Go to dev center, tab Hooks and create a hook then you’ll have a file in applications/appkeyfolder/hooks or plugins/pluginkeyfolder/hooks. Add the script in this file.
Jyoti Rani Posted October 25, 2023 Author Posted October 25, 2023 On 10/23/2023 at 7:23 PM, Adriano Faria said: Create an application or a plugin. Go to dev center, tab Hooks and create a hook then you’ll have a file in applications/appkeyfolder/hooks or plugins/pluginkeyfolder/hooks. Add the script in this file. I am able to access the hooks menu now. I am able to add the hook on process form. But here the issue is I have to update the values in the table which is not the part of invision table. For e.g i have table table1. I am using mysqli to update the values on the basis of userid. As this is the common column between ipcore_members and table1. I am using one dbconnect.php file to connect to the db using mysqli driver. But the $connection object is not available to me in the hook file. Can you please help?
teraßyte Posted October 25, 2023 Posted October 25, 2023 You can use the DB class to run queries, there is no need to use a separate dbconnect.php file:
Jyoti Rani Posted October 26, 2023 Author Posted October 26, 2023 20 hours ago, teraßyte said: You can use the DB class to run queries, there is no need to use a separate dbconnect.php file: By default its taking ip in the table name. Earlier in the version 3.6 we have used the table name without the tbl_prefix. So, Can you help me how to use the how to fetch the data directly from the table without using tbl_prefix?
Adriano Faria Posted October 26, 2023 Posted October 26, 2023 55 minutes ago, Jyoti Rani said: By default its taking ip in the table name. Earlier in the version 3.6 we have used the table name without the tbl_prefix. So, Can you help me how to use the how to fetch the data directly from the table without using tbl_prefix? Search for external on
Jyoti Rani Posted October 26, 2023 Author Posted October 26, 2023 (edited) 23 minutes ago, Adriano Faria said: Search for external on Found the solution as you mentioned at the same place Adriano. Thanks for the reply! Edited October 26, 2023 by Jyoti Rani
Jyoti Rani Posted October 26, 2023 Author Posted October 26, 2023 20 minutes ago, Jyoti Rani said: Found the solution as you mentioned at the same place Adriano. Thanks for the reply! Now another query is, there is xml file which gets generated in the end. But how to create it? How to upload it to sever from developer's mode at local?
Adriano Faria Posted October 26, 2023 Posted October 26, 2023 3 minutes ago, Jyoti Rani said: But how to create it? 3 minutes ago, Jyoti Rani said: How to upload it to sever from developer's mode at local? Not sure I follolw your question. Do you want to upload your own hook to the dev install? Make sure you make a copy and keep the dev folder of your app/plugin. You will need to work in your app/plugin in the future.
Jyoti Rani Posted October 26, 2023 Author Posted October 26, 2023 7 minutes ago, Adriano Faria said: Not sure I follolw your question. Do you want to upload your own hook to the dev install? Make sure you make a copy and keep the dev folder of your app/plugin. You will need to work in your app/plugin in the future. 10 minutes ago, Adriano Faria said: Not sure I follolw your question. Do you want to upload your own hook to the dev install? Make sure you make a copy and keep the dev folder of your app/plugin. You will need to work in your app/plugin in the future. But i m not getting this dropdown in my screen. Please see below
Adriano Faria Posted October 26, 2023 Posted October 26, 2023 Enable IN_DEV mode. It will appear. Jyoti Rani 1
Jyoti Rani Posted October 26, 2023 Author Posted October 26, 2023 14 minutes ago, Adriano Faria said: Enable IN_DEV mode. It will appear. Yes. Thanks again for your prompt reply!
Recommended Posts