@click.command(u'set-last-active-for-user')
@click.option(u'--user', help=u'Setup last active date for user')
@pass_context
def set_last_active_for_user(context, user=None):
 from frappe.core.doctype.user.user import get_system_users
 from frappe.utils.user import set_last_active_to_now
 site = get_site(context)
 with frappe.init_site(site):
  frappe.connect()
  if (not user):
   user = get_system_users(limit=1)
   if (len(user) > 0):
    user = user[0]
   else:
    return
  set_last_active_to_now(user)
  frappe.db.commit()

@ click . command ( u'set-last-active-for-user' ) @ click . option ( u'--user' , help = u'Setup last active date for user' ) @ pass_context def set_last_active_for_user ( context , user = None ) : from frappe . core . doctype . user . user import get_system_users from frappe . utils . user import set_last_active_to_now site = get_site ( context ) with frappe . init_site ( site ) : frappe . connect ( ) if ( not user ) : user = get_system_users ( limit = 1 ) if ( len ( user ) > 0 ) : user = user [ 0 ] else : return set_last_active_to_now ( user ) frappe . db . commit ( )
set users last active date to current datetime .