Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
854 views
in Q2A Core by
Imagine there are 10 categories from which the user can use to post a question to. Everytime the user has to hunt for the category name he often uses. Can we ease this process for user by making Q2A remeber the last category used by the user?

Thanks
Q2A version: Q2A 1.5.4

3 Answers

–1 vote
by
do we need to alter the db for this? or there are some other ways
0 votes
by
Some thoughts - Mostly you will need advanced theme (or may use plugin etc.):

1. You may use user recent activity for this somehow. Traverse the recent post by this user and get category.
or
2. Perhaps use/set categories in cookies.

After you have the category, you can redirect/open that category.
Ofcourse you can modify the db, if you want to take that approach.
by
what if the user select his/her favorite category at the time of registration?
by
That can be handled by approach 2 (cookies) and your original approach (db). But approach 1 will not be useful for favorite category. Perhaps you may want to have more than one approach implemented to cover your users (registered and non-registered) better.

If you want to use city etc. (particularly for non-registered users), you may check IP address and use some IP to geolocation service. Not sure how reliable that would be on the city level though.

Nice explanation by pixelngrain for the db and favorite scenario.
0 votes
by
Somehow Zankar's answer is similar to what I am going to say but with bit differnt aproach.

 

What you can do is check user's last question category from database ( qa_posts) than in category dropdown code you can condition like if user posted any question than check for which category id and pass that category id in dropdown box as a selected.

But it is very hard to find which category user use so often untill he make it either in favorite or you may need to create custom plugin where user can add his/her most often use category which will store into the database.

Also as Zankar mentioned you can use cookie also but I am not sure how it will works for category..
by
This is what I am trying to do:
I am thinking to make the user chose his category at the time of registration. Think of categories as city names. the user picks what city he lives at time of registration and that gets stored in database. when he wants to post a question, that category gets selected by default.
by
I think you are in right direction.
...