Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I have a fresh install & it gives me a notice when I activated the block - My visitors history adv.
Which is - Notice: Undefined index: total in user_visits_adv_get() (line 175 of /var/www/dsn/sites/all/modules/user_visits_adv/user_visits_adv.module).
Thanks,
RajeevK
Comments
Comment #1
francoud CreditAttribution: francoud commentedSubscribe.
Comment #2
javier.drupal.2012 CreditAttribution: javier.drupal.2012 commentedSubscribe
Comment #3
Herndl CreditAttribution: Herndl commentedSubscribe
Comment #4
quixxel CreditAttribution: quixxel commentedNotice: Undefined index: visitors in user_visits_adv_get() (line 175 of /var/www/dsn/sites/all/modules/user_visits_adv/user_visits_adv.module).
Notice: Undefined index: total in user_visits_adv_get() (line 175 of /var/www/dsn/sites/all/modules/user_visits_adv/user_visits_adv.module).
Notice: Undefined index: history in user_visits_adv_get() (line 175 of /var/www/dsn/sites/all/modules/user_visits_adv/user_visits_adv.module).
Comment #5
togbonna CreditAttribution: togbonna commentedBecause you just installed the module, no data has been recorded for your profile on the User Visits Advanced table hence the notice. This array structure: $user_visits_adv_data is not initialized for first use.
My solution: Add the following after line 172 of the user_visits_adv.module file and the notice goes away:
$user_visits_adv_data[$uid]['total'] = 0;
$user_visits_adv_data[$uid]['visitors'] = 0;
$user_visits_adv_data[$uid]['history'] = 0;
Now, whether this is the best solution, I can't say, but it solves the problem.
Comment #6
amitgoyal CreditAttribution: amitgoyal commentedThanks for pointing this out and providing the solution.
This has been fixed in development branch 7.x-1.x-dev.