![]() |
find replace issue
Any idea why this isn't working?
Using parse_templates (also tried forumdisplay_complete) Code:
$find = 'Post New Thread'; |
Normally the text is in a phrase, so maybe what you want is to enter a translation for the phrase instead of doing a str_replace on the template?
ETA: Or if you had some reason for wanting to do a str_replace instead, then you'd have to do it after the template was rendered instead of doing it on the template cache. |
I just need it changed in certain forums (have code with forum id array).
I tried forumdisplay_complete and it did nothing as well... :\ --------------- Added [DATE]1360123229[/DATE] at [TIME]1360123229[/TIME] --------------- so would i use Code:
$vbulletin->template['FORUMDISPLAY'] --------------- Added [DATE]1360123422[/DATE] at [TIME]1360123422[/TIME] --------------- or do i need to figure out how to use the template parser? |
Yeah, the problem is that it calls print_output with the result of the render call, so there's no place to do the replace. Well, there might be but I think I have what might be a better idea: create a new phrase (Phrase Type "Forum Display") for "Create a Listing", then do the str_replace on the cache using the phrase varnames, like:
Code:
$find = 'post_new_thread'; Edit: There's also a global_complete hook location where the output is in $output, so another way would be to try doing your str_replace that way, like: Code:
$find = 'Post New Thread'; ... but I guess then you'd have to somehow make sure that it was being done only on the FORUMDISPLAY page. Hmm...maybe it won't work after all. |
awesome that worked :)
now i need to wrap it with if(THIS_SCRIPT for FORUMDISPLAY so its not running on every page :) |
Quote:
|
I think you're complicating things by using str_replace.
If all you're doing is replacing the 'Post New Thread' text for the buttons, this is easier... Use the forumdisplay_complete hook... Code:
if ($foruminfo['forumid'] == Your_ForumID) |
Here is my completed plugin. Please let me know if it can be 'condensed'.
here is the scenario, i have 51 'top level' forums that will always be, and never change or have any forums added to. But of those 51 forums, I may add/remove multiple sub-forums and don't want to keep adding COUNTLESS id's to the plugin. (there are hundreds of subforums). Code:
if (is_member_of($vbulletin->userinfo, 6)) { --------------- Added [DATE]1360187715[/DATE] at [TIME]1360187715[/TIME] --------------- i may be overcomplicating it a bit, but i am not a professional with php. as is, it works. |
While it may work, again you've over complicated what you want to do by adding 51 unneeded additional database queries each time forumdisplay is accessed.
Using the forumdisplay_complete hook... Code:
if ($foruminfo['parentid'] >= 18 AND $foruminfo['parentid'] <= 68) The only thing that might complicate things is if your sub-forums have sub-forums. Then that's a different story. |
All times are GMT. The time now is 10:06 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|