XF 2.1 Save to a column of xf_user table (on every page visit) and modify some admin options

Scandal

Well-known member
Hello all! :)
I have two development questions. I know that they could be not so normalized, but I really need them.

The problems:
A) I want on every page load to save on xf_user table (not xf_session!! ) the visited time stamp. I know that there is the last_activity column, but I need an extra column for some cases. What class and method do I have to extend, to achieve it?

B) I want on a very initial state, to change the values of some \XF::app()->options()->something1, \XF::app()->options()->something2 etc, so from then and below all the xF2 application will take into account those new values. I don't want to save those values to the admin settings. Just to change their values during the script load. What class and method do I have to extend? :)
 
.A) Event dispatcher_post_dispatch
B) I can tell you how to do what you want, but such an implementation is a crutch.
 
You can change options at run-time simply by setting them:

PHP:
$options = \XF::options();
$options->registrationSetup['enabled'] = 0;

I'd recommend doing this in an app_pub_setup listener (or similar). You'd want to hook it at early as possible to make sure it's picked up, but not so early that whatever data or functionality you need is not yet available.
 
Back
Top Bottom