• Plans & Pricing
  • Log in
  • Get started
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress 
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Get started
  • Sign up
  • Log in
About
  • Plans & Pricing
Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress  
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Jetpack App
  • Learn more
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Search
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Forums / Cakephp wordpress auto login

Cakephp wordpress auto login

  • Unknown's avatar
    ranjangoyal · Member · Dec 5, 2008 at 1:00 pm
    • Copy link Copy link
    • Add topic to favorites Add topic to favorites

    Hi All,

    When users register on my main site, it uses the WordPress database. The accounts share the same username and password.

    Now when users login to my main site, I want the user to login into WordPress automatically. How can I do this?

    To achieve this I set a cookie to match that of wordpress cookie(In case we use wordpress login form to login) in the following manner. I call this script after logging into main site.

    $cookiehash = md5($blog_directory_web_path);

    $siteCookiePath = ‘/blog/forum/’;// WordPress is working with bbpress

    define(‘COOKIE_DOMAIN’, false);

    $expiration = 0;
    if($remember){

    $expiration = $expire = time() + 1209600;

    }else{

    $expiration = time() + 172800;
    $expire = 0;
    }

    $data = $username . ‘|’ . $expiration;

    $key = hash_hmac(‘md5’, $data, ‘phrase 1’);
    $hash = hash_hmac(‘md5’, $data, $key);
    $cookie = $username . ‘|’ . $expiration . ‘|’ . $hash;

    setcookie(‘wordpress_’.$cookiehash, $cookie, $expire, $siteCookiePath, COOKIE_DOMAIN);

    setcookie(‘wordpress_’.$cookiehash, $cookie, $expire, ‘/’, COOKIE_DOMAIN);

    How can I set wordpress Cookie from Outside WordPress2.6.1.

    Following links are useless.

    http://wordpress.org/support/topic/81942
    http://mu.wordpress.org/forums/topic.php?id=4056
    http://codex.wordpress.org/WordPress_Cookies

    I am using 2.6.1.

    Please help.

    Regards,
    Ranjan

  • Unknown's avatar
    rosclarke · Member · Dec 5, 2008 at 1:04 pm
    • Copy link Copy link

    You’re in the wrong place. http://wordpress.org/support.

  • The topic ‘Cakephp wordpress auto login’ is closed to new replies.

Tags

  • Cakephp + wordpress auto login

About this topic

  • In: Support
  • 2 participants
  • 1 reply
  • Last activity 17 years
  • Latest reply from ranjangoyal

Couldn't find what you needed?

Contact us

Contact us

Get answers from our AI assistant, with access to 24/7 expert human support on paid plans.

Browse our guides

Browse our guides

Find step-by-step solutions to common questions in our comprehensive guides.

WordPress.com

Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Professional Email
  • Website Design Services
  • WordPress Studio
  • Enterprise WordPress
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • WordPress.com Blog
  • Business Name Generator
  • Logo Maker
  • WordPress.com Reader
  • Accessibility
  • Remove Subscriptions
Help
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
  • Developer Resources
Company
  • About
  • Press
  • Terms of Service
  • Privacy Policy
  • Do Not Sell or Share My Personal Information
  • Privacy Notice for California Users
DeutschEspañolFrançaisBahasa IndonesiaItalianoNederlandsPortuguês do BrasilSvenskaTürkçeРусскийالعربيةעִבְרִית日本語한국어简体中文繁體中文English

Mobile Apps

  • Download on the App Store
  • Get it on Google Play

Social Media

  • WordPress.com on Facebook
  • WordPress.com on X (Twitter)
  • WordPress.com on Instagram
  • WordPress.com on YouTube

Automattic

Automattic
Work With Us
    • WordPress.com Forums
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • Manage subscriptions