WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] how to setcookie in wp for custom login (3 posts)

  1. capxxx
    Member
    Posted 9 years ago #

    I make a custom login form on my front blog page where me and my user author can key in username and password and it will log them in. When user click login, it will check for match from my wordpress database user table and if it match i setcookie and redirect them to wp-login.php. But it didnt work. The wp-login.php form will show up instead of go into admin panel. I use this code to setcookie-->
    setcookie('wordpressuser_' . COOKIEHASH, $username,time() + 31536000,$cookiepath);
    setcookie('wordpresspass_' . COOKIEHASH, $password,time() + 31536000,$cookiepath);
    header("Location:wp-login.php");

    where $username and $password is what the people key in.
    Can someone please help me!!
    Thank you.

  2. skippy
    Member
    Posted 9 years ago #

    Check in /wp-includes/pluggable-functions.php for the wp_setcookie() funciton, for the specific cookie contents.

  3. capxxx
    Member
    Posted 9 years ago #

    Thank you very much!! it works, what i did was just add the value for cookiehash and cookiepath to what i wish for according to the wp_setcookie() function in pluggable-functions.php

    again thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags