Adding actions immediatly after login

7 views
Skip to first unread message

Patrick

unread,
Sep 6, 2012, 11:35:04 AM9/6/12
to manchester-word...@googlegroups.com
Hi,
I have a function I want to run immediately after a user has loged in/been successfully authenticated.

For background - I'm storing wether a user has logged in using an iPad and am using and separate mobile detect script.

Anyway, here's my code - hope you can help


/*
Plugin Name: STW - Mobile Detect
Description: Provide Mobile detect functionality based on http://code.google.com/p/php-mobile-detect/
Version: 0.1
*/
require_once('mobile_detect.php');
$mobile = new Mobile_Detect();


function log_my_device() {
global $current_user, $mobile;
$username = $current_user->user_login;
$userid = $current_user->ID;
$loggedIn = is_user_logged_in();
if ($loggedIn){
if ( $mobile->isiPad() ){
update_user_meta( $userid, 'IPad_user', '1');
}
}
}
add_action('wp_signon', 'log_my_device');

Reply all
Reply to author
Forward
0 new messages