Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Frontainer
#1
Frontainer's current version: 1.0
 
What is Frontainer

Frontainer is a powerful frontend user management plugin based on ItemManager for GetSimple-CMS and perfect to generate password protected, private areas on the GetSimple website. Frontainer is a simple and useful tool for plugin developers, provides a good basis for further development of user management based scripts or e-commerce plugins, for instance.

Application example: [ SimpleForum theme ]

Frontainer Features
  1. Frontend login form
  2. Registration and the lost password form
  3. Fully customizable HTML, CSS
  4. Fully scalable and extendable functionality
  5. Multilingual (currently English language file included)
 

Requirements

To run Frontainer on your GetSimple website just needs a number of things:

    1. ItemManager 2.3+ plugin must be installed and configured
    2. Users category must have been created in ItemManager (see bellow: Creating ItemManager's Users Category)
    3. Configured mail server to send and receive emails from your GetSimple site

Installation

  1. First of, create following pages in admin, these pages are used by Frontainer for integrate corresponding functionality.
    1. Login
    2. Signup
    3. Accounts 
    4. Logout 
    5. Recovery 
    6. Activate
Please make sure that the resulting page slugs are exactly the same as page names: login, signup, accounts, etc.

  1. Install/activate Frontainer v. 1.0 from GitHub or Extend
  2. Go to Plugins > Frontainer settings and put there your eMail data (used by Frontainer to build the email-content for user authentification)

Creating ItemManager's Users category

  1. Let’s go to ItemManager’s tab > Categories and create there a category named Users:
  2. After that go to ItemManager’s Fields menu select Users category and click Reload, then create following fields for it:
    1. Name: email, Label: eMail (or your choice), Type: Text field
    2. Name: password, Label: Password (or your choice), Type: Password
    3. Name: recovery, Label: Recovery password (or your choice), Type: Hidden field
Preparing your theme for using Frontainer

Preparing your theme for using Frontainer is really easy. Open template.php file in your editor and add the following lines to the very beginning (first line).

Code:
<?php
if(!defined('IN_GS')) die();
if(!isset($_SESSION)){session_start();}
$fnavi = array(
    'login' => null,
    'signup' => null,
    'accounts' => null,
    'logout' => null,
    'recovery' => null
);
$fcontent = '';
if(function_exists('frontainer_get_content')) {
    $fcontent = frontainer_get_content();
    $fnavi['login'] = htmlspecialchars(get_section_url(LOGIN_SLUG));
    $fnavi['signup'] = htmlspecialchars(get_section_url(SIGNUP_SLUG));
    $fnavi['accounts'] = htmlspecialchars(get_section_url(ACCOUNTS_SLUG));
    $fnavi['logout'] = htmlspecialchars(get_section_url(LOGOUT_SLUG));
    $fnavi['recovery'] = htmlspecialchars(get_section_url(RECOVERY_SLUG));
}
?>

After that you’ll need to add a single line anywhere within the body of your template.php file for the output of Frontier’s contents:

Code:
<?php echo $fcontent; ?>
 
To access Frontainers sections and to switch between Frontainers pages you can use following navigation structure for example:

Code:
<ul class="nav navbar-nav">
    <li><a href="<?php get_site_url(); ?>forum/">Forum</a></li>
    <?php
    if(!isset($_SESSION['loggedin'])) {
        echo '<li ';
        if($id == $fnavi['login'] || $id == $fnavi['recovery'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['login'].'">Login</a></li>';
        echo '<li ';
        if($id == $fnavi['signup'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['signup'].'">Sign up</a></li>';
    } else {
        echo '<li ';
        if($id == $fnavi['accounts'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['accounts'].'">Private</a></li>';
        echo '<li ';
        if($id == $fnavi['logout'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['logout'].'">Logout</a></li>';
    }
    ?>
</ul>

And that is all you need to do to run Frontainer!

User's private area

After a successful login the user is redirected by default to www.your_site.com/accounts/ page in the users private section.
To modify this private area, just edit '/plugins/frontainer/loggedin.php' file within the 'build_user_area()' function and put there any content you like, after: //////////   Your can put your content here //////////// comment. You can delete all lines subsequent to that code


Using Frontainer session variables

To check whether the user is logged use code:

Code:
<?php
if(!empty($_SESSION['loggedin'])) {
// This is the theme section for logged in users only
}
?>

You can get the logged in users ID on this way:

Code:
<?php
$user_id = (!empty($_SESSION['userid']) ? (int) $_SESSION['userid'] : false);
?>

Have fun!
Reply


Messages In This Thread
Frontainer - by Bigin - 2016-02-22, 23:48:10
RE: Frontainer - by Tzvook - 2016-02-24, 07:20:45
RE: Frontainer - by Bigin - 2016-02-24, 07:25:28
RE: Frontainer - by Tzvook - 2016-02-24, 07:39:28
RE: Frontainer - by Bigin - 2016-02-24, 07:50:04
RE: Frontainer - by Tzvook - 2016-02-24, 07:54:03
RE: Frontainer - by Bigin - 2016-02-24, 07:59:36
RE: Frontainer - by DesruX - 2016-04-12, 07:55:41
RE: Frontainer - by Bigin - 2016-04-12, 17:41:37
RE: Frontainer - by Bigin - 2016-04-13, 00:17:33
RE: Frontainer - by DesruX - 2016-04-13, 00:36:22
RE: Frontainer - by Bigin - 2016-04-13, 01:37:49
RE: Frontainer - by DesruX - 2016-04-13, 04:24:49
RE: Frontainer - by Bigin - 2016-04-13, 05:25:05
RE: Frontainer - by DesruX - 2016-04-13, 05:32:45
RE: Frontainer - by Bigin - 2016-04-13, 05:51:48
RE: Frontainer - by DesruX - 2016-04-15, 06:45:34
RE: Frontainer - by Bigin - 2016-04-15, 19:39:53
RE: Frontainer - by Bigin - 2016-04-12, 18:08:27
RE: Frontainer - by DesruX - 2016-04-12, 23:49:06
RE: Frontainer - by Bigin - 2016-04-13, 00:20:00
RE: Frontainer - by DesruX - 2016-04-13, 00:31:16
RE: Frontainer - by Bigin - 2016-04-12, 20:14:09
RE: Frontainer - by Bigin - 2016-04-15, 20:12:41
RE: Frontainer - by jeckyl - 2017-02-07, 01:55:19
RE: Frontainer - by Bigin - 2017-02-07, 03:58:00
RE: Frontainer - by jeckyl - 2017-02-07, 04:36:08
RE: Frontainer - by Bigin - 2017-02-07, 05:16:52
RE: Frontainer - by jeckyl - 2017-02-07, 06:13:24
RE: Frontainer - by Bigin - 2017-02-07, 08:49:33
RE: Frontainer - by jeckyl - 2017-02-07, 09:14:22
RE: Frontainer - by nicco - 2017-05-12, 19:26:45
RE: Frontainer - by Bigin - 2017-05-12, 20:38:15
RE: Frontainer - by nicco - 2017-05-12, 23:28:17
RE: Frontainer - by Bigin - 2017-05-13, 00:58:52
RE: Frontainer - by nicco - 2017-05-13, 02:11:24
RE: Frontainer - by Bigin - 2017-05-13, 02:51:45
RE: Frontainer - by nicco - 2017-05-13, 03:04:30
RE: Frontainer - by Bigin - 2017-05-13, 03:09:48
RE: Frontainer - by Carlos - 2017-05-13, 03:19:09
RE: Frontainer - by Bigin - 2017-05-13, 03:28:10
RE: Frontainer - by Stéphane - 2020-04-13, 03:40:16
RE: Frontainer - by Bigin - 2020-04-13, 04:16:35
RE: Frontainer - by Stéphane - 2020-04-13, 08:02:32
RE: Frontainer - by Bigin - 2020-04-13, 20:32:51
RE: Frontainer - by Stéphane - 2020-04-13, 22:46:48



Users browsing this thread: 1 Guest(s)