Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-02-2013, 11:48 AM
vbresults vbresults is offline
 
Join Date: Apr 2009
Posts: 687
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default API Extensions (The New Plugin/Hook System) Question

How can we intercept the methods we're extending, instead of having our extension methods invoke after the parent methods?

I.e.
PHP Code:
class Myplugin_Api_User extends vB_Api_Extensions {
    function 
save(...) {
        
// This executes after vB_Api_User::save does, meaning we can't change the output of the parent function directly...
        
echo 'Foo';
    }

Also how do I extend classes outside the vB Extensions Api folder, like controllers?
Reply With Quote
  #2  
Old 03-02-2013, 01:55 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Both are not possible for the moment.
Reply With Quote
  #3  
Old 03-02-2013, 09:08 PM
vbresults vbresults is offline
 
Join Date: Apr 2009
Posts: 687
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForumsMods View Post
Both are not possible for the moment.
... then how are we supposed to make mods without butchering the core software and making it difficult to install a mod?
Reply With Quote
  #4  
Old 03-02-2013, 09:28 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, for the moment, you need to find a way (workaround) to do what you want.

Maybe you can extend another method that is called before save() finishes.
Maybe, you can create another controller to do what you want.

If you explain what you want to do, we will able to be more help.

Limitations to modifying vB5
  • You cannot run any extension method before its main API counterpart.
  • You cannot stop or change core API calls (for example those that make database updates).
  • You cannot alter or hook into existing database queries.
  • You cannot extend library functions.
  • You cannot extend or hook into any frontend functions.
  • You cannot access the actual API variables ($this->xxx)
  • You can't extend any API call that was called by instanceInternal()
  • Cannot hook into [most] ACP functionality.

If you have any others, please post them
Reply With Quote
  #5  
Old 03-02-2013, 10:41 PM
vbresults vbresults is offline
 
Join Date: Apr 2009
Posts: 687
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForumsMods View Post
  • You cannot run any extension method before its main API counterpart.
  • You cannot stop or change core API calls (for example those that make database updates).
  • You cannot alter or hook into existing database queries.
  • You cannot extend library functions.
  • You cannot extend or hook into any frontend functions.
  • You cannot access the actual API variables ($this->xxx)
  • You can't extend any API call that was called by instanceInternal()
  • Cannot hook into [most] ACP functionality.
Jesus Christ! Why even have a modification system, then?

Thanks for this list, though. We just aren't developing any more vB5 mods until these things are taken care of.
Reply With Quote
  #6  
Old 03-03-2013, 12:27 AM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
With two completely new systems (to replace plugins and template hooks [v1]), its obvious that we are going to find limitations to what can be done.
You can vote in the issues created in Tracker to get these "bugs" fixed faster.
Reply With Quote
  #7  
Old 04-24-2013, 10:21 AM
Ben.Smith Ben.Smith is offline
 
Join Date: Apr 2013
Location: Germany
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,
i am pretty new to vBulletin as we got a customer who insists on using vB 5 Connect....

Having a quick look at the vB Code (horrible!), i came to the same conclusion: There is no good way of modifing specific behaviors in vB without making changes to the core files thus losing the possibility to upgrade.

Sadly vB missed to implement some kind of event/hook system (sorry but these Template hooks just don't give enough flexibility for big changes).

I went to make use of the existing autoloader and modified both - index.php and api.php to always look (following name convention) if there is a custom implementation of the loaded Class.

Now I can easily override every Frontend Controller and API Class to integrate my own logic.

Its not the best way, but as far as i can see its the only way to go right now.

Anyone here tried something like this before?
Reply With Quote
  #8  
Old 04-28-2014, 07:51 PM
CvP's Avatar
CvP CvP is offline
 
Join Date: Aug 2006
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you share/explain this in detail?
Reply With Quote
  #9  
Old 04-28-2014, 10:54 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You realise that post is a year old ?
Reply With Quote
  #10  
Old 04-28-2014, 11:26 PM
CvP's Avatar
CvP CvP is offline
 
Join Date: Aug 2006
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, but even this would help more than the non-existing vb5 documentation...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:11 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06019 seconds
  • Memory Usage 2,252KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete