0

I am using a custom site build in zend frameword, i also have a wordpress installed in this directory, for example:

www.mywordpressSite.com // here is my wordpress site..
www.mywordpressSite.com/frameWorkSite // here is my framework site..

All i need to get a framwork session inside wordpress theme, i tried by accessing direcct like,

$_SESSION['userId'];

I tried by making a class in framework and by including this in my wordpress site, but in vain..

Any helpful idea is greatly appreciated..

3

Wordpress doesn't use PHP session ($_SESSION). If you want to use it you need to do at your own. For example:

add_action('init', 'wpse_session_start', 1);
function wpse_session_start() {
    if(!session_id()) {
        session_start();
    }
}

But, if you want is to get the user id of the current user, you can use get_current_user_id():

<?php $user_ID = get_current_user_id(); ?> 
  • but, if i am setting session something like, $_SESSION['myUserIdFromFramework'] from framework while user is getting login there, how do i get this in wordpress, i am entirely new to wordpress, i don't even know that, this type of functionality is possible in wordpress or not, i am sure that Facebook allows this if we are using their API. – Irfan Ahmed Apr 30 '14 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.