PDA

View Full Version : Using adminincludes in misc.php


ThorstenA
08-13-2008, 09:07 AM
This is misc_start plugin is not working. How can I include adminfunctions_ within misc.php?
Fatal error: Call to undefined function log_admin_action() in misc.php(97) : eval()'d code on line 590

if ( $_REQUEST['do'] == 'test')
{
require_once(DIR . '/includes/adminfunctions_stats.php');

print_cp_header($vbphrase['statistics']);
}
Thanks.

Marco van Herwaarden
08-13-2008, 09:16 AM
You don't need to include global.php in a plugin.

The print_cp_XXXX functions are designed to be used inside the AdminCP, not on front-end scripts.

If you need to include any admin functions, then you will need to include (at least) adminfunctions.php

Opserty
08-13-2008, 09:23 AM
adminfunctions_xxxx.php files are for usage in the AdminCP/ModCP files.

functions_xxxxx.php files are for usage in the normal root files.

(You should be using templates when creating a "normal" page).

ThorstenA
08-13-2008, 09:47 AM
Thank you both!
It works now with

require_once(DIR . '/includes/adminfunctions.php');

adminfunctions_xxxx.php files are for usage in the AdminCP/ModCP files.

functions_xxxxx.php files are for usage in the normal root files.

I am writing a statistic product and just want to use all existing built-in functions there are.

Opserty
08-13-2008, 10:18 AM
In misc.php you should be using templates though. Using other admin functions is fine but you shouldn't use the print_* functions that are defined in adminfunctions(_xxx).php files. Notice that other pages like "showthread.php", "forumdisplay.php" use print_* functions, they use templates (even for forms).

ThorstenA
08-13-2008, 10:43 AM
I understand that but I need these built-in functions. And I do not want to copy and paste existing functions just to get rid of print_* functions. Could I not integrate these echo functions (I asked about that in my other thread (https://vborg.vbsupport.ru/showthread.php?t=188009))?

Opserty
08-13-2008, 10:48 AM
Why exactly do you need them? (Why can't you make them using templates? Which functions do you want to use?)

May be worth reading: [How-To] vBulletin API Basics: Creating Custom Pages & Misc. (https://vborg.vbsupport.ru/showthread.php?t=98009) if you haven't already done so.

ThorstenA
08-14-2008, 09:49 AM
Thanks to you, my new forum statistics (https://vborg.vbsupport.ru/showthread.php?t=188085) product is online :)