SSI FAQ Expert: Difference between revisions From Online Manual

Jump to: navigation, search
No edit summary
No edit summary
Line 1: Line 1:
==Expert SSI FAQ==
==Expert SSI FAQ==


Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the '[[SSI_FAQ_Basic|Basic SSI FAQ]]' and '[[SSI_FAQ_Advanced|Advanced SSI FAQ]]'. This FAQ has commonly asked SSI questions as well as tips and tricks, you will also find a list of attached scripts to the end of this post that may help you with what you have learned in this FAQ. If at the end you still have questions or comments, please post them.
Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the '[[SSI_FAQ_Basic|Basic SSI FAQ]]' and '[[SSI_FAQ_Advanced|Advanced SSI FAQ]]'. This FAQ has commonly asked SSI questions as well as tips and tricks, you will also find a list of attached scripts to the end of this post that may help you with what you have learned in this FAQ.  
Your feedback if very important to me.


'''**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE**'''
'''**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE**'''

Revision as of 15:09, 7 June 2013

Expert SSI FAQ

Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the 'Basic SSI FAQ' and 'Advanced SSI FAQ'. This FAQ has commonly asked SSI questions as well as tips and tricks, you will also find a list of attached scripts to the end of this post that may help you with what you have learned in this FAQ.

**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE**

Everything done here is done without having to edit 'SSI.php'

How can I check if a user is part of a special membergroup?

We have already learned how to tell if a person is a guest, user or admin, but now we can also check if a user is part of a special membergroup, lets take an example to help us out:

Example:

You have a site, and a forum, and you have made a special membergroup where some users are part of, you want that membergroup to have access to a special page, and other users will see an error message.

This can be easily done, first, you need to know that special membergroup ID, go to 'Edit Membergroups', in your admin center, there you should see your membergroup, click on the 'Modify' link of your membergroup, then in the URL you should see something like this: 'action=membergroups;sa=edit;id=#'. You should see a number instead of the blue '#' shown, that number is that membergroup ID.

Now that you got the membergroup ID, we can continue. This is the code we will be using: We are assuming that id=9 is our special membergroup for our example!


<?php

if (in_array(9, $user_info['groups']))
   {
       echo 'Yay! Im in group 9!';
   }
else
   {
       echo 'We are sorry, it seems you dont have access to this page.';
   }

?>

Well thats how you can do that, you guys know the rest! :P


Is there anything else?

Glad you asked, because just so happens as there is some more, SSI has some advanced configuration that you can define with a simple code, here are the configurations that you can change.

$ssi_gzip = 'true/false'; $ssi_ban = 'true/false'; $ssi_theme = ' themeID# '; $ssi_layers = array('main');

Simple write these variables in your SSI page before the incude statment, here is a working example:


<?php

$ssi_gzip = false;
$ssi_ban = true;
$ssi_theme = '2';
$ssi_layers = array('main');

ob_start();

require("/SSI.php");

?>

Lets explain the above code:

  • $ssi_gzip = false; means gzip is turned off.
  • $ssi_ban = true; means a banned forum user will be banned also in the SSI page.
  • $ssi_theme = '2'; uses the theme [images, buttons, colors] with ID=2, which usually is classic theme.
  • $ssi_layers = array('main'); uses the pair of main sub templates.
  • ob_start(); is needed not to get errors.
  • require("/SSI.php"); note its after the variables, but before any output.

Dont worry if it looks a bit hard, this is the expert faq. :) Just experiment with it and you will get the hang of it.


Well this pretty much covers the expert Guide, dont quote me on this, but maybe i'll write a Master SSI FAQ later on.

Copied from http://www.simplemachines.org/community/index.php?topic=13205.0



Advertisement: