Text messaging from Moodle

Text messaging from Moodle

by Sam Hussein -
Number of replies: 11

I am trying tosetup Moodle so we can text students from Moodle. We are running Moodle 3.8.1. I installed a texting plugin called SMS Notifier.  I also opened a trial account with Twilio. I also enablled debbiging on Mooodle. When attempting to send a message from Moddle, I ghet the following error 


Debug info: Table 'aqionlin_moodl43.mdl_user' doesn't exist
SELECT usr.id, usr.firstname, usr.lastname, usr.email, usr.phone2 AS phone
FROM mdl_user AS usr
WHERE usr.id IN (163)
[array (
)]
Error code: dmlreadexception
×Stack trace:
  • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 1247 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 107 of /blocks/sms/classes/sms_notifier.php: call to mysqli_native_moodle_database->get_records_sql()
  • line 77 of /blocks/sms/classes/sms_notifier.php: call to SMSNotifier->get_users_detail()
  • line 153 of /blocks/sms/view.php: call to SMSNotifier->process_sms()
I was able to identify the issue. The name of the user table in the query above is wrong. The actual name is mdlfj_user. I am kind of lost with the stack trace stuff. It would be much appreciated if someone can explain to me how to change the table name. 


Average of ratings: -
In reply to Sam Hussein

Re: Text messaging from Moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I downloaded block_some from the plugins site - https://moodle.org/plugins/block_sms

It doesn't have a directory called 'classes' in it.

So... what are you running?
In reply to Howard Miller

Re: Text messaging from Moodle

by fazal hakim -
I am also running the https://moodle.org/plugins/block_sms plugin
but when I send SMS it shows an error

with moodle version 3.10.1

Attachment Screenshot (22).png
In reply to fazal hakim

Re: Text messaging from Moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Which version? (check Site administration > Plugins > Plugins Overview)
In reply to Howard Miller

Re: Text messaging from Moodle

by fazal hakim -
plugin version 
3.7
(2019052200)
I am using Twilio api.
moodle version
3.10.1
In reply to fazal hakim

Re: Text messaging from Moodle

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

The SMS Notifier block is using a hardcoded table prefix. Try changing line 105 of blocks/sms/classes/sms_notifier.php shown below:

104         $sql = 'SELECT usr.id, usr.firstname, usr.lastname, usr.email, usr.phone2 AS phone
105                 FROM mdl_user AS usr
106                 WHERE usr.id IN ('.implode(",", $users).')';

to:

105                 FROM {user} AS usr
Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Text messaging from Moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
That's a pretty horrible bug. I remain to be convinced that they're running the latest version (in which I would hope it's fixed)
In reply to Howard Miller

Re: Text messaging from Moodle

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Howard: It looks like the downloaded zip, version 2019052200, contains a classes folder but branches on GitHub, versions 2017060700 and 2017022001, do not, i.e. the GitHub repo is out of date. There is a fork already containing this fix.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Text messaging from Moodle

by fazal hakim -
Sir, I think the issue is in the database table because there is no table with the name "mdl_user".how can i fix this?