I am creating website in WP with s2member plugin.I used these few lines inside where I used the s2member member code
$current_user = get_current_user_id(); / get current looged in user ID
$_SESSION['id']=$current_user; // put that in session
I have queries that is this the right way to set session in WP? (I used set_session on top)
Results:
- The jquery doesn’t run after if uncomment above code..
-
The grey bar on top of WP that shows current logged in user becomes complete blank,it doesn’t show any logged in user.
I thnk that there is different way to set session in WP or it doesn’t allow you to do so..
Any help in this regard.
Thanks
Not sure of the context where this is being used, but two things:
'id'
is too much of a common argument, used everywhere, try'u_id'
It comes to mind because of this WordPress Answer: List of reserved names in $_POST and $_REQUEST used by WordPress 3.5
$current_user
is a global WordPress core variable, use another name. And as suggested in the linked Answer, prefix everything.