2017 © Pedro Peláez
 

library wp-session-manager

WP Session Manager, adds $_SESSION-like functionality to WordPress.

image

wbroek/wp-session-manager

WP Session Manager, adds $_SESSION-like functionality to WordPress.

  • Sunday, March 24, 2013
  • by wbroek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 47 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WP Session Manager

Prototype session management for WordPress., (*1)

Description

Adds $_SESSION-like functionality to WordPress., (*2)

Every visitor, logged in or not, will be issued an instance of WP_Session. Their instance will be identified by an ID stored in the _wp_session cookie. Typically, session data will be stored in a WordPress transient, but if your installation has a caching system in-place (i.e. memcached), the session data might be stored in memory., (*3)

This provides plugin and theme authors the ability to use WordPress-managed session variables without having to use the standard PHP $_SESSION superglobal., (*4)

Installation

Frequently Asked Questions

How do I add session variables?, (*5)

First, make a reference to the WP_Session instance. Then, use it like an associative array, just like $_SESSION:, (*6)

$wp_session = WP_Session::get_instance();
$wp_session['user_name'] = 'User Name'; // A string
$wp_session['user_contact'] = array( 'email' => 'user@name.com' ); // An array
$wp_session['user_obj'] = new WP_User( 1 ); // An object, (*7)

How long do session variables live?, (*8)

By default, session variables will live for 24 minutes from the last time they were accessed - either read or write., (*9)

This value can be changed by using the wp_session_expiration filter:, (*10)

add_filter( 'wp_session_expiration', function() { return 60 * 60; } ); // Set expiration to 1 hour, (*11)

Additional Information

Original creator: ericmann, (*12)

The Versions

24/03 2013

dev-master

9999999-dev https://github.com/wbroek/wp-session-manager

WP Session Manager, adds $_SESSION-like functionality to WordPress.

  Sources   Download

GPLv2 or later

The Requires

  • php >=5.3.2

 

by Avatar ericmann
by wouter

plugin wordpress session session manager