The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
CMS Hooks
Hi all,
I'm toying around, trying to modify the content of CMS articles when they are displayed (ie I don't want to edit the article saved in the database, just as it's displayed). On the forums, I'd use something like threadbit_process, but I'm having trouble finding a similar hook for the CMS (I'm using 4.0.0 at the moment). I did wonder about hooking into another location further down, after the various template parts had been linked up, before the final output was sent to the browser (in which case my code would be acting on the whole html page, rather than the html for the CMS article). Does that sound like a workable solution? I was having trouble finding the most suitable hook for that too Cheers! |
#2
|
||||
|
||||
There are currently 12 hooks available for use in the CMS.
Code:
<hook>vbcms_widgetdm_start</hook> <hook>vbcms_widgetdm_presave</hook> <hook>vbcms_widgetdm_postsave</hook> <hook>vbcms_widgetdm_postdelete</hook> <hook>vbcms_article_defaultcontent_start</hook> <hook>vbcms_article_defaultcontent_end</hook> <hook>vbcms_articleblog_presave</hook> <hook>vbcms_articlepost_presave</hook> <hook>vbcms_article_populate_start</hook> <hook>vbcms_article_populate_end</hook> <hook>vbcms_article_save_start</hook> <hook>vbcms_article_save_end</hook> Code:
<hook>vbcms_article_populate_start</hook> |
#3
|
|||
|
|||
Thanks. I'd tried vbcms_article_populate_end I think, but nice to have confirmation of what I should be using.
Bit of a problem though: none of the code in my plugin is being executed when I use that hook (my code was a simple print_r($GLOBALS)). I found the hook location in packages/vbcms/content/article.php, and immediately after: ($hook = vBulletinHook::fetch_hook('vbcms_article_populate_ start')) ? eval($hook) : false; , I tried printing $hook. It's always empty. Next I added DEVDEBUG("Calling Hook $hookname") just after public static function fetch_hook($hookname = false) { in includes/class_hook.php. That confirmed that vbcms_article_populate_end was being called. So it seems the problem is that vbcms_article_populate_end doesn't exist in $pluginlist. I've tried dumping that array, and don't see any vbcms_* hooks in there. Am I missing something stupidly obvious? I did wonder if there was now the ability to turn plugins off for just the CMS, but can't see that option in ACP |
#4
|
|||
|
|||
Problem solved (well, explained anyway). vbcms_article_populate_start (and others) are defined in xml as admin only. Seems this has been fixed in 4.0.1. There's a discussion here: http://www.vbulletin.com/forum/proje...?issueid=33246
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|