EasyLogin v1.3

User Membership System


Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!

This script requires at least PHP 5.3 (with PDO) MySQL, OpenSSL, cURL.

Watch the video & read the information bellow:

To integrate this script all you have to do is: 

<script src="assets/js/jquery-1.11.0.min.js"></script>
<?php
    // Path to load.php 
    require_once 'includes/load.php';
    $EL = EasyLogin::getInstance();
    // Load templates for modals
    load_templates();
?>

Now you can use the script functions to do cool things. Here is an example to display Sign in / Sign up buttons as well as the buttons after the user has logged.

<?php if (is_user_logged_in()): ?>
	Howdy, <?php echo current_user('username'); ?> | 
	<a href="#" data-toggle="modal" data-target="#EL_account">My Account</a> | 
	<?php if (current_user('role') == 'admin'): ?>
	         <a href="admin/">Admin</a> |
	<?php endif; ?>
	<a href="#" onclick="EasyLogin.signout();">Sign out</a>
	<br><img src="<?php echo current_user('avatar'); ?>" class="user-avatar" width="100" height="100"/>
<?php else: ?>
	<a href="#" data-toggle="modal" data-target="#EL_signin">Sign in</a> |
	<a href="#" data-toggle="modal" data-target="#EL_signup">Sign up</a>
<?php endif; ?>

 

As in the example above the butons have some attributes:

Sign in button with data-toggle="modal" data-target="#EL_signin"

<a href="#" data-toggle="modal" data-target="#EL_signin">Sign in</a>

Sign up button with data-toggle="modal" data-target="#EL_signup"

<a href="#" data-toggle="modal" data-target="#EL_signup">Sign up</a>

My Account button with data-toggle="modal" data-target="#EL_account"

<a href="#" data-toggle="modal" data-target="#EL_account">My Account</a> 

Sign out button with onclick="EasyLogin.signout();"

<a href="#" onclick="EasyLogin.signout();">Sign out</a>

In this section are described all settings from the config.php file.

Note: To access any config item from config.php use $EL->config_item('item_from_config');

The custom fields can be texttextarea, checkbox, select;

To add custom fields edit config.php and add the type of custom field you want.

Example:

//Custom fields
'custom_fields' => array(
    array(
        'type' => 'textarea', // Custom field type
        'name' => 'about',    // Custom field name
        'label' => 'About'    // Custom field label
    ),
),

To validate the custom fields edit includes/functions.php and add a validation callback function

function validate_custom_field_about($val) {
    // Validation logic
    return true / false; 
}

The function name is validate_custom_field_about where about is the name of the field defined in the custom_fields array. The function must return true or false.

To get the value of a custom field use: get_usermeta($user_id, $meta_key). For more functions go to the Functions section bellow.

In this section are described the major functions that you can use. Plase note there are 2 types, functions (like is_user_logged_in()) and methods (like $EL->is_logged());

To use any of the functtions/methods you must include load.php;

Functions:

Methods (most of the methods are used in the functions above):

Use a method like this:

 <?php
    $EL = EasyLogin::getInstance(); // Get the instance
    $home_url = $EL->config_item('home_url'); // Access the config_item method
?> 

To see all the available  methods edit EasyLogin.class.php.

HTML

All of the HTML you may want to edit is located in templates.php. Make sure you don't break something.

CSS

The main css is easylogin.css and for the avatar uploader  css imgPicker.css

JavaScript

This script requires jQuery.

The main JavaScript files are easylogin.min.js (main file), bootstrap.min.js (for modals), imgPicker.min.js (for avatar uploader). If you want the edit them, edit the uncompressed versions.

PHP

The PHP files are located in the includes/ folder (except config.php)

 

I've used the following libraries:

Once again, thank you so much for purchasing this script. As I said at the beginning, I'd be glad to help you if you have any questions relating to this script. Also if you have any suggestions for new features that you want please let me know.

Cretu Eusebiu,

HazzardWeb