The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Being forced to forum login page when accessing datamanager in code
Hello,
When trying to use $newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); in code, I'm forced to the screen that has the message "You are not logged in or you do not have permission to access this page. This could be due to several reasons: " <blah> <blah> Then if I log into my forum as admin then the code in my script runs. But I'm attempting to write code to automatically work with users and their settings. Why am I being forced to this "login" screen? I did make sure the setting to allow user registrations is set to "yes" Thanks for any help you can provide. |
#2
|
|||
|
|||
Are you sure it's the "datamanager_init()" line that's causing it? If it is, the only thing I can think of is to make sure $vbulletin is an object (if you're calling it inside a function, maybe you need a "global $vbulletin;" line).
|
#3
|
|||
|
|||
I'm not doing anything fancy and am not calling it inside a function. I did apply a security patch though yesterday. Not sure if that hosed anything.
Here is the code I'm using: <?php include_once("global.php"); $vbulletin; $email = "userMom@myforum.com"; $useridq = $vbulletin->db->query_first_slave("SELECT userid FROM " . TABLE_PREFIX . "user WHERE email='{$email}'"); $syd_userinfo = fetch_userinfo($useridq['userid'], 0, 0); echo "<br> taya given the email, it found this as the user id: " . $useridq['userid'] . " <br>"; ?> |
#4
|
|||
|
|||
OK, I tried that and I just got the message echoed at the end (and of course it says the userid is 0). But you said you were trying to use datamanager_init(), did you remove that code?
|
#5
|
|||
|
|||
I did remove the datamanager_init() code to rule out that was causing me to be sent to the login screen.
Even with that code removed and using the code that I posted and you've tested, I'm sent to the screen to login. I don't know what is causing that. |
#6
|
|||
|
|||
Where are you putting your script? I tested it in the same directory as the main vbulletin files.
|
#7
|
|||
|
|||
Everything is at the main forum level. And once I log in, the code works as expected. Weird.
|
#8
|
|||
|
|||
I hadn't tried it while logged out, but I just did and it works OK for me. I know there are some scripts that redirect you to the login page if you're not logged in, but obviously that code isn't in yours. I was thinking you might have your script in admincp or modcp, since those use a different global.php that I believe does force you to log in.
|
#9
|
|||
|
|||
Thanks for your help. I think something is corrupt/confused since I applied the security patch. I'll revert back later today and try to see if the behaviour is the same. Again, thanks for your help.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|