Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Save default category so clicking home button takes user to a specific category

playgraphplaygraph New
edited June 2014 in Vanilla 2.0 - 2.8

I could use sessions or cookies I suppose, but I'd like to store and retrieve a user's default category from any page regardless of sessions/cookies.

I've looked for plugins to store custom variables but haven't found any. Programmatically, how well set up is Vanilla to do this?

I'm thinking that, once a category is selected, its ID would then be stored to the user's table.

Edit: The "Category Auto Select version 0.06" plugin is close but it does not store the category in a table.

Comments

  • Welcome to the community!

    What version number of Vanilla are you running?

    This sounds like something that should be stored in the UserMeta table. You can easily set and get a user meta record within a plugin with the SetUserMeta() and GetUserMeta() methods.

    As far as overriding the home link, there are a few ways to do that. I would suggest setting the default route to the plugin controller with your custom method that checks the session, pulls the user meta record and directs to the applicable category route.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • As an aside, the session state is stored in an HMAC cookie set by Vanilla. No valid cookie means no one is logged in.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Thanks! I'll check out the setUserMeta() method.

    I'm running 2.1

Sign In or Register to comment.