• I’m a total newbie and don’t know the terminology so let me describe what I’m looking for.

    After you log in to WordPress, how does WordPress remember it’s you as you browse around the website? Does it use a cookie? Or some other method of checking who you are?

    Specifically, I’d like to make a NON-WordPress page that displays data from a database based on which WordPress user you are logged in as… if that is possible. Like if there were some way to “pass along” that you are WordPress user #223 (from the wp_users table) and then on my custom page I could then let you edit info in a different non-WP database that is associated with user #223. I’ll ask on other message boards about how to code that part but that’s why I first need to ask here if it’s even possible to “pass along” what wordpress user number somebody is logged in as.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter gopanthers

    (@gopanthers)

    I’ve since learned that WordPress places a cookie on the user’s computer that contains the user’s username. But what is the name of his cookie? How do you access or use it?

    So since this cookie already contains their username, I suppose I should forget about trying to use their ID#. But how can I actually “get” the username of the person who’s already logged in? And then how can I then “pass along” that username in some way, possibly using it to specify which line of data will be pulled from a database?

    me too

    You should also look at creating a custom plugin. Within the plugin, you can then use the get_currentuserinfo (https://codex.www.ads-software.com/Function_Reference/get_currentuserinfo) function to grab the username for your search.

    Thread Starter gopanthers

    (@gopanthers)

    None of those codes work at all, as I totally expected because I’m calling this from a totally non-WP page.

    creating a new php page (having nothing to do with WordPress) I typed:
    <?php get_user_option( $option, $user, $check_blog_options ) ?>
    And unsurprisingly got this error message:
    Fatal error: Call to undefined function get_user_option() in /home/mikesuss/public_html/alphasigs.net/includes/test.php on line 1

    And creating a new php page with only:
    <?php get_currentuserinfo(); ?>
    produces this error message:
    Fatal error: Call to undefined function get_currentuserinfo() in /home/mikesuss/public_html/alphasigs.net/includes/test.php on line 1

    Can’t none of these codes work outside of the WordPress environment? Or at least wouldn’t I need to at least specify a connection to the WordPress database or something to make these codes makes sense?

    @gopanthers: yes, to use those functions, you need to either create a WordPress plugin or load a specific WordPress file (wp-admin/load.php I think).

    It is much easier (in my opinion) to create a plugin than it is to try and load WordPress with an outside PHP file.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How does WordPress Login work?’ is closed to new replies.