Is this right?

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
User avatar
aled owen
Registered User
Posts: 59
Joined: Sat Oct 08, 2005 9:28 am
Location: Manchester, UK

Is this right?

Post by aled owen »

For authorization on phpBB3?

Code: Select all

<?php
if ($user->data['is_registered'])
{
echo "This is what the user will see!";
}
else
{
echo "This is what a guest would see!";
}
?>
Will phpBB2 be supported after January 1st?
http://www.phpbb.com/community/viewtopi ... &p=7621235
User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK

Re: Is this right?

Post by karlsemple »

assuming you have got the phpBB session management working on the page that code is included on ...then yes :)
Image
LegosJedi
Registered User
Posts: 10
Joined: Wed Oct 18, 2006 4:41 pm

Re: Is this right?

Post by LegosJedi »

Then how would you go about check if a user is in a certain usergroup?
User avatar
aled owen
Registered User
Posts: 59
Joined: Sat Oct 08, 2005 9:28 am
Location: Manchester, UK

Re: Is this right?

Post by aled owen »

LegosJedi wrote: Then how would you go about check if a user is in a certain usergroup?


If it is in somewhat simaler to phpBB2 I think it would be:

Code: Select all

<?php
if ($user->data['is_registered'])
{
  if ($user->data['is_admin'])
  {
    echo "Hello";
  }
  else
  {
    echo "You are a user?";
  }
}
else
{
  echo "You are a guest?";
}
Hi Jason, welcome to phpBB forums! That might not work because I cannot find something to validate it but would any of the support team be able to guide our way?

-Aled
Will phpBB2 be supported after January 1st?
http://www.phpbb.com/community/viewtopi ... &p=7621235
User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK

Re: Is this right?

Post by karlsemple »

I think you should really start by reading this through completely

http://www.phpbb.com/mods/documentation/
Image
LegosJedi
Registered User
Posts: 10
Joined: Wed Oct 18, 2006 4:41 pm

Re: Is this right?

Post by LegosJedi »

Thanks, I will.
zenkinz
Registered User
Posts: 84
Joined: Mon Dec 30, 2002 2:18 pm

Re: Is this right?

Post by zenkinz »

aled owen wrote: For authorization on phpBB3?

Code: Select all

<?php
if ($user->data['is_registered'])
{
echo "This is what the user will see!";
}
else
{
echo "This is what a guest would see!";
}
?>


you should really use the template to manage the content and how they are display, something like the following

Code: Select all


<!-- IF S_USER_LOGGED_IN -->

  <span> you have logged in, so this is what you will see</span>

<!-- ELSE -->

  <span> you are guest, this is what you will see </span>

<!-- ENDIF -->

far more straight forward than trying to do all these within a php script.
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm

Re: Is this right?

Post by Handyman` »

Yep… that works as well.
The php side is more for if you want to make the login box show when the users enters the page… but either way is good and Very Flexible it is.

Hmm… seems I missed the point of the topic and the first post… page was being weird on me.
Anyways, aled owen, you don't want to do "echo" with phpBB… everything should go in the templates and text should go in the language file.
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)

Return to “phpBB Discussion”