1. Configuration of phpRegister

1.1 Import The Database

1.1.1 With phpMyAdmin

First, create the database you want to use:

Create database with phpMyAdmin

Then, (1) Select database from the left menu, (2) Database must be selected and so written just after your server name, here localhost.

Select database with phpMyAdmin

Using the SQL file phpregister-1.2-databaseImport.sql provided with your phpRegister package, you can either create the Database schema tab with a copy/paste of this file OR use the Import tab and select this file:

Execute SQL request to create Tables of phpRegister with phpMyAdmin
OR
Create Tables of phpRegister with uploading SQL file in phpMyAdmin

1.1.2 With command lines

Connect to your server through ssh and change your current path to go where the sql file phpregister-1.2-databaseImport.sql provided with your phpRegister package is, then:



    
    

1.2 Config files

This configuration files are in the root directory.



    
    

1.2.1 config.inc.php

This contains general configuration information. When phpRegister is executed, it consults the configuration file to see what parameters are in effect.

Before starting, you must change this values:



    
    

1.2.2 config_smtp.inc.php

You may not want to run your own mail server:

  • Maintenance is time-consuming
  • Hard for staying off blacklists
  • Troubleshooting is difficult
  • There are easy alternatives mail services

Here are some alternatives: Google Apps, Gandi (requires that the domain is registered through them), FastMail, Sendgrid, Postmark.

The configuration file config_smtp.inc.php will be used by the class PHPMailer (Version 5).


    


    

If $configEmail['isSMTP'] = false; then the localhost apache configuration will be used to send emails.

It's important to correctly configure the email section in order to receive links to activate accounts.

To test your email configuration, create the file test-email.php in the root directory with this code:


    

    

You must receive an email like this:

Example of mail sent successfully

Once you received this test email, you should delete the file test-email.php from the server.

1.2.3 config_adminsidebar.inc.php

This configuration file is used for the Administration section.


    

To add/modify/remove an item in the Admin sidebar, modify as well the function show__adminSidebar() from the file admin_display.inc.php which is in your admin folder.


    



    
    

1.3 Create your OAuth keys

1.3.1 Facebook

First, Log in to your Facebook account on Facebook.com, then go to the URL: https://developers.facebook.com/products/. You will have to reenter your password and click on Register to register as a Facebook Developer if not already done:

Facebook oauth, register as developper

Then click on Create App and create your project:

Facebook OAuth, Create new App ID

Once your App is created, you are redirected to Products / Add product page, create a Facebook login:

Facebook OAuth, add product Facebook Login

Now, (1) specify your Valid OAuth redirect URIs which are links to your file oauth_facebook.php from the folder /account/oauth/, you can add localhost too, then click on (2) Save Changes:

Facebook OAuth, Specify valid OAuth redirect URIs

Go to Settings / Basic to retrieve your Application ID and your App secret. Don't forget to prepare your website policy and terms, you will have to specify an URL to them or your App might be blocked. They can have the same URL. Then click on Save Changes:

FAcebook OAuth, Basic settings save changes

Copy/paste them in your config.inc.php file:


    

You can now Log in with Facebook but only with your Facebook account. If you try with another Facebook account, you will get an Error Facebook message telling this app is still in development mode:

Facebook OAuth, Error Message App Not Set Up: This App is still in development mode

To Log in with others Facebook accounts you can add testers from page Roles / Roles or create Test Users which are temporary Facebook accounts on the page Role / Test Users.

Once your project is ready for public, go to the page App review and set your App in public mode:

Facebook OAuth, switch App to public mode

1.3.2 Google+

First, Log in to your Google account on Gmail.com and then go to the URL: https://console.developers.google.com/apis/library to create your project:

Google OAuth, create project

And create your project:

Google Oauth, set project name

Once your project is created, you are redirected to a page where you have to select the credential type you want, you have to choose OAuth client ID:

Google OAuth, create credentials, OAuth client ID

Now, you are asked to set a product name, click on "Configure consent screen":

Google OAuth, configure consent screen

Don't forget to prepare your website policy and terms, you will have to specify an URL to your policy and terms, it can be the same URL:

Google OAuth, product logo URL, privacy policy, terms of service URL

Then, click on Credentials and select OAuth client ID once again:

Google OAuth, select credentials again

Now, select Web application and specify your authorized redirect URIs which are links to your file oauth_google.php from the folder /account/oauth/, you can add localhost too:

Google OAuth, select Application type, Web application

It's done, you can retrieve your client ID and your client secret.

Google OAuth, recover client ID, client secret

Copy/paste them in your config.inc.php file:



    

You can modify, add or delete URIs by clicking on the credential. All credentials will have the same OAuth consent screen, you have to create another project to use another OAuth consent screen.

Google OAuth, modify credential

When you make a modification, this can take few minutes before this change is up and running.

1.3.3 Windows Live

You must have a Microsoft account to create a Windows Live OAuth Application. If you don't have yet a live.com or hotmail.com account, you can create a Microsoft account with an existing email from https://account.microsoft.com/about/ and click Create account.

Once you have a Microsoft account, go to this URL to create an App: https://apps.dev.microsoft.com/#/appList

If you go to this URL for the first time, you might be redirected to https://apps.dev.microsoft.com/Landing..., then just click on Sign in:

Windows Live OAuth, microsoft account sign in

Once you are logged in https://apps.dev.microsoft.com/#/appList, click on Add an app:

Windows Live OAuth, add an app

Choose the name of your App and click Create application:

Windows Live OAuth, my project name

The registration page is now displayed. Click on (1) Generate new password, a popup will appear with your password generated. This is the only one time the password will be displayed. You have to store it securely. You will need to specify this password on your phpRegister file config.inc.php

Then click on (2) Add platform and add a Web platform.

Windows Live OAuth, My Project registration, project name, generate new password, Add platform

Down the page, don't forget to prepare your website policy and terms, you will have to specify an URL to them or your App might be blocked. They can have the same URL.

Copy/Paste your Application ID and the password you stored in the phpRegister file config.inc.php.


    

Then click on save.

Windows Live OAuth, logo, termes of service, privacy statement, save

1.4 The first Admin User

To create the first Admin user, go to the admin folder of phpRegister with your browser.

As long as there is no users with spcecial rights, in the admin part, you get a form to create an Admin user.

phpMyAdmin select account which will be an administrator

1.4.1 Add admin rights to an existing user

  • From the phpRegister Administration section

    Add admin rights to user
    Add admin rights to user
  • With phpMyAdmin

    Browse the table pr__user and click on edit of the account you want to give admin rights

    phpMyAdmin select account which will be an administrator

    Type admin in the last field adminrights (1) and then click on Go (2).

    phpMyAdmin Insert admin in the field adminrights of the table pr__user
  • With command lines

    Connect to your server through ssh and then connect to your database to launch the sql request:

    
                

1.4.2 Access Admin section

Then you can access to the Admin section through the new button Administration from My Account menu.

phpMyAdmin select account which will be an administrator