The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How can I insert new fields within an existing admin form via plugin/hooks?
Hi, I hope someone can help...
I'm trying to extend the forum.php admin form by adding a few custom fields in there. I won't get into what those will be and explaining all that... basically if someone could show me how to add a direct copy of the "Title" field directly after that in the forum this would be most helpful. Line 140 of forum.php is: PHP Code:
Essentially if I were hard editing the forum.php file, then I would copy line 140 and paste it again as line 141. How do I achieve the same from a plugin? Many thanks |
#2
|
|||
|
|||
Unfortunately, you can't. The adminCP works differently than the forum in that it doesn't use templates and just outputs html as it goes along instead of once at the end, so there's no chance to change it via str_replace() or anything like that. The best you can do (without editing the file) is to use hook forumadmin_edit_form and add it at the end. (It's fortunate that forum.php has hooks at all, a lot of the adminCP doesn't).
|
#3
|
|||
|
|||
OK, thanks for that, you saved me a lot of time wrestling with it trying to work out why it wasn't working!
For anyone else having the same issue, I found a slightly bodgy but nonetheless useful way to get this functionality (on this particular page at least). Using the earlier hook "forumadmin_start" I set the output buffering of PHP on (using ob_start() ) Then in the section where I needed to make a change, I accessed the contect of the buffer using $stringvar = ob_ get_ clean(). With a combination of this and nested output buffers I was able to do exactly what I needed. This required a plugin for both the "forumadmin_start" hook (which turns on the buffer) and then a separate plugin at the hook point where I'm dealing with the buffered output, in this case "forumadmin_edit_form". This is not perhaps advisable for mainstream pages as it'll introduce additional overheads on a system, but for backend pages it shouldn't cause any issues. There is potential to clash with other plugins which manipulate the page at the same time as this, especially if they do anything with the buffer so tread carefully. |
Благодарность от: | ||
kh99 |
#4
|
|||
|
|||
Nice - wish I'd thought of that.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|