Hi
I was wondering if it was possible for someone to help me utilise the sms gateway module. I think that once I get an example going I'd be okay.
The first thing I wanted to look at was storing members telephone numbers so I looked at profile.module and created a new field called profile_mobile that holds the number.
Then I looked at the remindme.module and the bit that sends out the email is here:
function remindme_mail($node) {
$from = variable_get('site_mail', ini_get('sendmail_from'));
$subject = strtr(t('Reminder for %title'), array ('%title' => $node->title));
$to = "$node->name <". $node->mail .'>';
$body = strtr(t("Greetings %name,\n\nYou wanted to get a reminder for the event %title. It starts at %time, you can see more details at %url , thanks for using the Walkers Talk Remind Me service.") , array('%name' => $node->name, '%title' => $node->title, '%time' => format_date($node->event_start, 'medium'), '%url' => url("node/$node->nid", NULL, NULL, 1))) ;
return user_mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal (remindme.module)\nReturn-path: <$from>\nErrors-to: $from\n");
}
I know what I want to do but I'm stuck at the implementation bit! I'd like a shorter message to be sent out to the members mobile, I think this is identified by this bit: $to = "$node->name <". $node->mail .'>'; but I'm unsure how to get the telephone number in there instead and put it into the variable $destination_number...so that's the first hurdle.
I think I could get it to send once I have the number by using the code that is in the gateway module as a test page but I'm unsure what I need to do in the remindme.module to get it to do this, how do you call a function fropm one module into another? :
function smsgateway_sendmessage( $destination_number, $message_body) {
$destination_number = trim($destination_number);
if ($destination_number == null || strlen($destination_number) == 0) {
return array('connectstring' => 'Not used', 'response' => 'No telephone number specified');
}Any pointers or help would be much appreciated thanks.
Comments
Comment #1
Cromicon commentedAnother example is the Private Message module. It has all the functionality and I imagine it just needs a tweak or two to get it to work. Here's the bit the actually sends the message:
This bit seems to identify the user but how on earth do I get the number if stored in their user profile as profile_mobile?
And then again, how do I pass variables to smsgateway module?
Again, any help or pointers would be eagerly accepted! :-)
Comment #2
Cromicon commentedOk...
That's the number sorted... what if the number isn't there though?