开发者

How do I pass a parameter from one page into another in wordpress

Greetings: I am trying to pass a parameter from one page into another o开发者_StackOverflow社区ne. How do I do this? Is there a way when someone logs into the application, I do not want them to log in twice. I want the other page to know that this user is already logged in and give him or her OK to use the other page. This is just to prevent multiple log ins.

I appriciate any help I can get on this isue.

Best Regards, David Ramezani


Agree w/Jacob: Add a flag to the session to show that the user is logged in. You can access that session variable from any page that the user accesses until they log out or close the browser.


WordPress handles this for you by setting 2 cookies when you log in:

When you log into WordPress from http://example.com/wp-login.php, WordPress stores the following two cookies:

Your user name

A double-hashed copy of your password

WordPress uses the two cookies to bypass the password entry portion of wp-login.php. If WordPress recognizes that you have valid, non-expired cookies, you go directly to the WordPress Administration interface. If you don't have the cookies, or they're expired, or in some other way invalid (like you edited them manually for some reason), WordPress will require you to log in again, in order to obtain new cookies. http://codex.wordpress.org/WordPress_Cookies

If you want to use the data else where with WordPress you can use the is_user_logged_in conditional statement:

<?php
if ( is_user_logged_in() ) {    echo 'Welcome, registered user!';} else {    echo 'Welcome, visitor!';};?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜