Recent Topics

1 Dec 10, 2008 22:52    

My b2evolution Version: 2.x

Hi,

I recently purchased the MCFileManager for TinyMCE and am trying to integrate it with b2evo... It's goes in as a plugin and has its own user/pass form (which can be swapped for something else), but I want it to integrate with the b2evo login so authorized users don't have to login again...

I was trying to set a $_SESSION var to store the current user level on the page(s) where I have TinyMCE integrated (not using the TMCE plugin) with something like (in /inc/items/views/_item_simple_form.php)

if ($current_User->level > 9) {
  $_SESSION['usrlvl'] = $current_User->level;
}


Yet the variable will not carry over to the MCFileManager plugin authentication script:

session_start();
echo $_SESSION['usrlvl'];


Just as an example to output the session var.... Does anyone know what I might be doing wrong?

Or perhaps someone has already implemented a plugin for this plugin to authenticate the b2evo users? Or know of another way to go about it?

Thanks for any assistance ;-)

2 Dec 15, 2008 22:43

Bump - redid title... I'm basically trying to get a plugin for my WYSIWYG editor to authenticate based on if b2 user is logged in or not...

It seems though that b2evolution is killing my $_SESSION var - how can I get it to not do this - or how can I pass the var to an outside script for authentication?

Any help is appreciated!

Related thread here: http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=46676#p46676

3 Dec 16, 2008 22:20

where do you have session_start() before setting it in the b2 code?

4 Dec 16, 2008 22:52

Actually I don't have session statr (in _item_simple.form.php)... When I add one, i get headers already output there...

However - now I can out put the $_SESSION vars in the b2evo footer... However when I try to use them for authentication in a TinyMCE plugin they are empty... The Tinymce dev claims they aren't being destroyed by TinyMCE....

5 Dec 17, 2008 21:07

Hi all just an update - maybe will shed more light into the problem... But it seems either b2evo is nuking the sessions, or I am not accessing them correctly...

As a test, I set $_SESSION['usrlvl'] to some value in the edit page, then I have a link to a plain-jane .php page outside of the blog app (on same site of course), something to the effect of:

<? session_start();
echo 'usrlvl: '.$_SESSION['usrlvl'];
?>

Does anyone know why this session var isn't being carried in or how I may access it outside of b2evolution...

Thanks for any help - desperate for an answer ;-)

6 Dec 18, 2008 12:56

You might be able to use function AdminAfterMenuInit() in a plugin to start the session, if not then you'll need to use $_COOKIES as evo doesn't use $_SESSION

¥

7 Dec 18, 2008 16:11

Thanks for the reply.... Questions in bold...

Just so it's clear - here's what I need to accomplish... I need to be able to tell if the current logged in user is level 9 or above from a page outside of the /blogs/ directory...

My thought was I could simply set a $_SESSION var in the edit page(s) where I need this info passed then read that $_SESSION from an external page outside of /blogs/

Is the fact that the *cookie* domain is set to /blogs/ preventing me from seeing the $_SESSION vars outside of /blogs/ ? (I can't test cause anything in blogs tried to redirect)

As for cookies - it wasn't working at first, but I wasn't setting the path right... I can set and read the cookies, but I have to place it before anything is output.

How can I check the current user level and set the cookie before any output is made?

If all else failed I would have liked to just to be able to access $current_User->level outside of /blogs/. I try making an external file with:

require_once '../blogs/conf/_config.php';
require_once $inc_path.'_main.inc.php'; 
global $current_User;
echo $current_User->ID;


...but the object isn't recognized.

What is the method (if any) to access the $current_User outside of the /blogs/?

Thanks for the current and any future feedback. I feel like I'm missing something really stupid here...

8 Dec 18, 2008 17:52

1) no idea, I've never used sessions, but it sounds plausible

2) the function I referenced above will do that ( in a plugin )

3) I'm guessing you were right about #1 because you should have a $current_User;

¥

9 Dec 18, 2008 17:54

Hi - I think I have this... Kind of a dumb mistakes, but I guess those are the once that take you hours to figure out.

My settings are such that session_autostart is off... and the place where I was putting the session start was apparently after output so it wasn't actually starting the session (though not giving me feedback that it wasn't started)

Comments are closed on this archived website.