Support » Plugins » Adding custom user session info in plugin

  • I want to add a small piece of data to be associated with each specific user reading my blog for this plugin I’m writing.

    This piece of data is really just a flag, so could possibly even be added to the cookie. But, later (like a year later) I’m going to want to add a few more pieces of data, so maybe not.

    Am wondering if wordpress has any capabilities builtin to support this? I’ve seen get_userdata and get_currentuserinfo, but it looks like these operated on hard coded variables. And you can’t add your own.

    Should I look into implementing something from scratch based on PHP’s own user session capabilities?

Viewing 1 replies (of 1 total)
  • Why not just store it as an array:

    Array (
    “user_id” => 3,
    “my_option” => true,
    “my_other_option” => “buggaboo”

    then serialize it and chuck it in as an option using add_option()

Viewing 1 replies (of 1 total)
  • The topic ‘Adding custom user session info in plugin’ is closed to new replies.