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.
In sms_sendtophone_page()
:
if (user_access('send to any number') || !empty($user->sms_user['0']['number'])) {
$form = drupal_get_form('sms_sendtophone_form', $type);
}
else {
if (empty($user->sms_user['0']['number']) && user_access('send to any number')) {
$register = array(
'#value' => t('You need need to <a href="@setup">setup</a> your mobile phone to send messages.', array('@setup' => url('user/'. $user->uid .'/mobile')))
);
}
else {
$register = array(
'#value' => t('You do not have permission to send messages. You may need to <a href="@signin">sign in</a> or <a href="@register">register</a> for an account to send messages to a mobile phone.', array('@signin' => url('user', array('query' => array('destination' => $_GET['destination']))), '@register' => url('user/register', array('query' => array('destination' => $_GET['destination']))))),
);
}
$form = drupal_render($register);
}
The following:
if (empty($user->sms_user['0']['number']) && user_access('send to any number')) {
will always evaluate to FALSE, as user_access('send to any number')
cannot be TRUE at this point, because if it were TRUE, the code within the previous if-statement would have been run instead. The quoted line should be replaced with:
if (empty($user->sms_user['0']['number'])) {
which results in the expected behavior.
Comments
Comment #1
jpmckinney CreditAttribution: jpmckinney commentedComment #2
univate CreditAttribution: univate commented