outgoing SMS

By Toledoh - January 22, 2012 - edited: January 22, 2012

Hi Guys,

It's been ages since I set this up, and it hasn't been used. However trying to use it now and an error occurs as attached... can you suggest where I should start looking?

Send Errors : No 'to' value specified in message!
Cheers,

Tim (toledoh.com.au)
Attachments:

sms_error.pdf 134K

Re: [Toledoh] outgoing SMS

By Jason - January 23, 2012

Hi Tim,

So this happens when you try to send a test message? Are you able to send a live message?

The first thing I noticed is that the "To" field was missing, replaced by just text. Was this a customization of the plugin or a customization by another plugin?

The To field requires number only values. Since nothing was being submitted by your form, this would explain the error.

You could try sending a live message like this:

list($errors, $response) = outgoingSMS_sendMessage($from, $to, $text);

Make sure the $to is numbers only (no hyphens).

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] outgoing SMS

By Toledoh - January 23, 2012

Hi Jason,

This was purchased prior to the release as a plugin, so I'm not sure whther it's customised or not...

Where do I place that code?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] outgoing SMS

By Dave - January 23, 2012

Tim,

Maybe as a first step let's get you on the official version. Can you try and download it and/or send me an email so I can add it to your account? Then we can figure out if there are any differences.

Let me know if that works. Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] outgoing SMS

By Toledoh - January 25, 2012

Hey Dave,

The official version sends a test message just fine. But I think I've identified the custom part.

Previously I could search my users table, select a bunch of users and then send via the Advanced Commands drop down. Is this not part of the standard plugin?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] outgoing SMS

By Dave - January 26, 2012

No, I think that's a custom bit. So everything works except that feature? Let me know how we can help.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] outgoing SMS

By Toledoh - January 26, 2012

Hi Dave,

I'll send the custom file through and maybe you can tell me if there's an obvious problem?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] outgoing SMS

By Toledoh - January 29, 2012

Hi Guys,

That's working now - thanks for your help!

It seems however that an "Editor" gets the send SMS option in the advanced commands, is able to insert the from and message fields and "send" but is then redirected to the admin.php? page without getting the send report, or indeed sending the SMS.

Where in the code do I set usage rights? I would like all "editors" to have the ability to send SMS, not just administrators... OR be able to give editors the rights to that section.
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] outgoing SMS

By Jason - January 30, 2012

Hi Tim,

You can change it so editors have access through the advanced commands drop down by uncommenting a line in the _outgoingSMS_addAdvancedOption function

function _outgoingSMS_addAdvancedOption($labelsToValues) {
global $schema;
if (@$schema['phone']) {

$allowedAccess = array_key_exists('hasEditorAccess', $GLOBALS);
#$allowedAccess = $GLOBALS['CURRENT_USER']['isAdmin'];

if ($allowedAccess) {
$labelsToValues['Send SMS (Search Results)'] = 'smsSearch';
}
}
return $labelsToValues;
}


hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] outgoing SMS

By Toledoh - January 30, 2012

Thanks Jason,

My current code is actually a bit different... it shows;

addFilter('list_advancedCommands', '_outgoingSMS_addAdvancedOption', null, 1);
function _outgoingSMS_addAdvancedOption($labelsToValues) {
global $tableName;
if ($tableName == 'accounts') {
$labelsToValues['Send SMS (Search Results)'] = 'smsSearch';
}
return $labelsToValues;
}
addAction('section_unknownAction', '_outgoingSMS_displayForm', null, 2);
function _outgoingSMS_displayForm($tableName, $action) {
global $schema, $CURRENT_USER;
if ($action != 'smsSearch') { return; }

// error checking
//if (!@$CURRENT_USER) { die("CURRENT_USER not defined!"); }
//if (!array_key_exists('hasEditorAccess', $GLOBALS)) { die("hasEditorAccess not defined!"); }

$where = '1';
if (@$_REQUEST['to']) {
$where = "num IN (" . implode(',', array_map('intval', explode(',', $_REQUEST['to']))) . ")";
}

Cheers,

Tim (toledoh.com.au)