Blocks: Notifications

block_notifications
Maintained by Picture of Goran JosicGoran Josic
Not always logged in, you want to be up to date about new content, discussions or events in your Moodle courses? This moodle block implements a solution that periodically notifies learners about new content or activities included into a Moodle course. This solution will act as a sentinel that detects whether new contents or new activities have been included into the Moodle course, and notify the learners and/or the instructors about that. Notifications methods are: e-mail message RSS aggregator SMS message There is also a version of this plugin for Moodle 1.9 that can be downloaded from the Website.
553 sites
309 downloads
42 fans
Moodle 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Picture of Goran Josic
Goran Josic (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Chris Klissiaris
    Fri, May 24, 2019, 4:23 PM
    Hello, i installed teh plugin everything looks ok but i dont get notificiations at all. Although i noticed that there is no option for the frequency of checking for new contents. I am using Moodle 3.6.

    Any ideas please?
  • Picture of Goran Josic
    Fri, May 24, 2019, 4:53 PM
    @ChrisKlissiaris

    The admin actions are not notified because they are considered adminstration and not teacher actions.

    The frequency of the notifications is managed by moodle under /admin/tool/task/scheduledtasks.php.

    Hope that helps.
  • Picture of Chris Klissiaris
    Fri, May 24, 2019, 5:44 PM
    @Goran Josic not even when i have assigned and admin as teacher on a course?
  • Picture of Goran Josic
    Fri, May 24, 2019, 5:53 PM
    @ChrisKlissiaris

    If you are the teacher and you have added the block to the course you can test if it runs by running the task manually with this command:

    sudo -u www-data php your_moodle_root/admin/tool/task/cli/schedule_task.php --execute='\block_notifications\task\notify'

    Please fix the path according to your settings and post here or on github any errors.

  • Picture of Chris Klissiaris
    Fri, May 24, 2019, 6:11 PM
    @goran Josic

    Got me there. I dont have console access or the knowledge. I connected through winscp but the command line give me uknown command (prolly)

    Can we please get this in private discussion?
  • Picture of Goran Josic
    Fri, May 24, 2019, 6:20 PM
    @ChrisKlissiaris

    You can run individual tasks also through the interface.

    https://docs.moodle.org/37/en/Scheduled_tasks#Running_individual_tasks

    If you find bugs please report them on the github: https://github.com/arael/moodle_notifications_20
  • Picture of Chris Klissiaris
    Thu, May 30, 2019, 11:51 PM
    I think i found the problem. On the cron jobs the notifications cron is se to no. But i cant find how to change this.
    Cause every time i manually run the cron.php it works
  • Picture of Goran Josic
    Thu, Oct 24, 2019, 11:29 PM
    Hi Borja, I will look into this as soon as I can. We are not using moodle 3.7 branch so I didn't notice this bug.
  • Picture of Borja Soler
    Thu, Oct 24, 2019, 11:31 PM
    Hi, I have the latest version of moodle 3.7.2+, the plugin seems work fine, but have a big issue with the latest version of moodle, it seems that when the plugin try to find the enroled users in wich course, cannot find any user (maybe becouse the moodle database have some changes in the latest upgrades) and finally the plugin use the second option to send notifications, second option is send notifications to all the moodle's user that have the user preference "notify by mail" activated, then the plugin send mails wich time that one course is updates to all the users of the moodle.

    I have a big moodle with more than 2k users and this is a bis problem that prevents that I could use the plugin..

    Somebody have hade the same issue ??
  • Picture of Goran Josic
    Fri, Oct 25, 2019, 10:16 PM
    @Borjya Soler, I have tested the last version of the notifications plugin in moodle 3.7 and it works properly. The email channel sends notifications only to the users who are enrolled in the course. Any other hint on how to create the conditions to recreate this bug?
  • Picture of Goran Josic
    Tue, Oct 29, 2019, 12:05 AM
    @Borja Soler

    This is the function extracting the Users from the course: https://github.com/arael/moodle_notifications_20/blob/master/classes/User.php#L16

    Patches are welcome. If you find a way to patch this without breaking the defaults just send it to me and I will merge.
  • Picture of Borja Soler
    Tue, Oct 29, 2019, 12:23 AM
    Hi Gorar, many thanks for your quckly response.
    I have been checking too and you are right, the plugin works fine with a new installations of moodle 3.7.2.

    Recently I hade to migrate my moodle form one server to another one, for do it i had to change properties of my database from antelope to barracuda (utf8 to utf8mb4). becouse I had tables more big than 767 bytes that is the max size that can be imported in a antelope database.
    Then, you think that this change could be affect the plugin and if for this reason the plugin cannot select the enrol users in every course ?

    There some way to check where is the issue ? I can send logs if is necessary. I have been checking the cron exit, but only shows the total account of users that will be notificated...
  • Picture of Goran Josic
    Tue, Oct 29, 2019, 12:29 AM
    @Borja I have no idea why this happens. But if you check the function I have posted earlier you will find that it uses standard moodle functions.

    If there is a bug and it is one of those functions you should report it upstream.

    The moodle function used by the block for extracting users are here: https://github.com/arael/moodle_notifications_20/blob/master/classes/User.php#L16
  • Picture of Borja Soler
    Wed, Nov 13, 2019, 8:10 PM
    Hi again Goran,

    I have been cheecking the issue during some days and i cannot find a solution,

    I think that if you see the resuts of the cron job, maybe you could see the problem easily,

    Only 1 course have activated the notifications block: This is ok.
    Course is "Test 23102019": Ok too
    Enrol users: 3 ( send notifications to all the moodle's users): Issue

    Cron Job: result
    ****** notifications :: begin ******

    Number of courses using the block: 1
    --> Processing course: Test 2310209
    --> Found 38 users
    --> User 59 has preferences; notify_by_email={1}
    --> User 75 has preferences; notify_by_email={1}
    --> User 9 has preferences; notify_by_email={1}
    --> User 697 has preferences; notify_by_email={1}
    --> User 617 has preferences; notify_by_email={1}
    --> User 21 has preferences; notify_by_email={1}
    --> User 616 has preferences; notify_by_email={1}
    --> User 442 has preferences; notify_by_email={1}
    --> User 458 has preferences; notify_by_email={1}
    --> User 721 has preferences; notify_by_email={1}
    --> User 722 has preferences; notify_by_email={1}
    --> User 701 has preferences; notify_by_email={1}
    --> User 702 has preferences; notify_by_email={1}
    --> User 703 has preferences; notify_by_email={1}
    --> User 704 has preferences; notify_by_email={1}
    --> User 705 has preferences; notify_by_email={1}
    --> User 706 has preferences; notify_by_email={1}
    --> User 707 has preferences; notify_by_email={1}
    --> User 708 has preferences; notify_by_email={1}
    --> User 699 has preferences; notify_by_email={1}
    --> User 709 has preferences; notify_by_email={1}
    --> User 710 has preferences; notify_by_email={1}
    --> User 712 has preferences; notify_by_email={1}
    --> User 713 has preferences; notify_by_email={1}
    --> User 714 has preferences; notify_by_email={1}
    --> User 715 has preferences; notify_by_email={1}
    --> User 700 has preferences; notify_by_email={1}
    --> User 711 has preferences; notify_by_email={1}
    --> User 716 has preferences; notify_by_email={1}
    --> User 717 has preferences; notify_by_email={1}
    --> User 718 has preferences; notify_by_email={1}
    --> User 719 has preferences; notify_by_email={1}
    --> User 720 has preferences; notify_by_email={1}
    --> User 8 has preferences; notify_by_email={1}
    --> User 695 has preferences; notify_by_email={1}
    --> User 696 has preferences; notify_by_email={1}
    --> User 698 has preferences; notify_by_email={1}
    --> The course log does not exist, so initialize it
    --> Done course->update_log()
    --> Done course->get_recent_activities()
    --> Here is the course changelist=Array
    (
    )

    ****** notifications :: end ******

    What do you think ?
    Any idea?

    Best regards and many thakns for your time.
    Borja
  • Picture of Goran Josic
    Wed, Nov 13, 2019, 8:36 PM
    Thank you for the log. Here is what I can tell you from that log:

    This log is generated by the classes/task/notify.php script of the notifications block.

    This is the row: https://github.com/arael/moodle_notifications_20/blob/master/classes/task/notify.php#L59

    As you can see the function for extracting the users is: $enrolled_users = $User->get_all_users_enrolled_in_the_course($course->id);

    That function is found here: https://github.com/arael/moodle_notifications_20/blob/master/classes/User.php#L16

    To extract the users these two lines are relevant:

    This extracts the course context.

    $context = context_course::instance( $course_id );

    Once the context is extracted the users are extracted with the capability:
    $all_users = get_users_by_capability( $context, 'mod/assignment:view', 'u.id, u.username, u.firstname, u.lastname, u.email, u.suspended, u.mailformat, u.phone2, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename', 'lastname ASC, firstname DESC' );

    I don't understand why but the point of failure is there. That context doesn't seem to be set properly or your course is odd and offers access to all the users by default.

    If there is a better way to extract those users which does not undermine the functioning of the block and solves your issue I am willing to apply a patch. Let me know if you find one.
1 2 3 4 5 6 7 8
Please login to post comments