Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

As many of you know WPEngine don't support PHP SESSIONS unless the user is logged in. In that case WPEngine start taking consideration of PHP SESSIONS and the software based on hybridauth like Wordpress Social Login or Wordpress Social Invitations will work ok.

So my question is : There is a way to fake a Wordpress login?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You could create a dummy user (with no rights) and log in every visitor using this dummy user. This could be done pretty easily:

wp_set_auth_cookie($uid, true);
wp_set_current_user($uid);

But in my opinion that's a rather flawy workaround.

Your main problem is that all pages for not-logged-in users come from the page-cache. That also means that all users get the same html output as long as there is page-caching active. So there can't be any difference to your pages based on the visitor. All visitors get the same output.

A better way would be to create a ticket at WPEngine and ask them to disable page-caching for your site. That's actually also the way they suggest on the page you linked to.

share|improve this answer
    
I don't have am account on WPengine, just my plugin users got. The idea of this is that the user should appear not logged to Wordpress, but logged to WPengine :D –  chifliiiii Jul 13 '13 at 20:15
    
Ah I see. Seems like WPengine is using the wordpress login cookie to determine if one is logged in or not: WordPress sets cookies related to that login, and our system is set up to recognize those WordPress login cookies. You may have a chance in creating a fake cookie with an invalid session. If WPEngine is only looking for the existence of the login cookie. But this seems like a really dirty hack, that could break other tings. Maybe you should just tell your users to contact WPEngine and let them disable caching (place it in your FAQ or something). –  s1lv3r Jul 15 '13 at 8:57
    
Exactly, im looking for a dirty hack :) –  chifliiiii Jul 15 '13 at 14:11
2  
:-P Then you may try to create a cookie named wordpress_logged_in_{random_md5_1} and value user|{current_timestamp}|{another_random_md5_2} and an cookie wordpress_{random_md5_1} and value user|{current_timestamp}|{another_random_md5_3}. You won't be really logged in as you don't have a real session, but if WPEngine only looks for the existence of a session cookie as stated in their docs, there's a good chance that they'll eat it. –  s1lv3r Jul 15 '13 at 14:21
    
will try that, thanks –  chifliiiii Jul 15 '13 at 15:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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