I'd like to run a script on login that updates a variable I added to the _members table. PHP: function updateLoginCount($user_id) { global $db; $u = $db->get_user($user_id); $count = $u['up_login_count']; $u['up_login_count'] = $count + 1; $db->update_user($user_id, $u);} It seems to be getting the value from $u['up_login_count'] but does not update the value in the db when I use the update_user method. Any have any thoughts as to why this would not work. Also, right now I'm trying to call this function from a simple PHP page as a test from outside the amember folder but i'm including the amember config. Is it possible to get it working from here. When I do get it working, where would be the proper place to include this function? I assume in login.php I am using php_include protection if that matters at all. Thanks Fish ><>
Anyone have any ideas on how to do this? Is there a place I can put a function call on login to create a login counter. I tried placing this above 'html_redirect()' in login.php but it did not work. (I have created a column in my members table called li_login_count) Code: function updateLoginCount($user_id) { global $db; $u = $db->get_user($user_id); $count = $u['li_login_count']; $u['li_login_count'] = $count + 1; $db->update_user($user_id, $u); } updateLoginCount($_SESSION['_amember_user']['member_id']); Any help would be appreciated. Thanks
Just an FYI to everyone. Alex helped me out with this in the Support area. One thing I had wrong was that I had created some additional fields in the members table using mysql instead of using "add fields". When doing so, it can't make DB changes to that column with the $db->update_user($user_id, $u); Once I made recreated the field with "add fields", it worked great. Also, Since I wanted to update each time the user logged in, and I was using php_include as protection, I added the function call to /amember/plugins/protect/php_include/check.inc.php and it worked great for each login. Hope this helps someone.