Admin area only shows User ID as 1
-
Hi,
Thanks for creating the plugin and making it available.
Using the code below (most of just checks to see if the variables are being passed), everything is appearing as I would expect.
<?php session_start(); global $current_user; $current_user = wp_get_current_user(); //get_currentuserinfo(); $user = $current_user->ID; echo 'Current User ID before swap = ' . $user . "<br />"; echo 'Current Session ID before swap = ' . session_id() . "<br />"; $_SESSION['fromMain'] = "false"; if ( is_user_logged_in() ) { $r = session_id(); $_SESSION['uid'] = $r; $user = $_SESSION['uid']; echo 'Passing User Id variable = ' . $user . "<br />"; $player_id = $user; echo 'Current Session ID = ' . $_SESSION['uid'] . "<br />"; echo 'New current User ID = ' . $user . "<br />"; echo 'Current Player ID = ' . $player_id . "<br />"; if(isset($_SESSION['uid'])) { echo "<pre>"; print_r($_SESSION); echo "</pre>"; } } if(!isset($_SESSION['uid'])) { ?> <div class="alert alert-info"> <h4>Hello Stranger!</h4> </div> <?php echo do_shortcode('[TheChamp-Login]'); } ?>
However, in the Admin area table, no matter what I do or which test user I log in with, from different browsers, mobile phone, clearing cache, restarting browser etc. the User ID for not logged in is showing 0 (good), all other ID’s are showing as 1.
I have even stripped all the code out to just –
session_start(); $_SESSION['fromMain'] = "false";
but still all the User ID’s are showing 1 for logged in User.
Can you spot what I am doing wrong?
Thanks!
https://www.ads-software.com/plugins/wp-native-php-sessions/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Admin area only shows User ID as 1’ is closed to new replies.