News:

Wondering if this will always be free?  See why free is better.

Main Menu

integrating mrbs within smf2

Started by nose, June 03, 2010, 06:57:39 AM

Previous topic - Next topic

nose

Hello,
as I have to integrate mrbs (http://mrbs.sourceforge.net/ [nofollow]) within smf2 I need some help. The goal is to give the auth stuff to smf and let mrbs read out the cookie(s) of smf to authentificate users. The memberstructure of mrbs is quite simple 0=readers, 1= bookers, 2= admin.
So I greenly think the mrbs script has to read the cookie and extract the user and the group compare the rights (ie. groupid9 = 0, ...).
(added the cookie session related mrbs php file)
Any help appreciated.


nose

I tried using ssi.php but failed to get the (premier) group of a member.
Quote
// Display  User & groupID
function ssi_ug($output_method = 'echo')
{
   global $context, $txt, $scripturl;

   if ($output_method == 'echo')
   {
      if ($context['user']['is_guest'])
         echo sprintf($txt['welcome_guest'], $txt['guest_title']);
      else
         echo $context['user']['name'] ;
         echo $context['user']['regular_id_group'] ;
   }
   // Don't echo... then do what?! ----$group_id
   else
      return $context['user'];
}

Kays

Try using  $user_settings['id_group'] to get a member's primary group.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

nose

Thanx for reply,
but doesn't work for this.

Kays

Did you add $user_settings to the globals?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

nose

now I added:

global $smcFunc, $ssi_db_user, $scripturl, $ssi_db_passwd, $db_passwd, $cachedir, $user_settings ;

and

echo $user_settings['id_group'];

but no appropriate result.

Kays

Is SSI.php included?

What does a print_r return??


echo '<pre>', print_r($user_settings), '</pre>';

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

nose

#7
I added the piece of code to SSI.php

"echo '<pre>', print_r($user_settings), '</pre>'; " returns "1"

modified:
adding "$user_settings" to the globals and
"echo $user_settings['id_group'] ;" did the thing.    many thanks Kays!


Kays

Cool, you're welcome. :)

I'll mark this as solved then

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

nose

using the function

function ssi_ug($output_method = 'string')
{
global $context, $txt, $scripturl, $user_settings, $username, $level ;

if ($output_method == 'string')
{
if ($context['user']['is_guest'])
echo sprintf($txt['welcome_guest'], $txt['guest_title']);
else
$username == $context['user']['name'] ;
$level == $user_settings['id_group'] ;

return $username;
return $level;
}
// Don't echo... then do what?!
else
return $context['user'];
}

I run into new trouble:
Quote
Notice: Use of undefined constant string - assumed 'string' in /srv/www/web315/html/forum/SSI.php  on line 58
(this line: "welcome guest ..." - if nobody is logged in --- nothing if someone is logged in)
Warning: Cannot modify header information - headers already sent by (output started at /srv/www/web315/html/forum/Settings.php:1) in /srv/www/web315/html/forum/respla/index.php on line 36
line 36 is "header("Location: $redirect_str");"
in line 58 of SSI.php I wanted to shut off error handling "$ssi_on_error_method = string;" because fatal_error handling conflicted with the same of the mrbs.
How to manage this?

Advertisement: