Articles Tagged 'Login'

WordPress: Write a personal log

Starting from the post WordPress: step by step how to create their own login , performed the login procedure could be useful to indicate in our Blog Link to disconnect or log out. We will not use again the standard procedures of WordPress, but as we will see log out at a low level. First we must determine whether a user is logged in or not. This is possible simply by querying the variable $user_ID WordPress. For example:

1
2
3
$user_ID != '' ) { // oppure if( is_user_logged_in() ) { if ($ user_id! ='') {/ / or if (is_user_logged_in ()) {
/ / A user is "logged in" ...
}

Once we know that a user is "logged" into the system, we can insert a simple link to our logout page. Then create a page, for example, logout.php , and inserting the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/ **
* Performs logout
*
* @ Author Giovambattista Fazioli
* @ @ Email g.fazioli undolog.com
* @ Web http://www.undolog.com
* /
/ / Invoke bootstrap WordPress
( 'wp-config.php' ) ; @ Require_once ('wp-config.php');
( 'wp-includes/pluggable.php' ) ; @ Require_once ('wp-includes/pluggable.php');
/ / Wp logout
wp_logout ();
/ / Load any other page
"Location: /" ) ; header ("Location: /");

And just then "link" our procedures to provide a logout:

1
2
3
$user_ID != '' ) { if ($ user_id! ='') {
; echo 'Run <a href="logout.php"> logout </ a>';
}

Continued ...

WordPress: step by step how to create their own login

In this tutorial we will see how to create a personal login procedure, also using Ajax functionality via jQuery . ). There are several ways to customize the login of WordPress, for example by the use of hooks and filters ( add_action() , add_filter() ). Here we will use a lower-level procedure, although there still interfaces to the kernel of WordPress. In addition we will attempt to validate a user through the dupla email / password.

Why create their own login?

  • In some contexts can return uitle have maximum control on the login page, to propose a custom layout to our registered users. You can also enhance the page with useful information, a logo from the classic "Lost Password?"
  • To allow access via the email (as in the example discussed here) instead of user_login standard WordPress
  • To be able to enter a login panel in the sidebar of our blog
  • And finally, to have a skeleton - and an idea - a great Plugin : D

Environment

In our example / tutorial we will work on the root of a folder inside of WordPress mylogin . . We create two php files within this folder: index.php and logon.php . The first will contain our login interface with all functions JavaScript / jQuery we need. The second file, logon.php , will contain the code for user validation. e una cartella images . Then create a folder css and within this file layout.css and folder images . Inside the images folder insert a classic Ajax loader: create it online AjaxLoad.info . At the end you should have:

  • mylogin
  • index.php
  • logon.php
  • Feed
  • Layout.css
  • images
  • ajax-loader.gif

Continued ...


Stop SOPA