Jump to content

Invision Community Blog


Managing successful online communities

teraßyte
Sign in to follow this  
 

IP.Board 3.1.3 Developers Update: Hooks Improvements and Changes

As the entry title says, this blog entry describes changes and improvements to the hooks functionality in IP.Board, and is aimed mainly at modification authors.

New Data hook access points
Several new data hooks have been added for IP.Board and the addons. Here a list of the ones added in 3.1.3:

  • IP.Board
    • topicViewQuery: allows you to add new fields for the members table in the query, and add new joins when posts are retrieved from the database. This will allow you to select additional fields in the members table if you need to, or join in other database tables to retrieve additional information for your modification. The main use for this would be to retrieve additional data to show in the userInfoPane template.
    • incrementUsersPostCount: several modifications need to execute code when the post count for a user is incremented (example: popular points modifications). This new data hook will allow you to do so.

    • Add Calendar Event
    • Edit Calendar Event

    • Add New Blog
    • Add Blog Entry: Entry
    • Add Blog Entry: Poll Data
    • Edit Blog Entry: Entry Data
    • Edit Blog Entry: Added Poll
    • Edit Blog Entry: Updated Poll
    • Add Blog Entry Comment
    • Edit Blog Entry Comment

    • Add Download
    • Edit Download
    • Update Downloads Category Info
    • Rebuild Downloads Statistics Cache
    • Add Download Comment
    • Edit Download Comment

[*]IP.Calendar [*]IP.Blog [*]IP.Downloads

The other applications, such as IP.Gallery, will all see new data hooks as well.


Library hooks support
In IP.Board 3.1.0, we introduced a new type of hook: Library Hooks. This hook type is a powerful tool for modification authors, allowing you to overload the libraries and extend virtually any function in the IP.Board code. Initially, the support for library hooks was limited and often times a class loaded from different areas of the code would sometimes load any library hooks associated with it, and sometimes would not; for IP.Board 3.1.3 we have added support for them in a lot more areas of the code. All of our addon applications have been updated to use them too!

While IP.Board 3.1.3 is a major improvement in terms of library hook support, we will continue working on implementing the library hook support throughout all of IP.Board, with the expectation that IP.Board 3.2 will support library hooks in 100% of locations that can utilize them.


New function IPSLib::loadActionOverloader()
Action overloaders are usually executed automatically by the code but unfortunately that happens only when those classes are executed directly; when those classes are loaded and executed manually like in the code below the overload doesn't apply:

require_once( IPSLib::getAppDir('core') . '/modules_admin/languages/manage_languages.php' );

$langLib = new admin_core_languages_manage_languages( $this->registry );

To resolve this issue, we have added a new function in IPSLib that works similarly to IPSLib::loadLibrary(). This function however accepts only 2 parameters: the first one is the path to the file itself while the second parameter is the class you are overloading. This is an example based on the code above:

$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('core') . '/modules_admin/languages/manage_languages.php', 'admin_core_languages_manage_languages' );

$langLib    = new $classToLoad( $this->registry );

Support for usercpFormsExt plugin dropped Starting with IP.Board 3.1.3, we have discontinued support for the plugin usercpFormsExt.php. This is a plugin that we introduced in the 3.0 version of IP.Board to extend the user control panel tabs when library hooks didn't exist. It has now been replaced with a much more flexible library hook that allows for infinite extensions and you won't even need to upload a file as everything is done with a simple hook. If any developers were using this functionality, be sure to update your code to use the new library hook method. This below is the current code in the public_core_usercp_manualResolver class, for reference:

//-----------------------------------------

// Begin initilization routine for extension

//-----------------------------------------

$classToLoad   = IPSLib::loadLibrary( $EXT_DIR . '/usercpForms.php', 'usercpForms_' . $_TAB, $_TAB );

$usercp_module = new $classToLoad();





We appreciate the feedback of our developers, and hope that these small changes make it easier to extend IP.Board and create useful and creative addons for our products.

Sign in to follow this  

Comments

Recommended Comments

[quote name='Collin S.' date='25 October 2010 - 09:02 PM']
Only mods that use that function.

To add, we did ask around in our contributors forum and there were only 1 or 2 modifications that were ever using that file.

Share this comment


Link to comment
Share on other sites

[quote name='Alex' date='25 October 2010 - 04:16 PM'] To add, we did ask around in our contributors forum and there were only 1 or 2 modifications that were ever using that file.

Any idea which ones ??? so we know which ones might break when we apply the update ?

Share this comment


Link to comment
Share on other sites

In IP.Board 3.1.0, we introduced a new type of hook: Library Hooks. This hook type is a powerful tool for modification authors, allowing you to overload the libraries and extend virtually any function in the IP.Board code.
My mod, "Restricted Reply Function" uses a library hook. Made it deceptively easy to create the function too since I was able to have it override a core function. :)

Adding functionality in the UCP? Maybe I'll be able to make new features now. :frantics:

Library hooks support


Share this comment


Link to comment
Share on other sites

@HighlanderICT: so far only this modders has used it in his mods => http://community.invisionpower.com/user/174986-peter/

Stoo2000 was planning to use it too in one of his application but he saw my post and decided to wait for the library hook instead.

Share this comment


Link to comment
Share on other sites

Good evening,

Me I'm a normal user and I enjoy the work you and your project,
what i want to I know is the mods have come up now that is for 3.1 will work properly in 3.1.3?

This only from me :)

Share this comment


Link to comment
Share on other sites

[quote name='teraßyte' date='26 October 2010 - 07:08 AM']@HighlanderICT: so far only this modders has used it in his mods => http://community.inv...r/174986-peter/

Stoo2000 was planning to use it too in one of his application but he saw my post and decided to wait for the library hook instead.


And to add I'm really excited about this and luckily the mod that uses this is still in testing and isn't public yet so I will be updating it as soon as I can get to it.

Share this comment


Link to comment
Share on other sites

Like any other action overloader really.. nothing different if not that this is a library hook because we don't overload a module/section class :P

I posted an example here in the contributor forum: http://community.invisionpower.com/topic/323530-does-anyone-use-the-usercpforms-extensions-usercpformsextphp/page__view__findpost__p__2032185

Share this comment


Link to comment
Share on other sites

Doesn't the forum passwords mod use that file? And the tracker? I can't upgrade unless the password guy shows up. D:
http://community.invisionpower.com/files/file/3059-tgt-forum-passwords/

Is group format 3.0.0 compatible still?

Share this comment


Link to comment
Share on other sites

[quote name='cdkey' date='26 October 2010 - 07:46 PM']Doesn't the forum passwords mod use that file? And the tracker? I can't upgrade unless the password guy shows up. D:
http://community.invisionpower.com/files/file/3059-tgt-forum-passwords/

Is group format 3.0.0 compatible still?
No, that modification you linked doesn't use the userCP extension usercpFormsExt, it is an application on its own and has the usercpForms instead (notice the missing Ext suffix?); same with tracker and other applications.

Group format has nothing to do with those changes :blink:

Share this comment


Link to comment
Share on other sites

Is there any DIFF or SVN patch to update 3.1.2 to 3.1.3 without overwriting all the files (mods) ?
I see you guys like to modify files just to change 3.1.2 to 3.1.3 on the credits so it makes impossible to easy Diff.

@teraßyte
JAWOHL!

Share this comment


Link to comment
Share on other sites

Dang, that list includes pretty much everything I've requested in the past. GOOD WORK, GUYS! :)

The bad part is now I need to update some hooks (since there are now more efficient options available). :P

Is basher still around? He would be all over that first new feature.

Share this comment


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...