MyBB Community Forums

Full Version: Problem with MyBBIntegrator by Dave
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I apologize in advance for using Google Translator, not familiar with the 'English.

Today I am here to expose a problem, I'm tweaking for days and I have no idea how to solve.

I'm creating a mini site and would like to connect with MyBB anyway, then I thought of using MyBBIntegrator Dave. I 've downloaded and configured everything right, but finding a lot of problems to check whether the user is online. I state that I'm testing everything locally with XAMPP.

-I tried to use the pre-written IsOnline, returns false for all that are logged.
-I tried to create a session and save the global.php 'UID, if not equal to 0 means that the' user is logged ... But when the amount of 0 global.php because I do not recognize. Then I tried to add this save-UID on the index page ... works, but if you visit the site directly does not refresh, and even if the 'user is not logged on, the site is logged.
-I tried to use other supplements ... Nothing.

As said before, I'm tweaking for days, I tried everything, but I can not find any solution ...

examples of codes that I used:

define ("IN_MYBB", 1);
require ($ _SERVER ['DOCUMENT_ROOT']. '/forum/global.php');
echo ($mybb->user['uid']) ? 'online', 'offline'
-> always offline

The function of IsLoggedIn dave (correctly configured)

IsLoggedIn function ()
{
/ / If the user is logged in, he has an UID
return ($this->mybb->user['uid']! = 0)? true: false;
}

-> always false

I tried other solutions but I could not find a working decently ...

If you for some solution?

Google translator and I apologize for any errors, best regards, Mavin.

Solved ò.ò

(http://community.mybb.com/post-301500.html)
Make sure your cookie directory is / and not /forum/
(2012-07-30, 03:55 AM)Paul H. Wrote: [ -> ]Make sure your cookie directory is / and not /forum/

(2012-07-27, 09:13 AM)Mavin Wrote: [ -> ]Solved ò.ò

(http://community.mybb.com/post-301500.html)

But now I am having another problem and I've almost solved Smile Thanks anyway.
Hello Mavin,

Are you declaring the constructor anywhere in your script?
If you forgot to do that, try the following:

<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '.../community/global.php';
require_once '/path/to/MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

print $MyBBI->isLoggedIn() ? 'Online' : 'Offline';
?>

Sometimes you will need to use global scopes and variables when using MyBB externally.
(2012-08-01, 07:03 AM)bowkilled Wrote: [ -> ]Hello Mavin,

Are you declaring the constructor anywhere in your script?
If you forgot to do that, try the following:

<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '.../community/global.php';
require_once '/path/to/MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

print $MyBBI->isLoggedIn() ? 'Online' : 'Offline';
?>

Sometimes you will need to use global scopes and variables when using MyBB externally.

Meanwhile, thank you for your help, though as I said many times already solved, in fact the problem is a bit far as I have explained to you, because working spezzettavo code like this:

index.php?page=the_page

then from 'I asked for index.php page with: require_once ($ _GET['page']), then changed course and wrote as best we could improve, and often spezzettavo code, for example on the index page I declared as the global I also served for other pages, so often riscontravo errors.

I hope I explained myself in the best way, and since I have used a translator to answer and to read your answer wrongWink I hope I never have an excuse but then again, not English.
hmm It may be better to print out the full array to make sure that everything is as expected.

Try

echo "<pre>";
print_r($mybb->user);
echo "</pre>";

That will give you the full array in a nice readable format and let you do a direct comaprison and see if it your statements or the return itself
(2012-08-01, 01:33 PM)Dannymh Wrote: [ -> ]hmm It may be better to print out the full array to make sure that everything is as expected.

Try

echo "<pre>";
print_r($mybb->user);
echo "</pre>";

That will give you the full array in a nice readable format and let you do a direct comaprison and see if it your statements or the return itself

Why would you go the other way around? Secondly, if you print only the user variables instead of every variable print_r($mybb); would not be neccessary because if you get a blank page, then you know that your code doesn't work (which is more likely to this issue that OP is experiencing).

By doing your way, you would only check if the cookie paths are right (unless OP have hacked any core file), nothing else.
You would do that to ensure you are getting values from that class. Doing a var dump is part of troubleshooting any array based issue and really should be a first step.

Finally this user just wants to use the user array so why dump superfluos information?



All of the troubleshooting so far has been based on the assumption that he is getting a value and is trying to troubleshoot further down the chain, it's important to start at the beginning when fixing an issue. Trust me I have been doing 3rd level code based support for 10 years