![]() |
Errors when including global.php
I want to implement an external user registration functionality.
I use this code to include global.php chdir('../forum'); require_once('./global.php'); However, upon doing this I receive these errors: Notice: Undefined variable: errfile in /home/wa/public_html/forum/includes/functions_log_error.php on line 136 Warning: array_keys(): The first argument should be an array in /includes/functions.php on line 3090 Notice: Undefined variable: errfile in /home/wa/public_html/forum/includes/functions_log_error.php on line 136 Warning: Invalid argument supplied for foreach() in /includes/functions.php on line 3090 Fatal error: Call to a member function on a non-object in /home/wa/public_html/forum/includes/functions.php on line 2379 functions.php line 2379 = $temps = $vbulletin->db->query_read(" SELECT title, template FROM " . TABLE_PREFIX . "template WHERE templateid IN (" . implode(',', $templateids) . ") "); functions.php line 3090 = foreach(array_keys($vbulletin->forumcache) AS $forumid) { foreach($membergroupids AS $usergroupid) { $user['forumpermissions']["$forumid"] |= $vbulletin->forumcache["$forumid"]['permissions']["$usergroupid"]; } } Anyone know what is wrong and why? |
You will find 4 arrays defined in each vB file, before the call to global.php. Just define those 4 arrays.
|
Thanks for your quick reply,
I added the 4 arrays but the errors still remain. Here is the new code: PHP Code:
|
Quote:
|
Hello,
I changed the code snippet to this: PHP Code:
Could it be that the arrays required cannot be accessed by global.php because they are created in a function inside a class? (local scope) Just guessing here.. PSEUDO : Code:
class Registration Is it possible to still have access to global.php inside a class or function? Update2: If there isn't, is it still possible to play with the datamanager? This is what I need global.php for: PHP Code:
For anyone wanting to test: This does not work : PHP Code:
Code:
Warning: array_keys(): The first argument should be an array in /includes/functions.php on line 3090 |
Global the variables...
PHP Code:
|
Hi,
Just tried it, errors remain the same. Any other ideas? Thanks |
As a side note, do you actually need all those templates you are declaring, or did you just copy the code from somewhere ?
|
No i don't need them, I just copied it from index.php. Can they just be empty arrays?
|
Like i said in my first reply, just define them.
|
Ok, so I have changed the code to :
PHP Code:
|
anyone ? :s
|
No replies, does this mean it's impossible to do??
|
it just means noone has a solution to fix your problem.
Now that I've read your requirements, no. you will not be able to do this to use it inside a class. It is still possible, and since you're already mucking around with classes i dont see why you'd need help to copy the data_managers init function to make it work. you will need to reproduce init.php's behaviour to initialise any variables the datamanager requires. |
I'll look into that, thanks!
Btw, is there also a login function in that class or anywhere else which I can easily use from outside Vb? That would be very nice. |
im not sure. if there is one itll be in /includes/.
|
I'm having this problem too. Did anybody find a solution? How do other people integrate vbulletin with their application?
|
Hi Xia,
(Hope is not too late.. well, it will serve someone else if it's too late for you :)) Here's the code to get an instance of vbulletins' registry object (a.k.a $vbulletin). I've placed toghether a couple pieces from various threads here in vb.org (including some of them from this same one, and from https://vborg.vbsupport.ru/showthread.php?t=112388) You can place the function as a method in your class and call it statically like: PHP Code:
I've successfully tested this and used a datamanager, and it worked perfectly (created thread and post correctly :-D) This follows a singleton pattern, so you'll never overwrite the instance, even if the instance was created by vB itself. PHP Code:
Markus |
Quote:
|
I'm struggling with this as well. Please help.
|
All times are GMT. The time now is 03:51 AM. |
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:
|