javascript - Detecting if it is the first time a user access some pages in Moodle 2.7 to show him that something changed on the interface -


here limitations task:

  • for moodle 2.7
  • i cannot install plugin
  • i cannot create plugin

so need identify if user accessing pages on moodle first time after interface update show them new. google when updates pages.

'ow, new? this, , that. okay? end of story , never see me again.'

i identified 'object' '$user' in file 'columns3.php' in folder 'layout'. '$user' provides lots of information used , maybe useful me.

is possible use information refered 'objet' in order allow me show contextual user once? or, there other place can find data use purpose?

the contextual present new going run via front-end files , ready implemented.

you take following approach: on of pages interface going run, make query mdl_log table, following condition:

  1. that userid column value = $user->id
  2. that url column value = ever possible url interface used.
  3. and time column value > date when updated interface

if query returns 0 results, means user has not visited page since time installed show notice box or whatever, otherwise don't show notice box.

another possible approach make verification right there on interface's code, whenever used check:

  1. has current $user->id invoked code before? (you can add boolean field mdl_user table , simple store there value (1 or 0) track if user has used interface after update).
  2. declare global $visited variable , asign appropiate value depending on results of step 1, later used on php view code(the html)
  3. in php html file do: (if $visited == 0) show_notice_box else nothing

Comments