Every time I use wp_get_current_user() my plugin stops working
-
I have been trying to make a sign-out plugin that allows users to sign out from military training activities that they should be at. After they fill out a form explaining why they are not going to be at an activity, they submit it, and it puts all the data into a mysql database. I am trying to save the user’s id to their other data so we can tell who is signing out, but everything I have tried breaks the plugin, and gives me the white screen of death.
Thanks for your help. Here is my code to get the users id:
function f2user() { // Get the current user's info $current_user = wp_get_current_user(); if ( !($current_user instanceof WP_User) ) return; return $current_user->ID; } $usersid = get_current_user_id(); $activity = $_POST['activity']; $reason = $_POST['reason']; $explanation = $_POST['explanation'];
I just need the $usersid = the user’s ID number so that I can save it with the rest of their form.
- The topic ‘Every time I use wp_get_current_user() my plugin stops working’ is closed to new replies.