| 26 |
} |
} |
| 27 |
|
|
| 28 |
/** |
/** |
| 29 |
* Implementation of hook_form_alter() |
* Implementation of hook_form_alter(). |
| 30 |
*/ |
*/ |
| 31 |
function facebook_status_form_alter($form_id, &$form) { |
function facebook_status_form_alter($form_id, &$form) { |
| 32 |
if ($form_id == 'block_admin_configure' && arg(4) == 'facebook_status' && (arg(5) == '3' || arg(5) == '4')) { |
if ($form_id == 'block_admin_configure' && arg(4) == 'facebook_status' && (arg(5) == '3' || arg(5) == '4')) { |
| 184 |
$block_content .= htmlspecialchars($sm['status_fb'], ENT_NOQUOTES) ." <span class='". t("submitted") ."'>". $time . t(' ago') ."</span>"; |
$block_content .= htmlspecialchars($sm['status_fb'], ENT_NOQUOTES) ." <span class='". t("submitted") ."'>". $time . t(' ago') ."</span>"; |
| 185 |
} |
} |
| 186 |
//If the user is not allowed to have a status. |
//If the user is not allowed to have a status. |
| 187 |
else if (in_array($fbs_uid, variable_get('facebook_status_clear_user', array(0)))) { |
else if (in_array($fbs_uid, variable_get('facebook_status_clear_user', array(0)))) { |
| 188 |
//If the status form is not the user's own, use different strings than if it is the user's own. |
//If the status form is not the user's own, use different strings than if it is the user's own. |
| 189 |
if ( $fbs_uid != $user->uid ) { |
if ( $fbs_uid != $user->uid ) { |
| 190 |
$block_content .= t('@username is not allowed to have a status.', array('@username' => $fbs_name)); |
$block_content .= t('@username is not allowed to have a status.', array('@username' => $fbs_name)); |
| 590 |
else { |
else { |
| 591 |
$fbs_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $fbs_uid)); |
$fbs_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $fbs_uid)); |
| 592 |
} |
} |
| 593 |
$result = array( |
$result = array(); |
| 594 |
|
$result[0] = array( |
| 595 |
'status_fb' => t("Error: this user is not allowed to have a status."), |
'status_fb' => t("Error: this user is not allowed to have a status."), |
| 596 |
'status_time' => 0, |
'status_time' => 0, |
| 597 |
'fbs_name' => $fbs_name, |
'fbs_name' => $fbs_name, |
| 824 |
$nsids .= " AND sid != ". $value['sid']; |
$nsids .= " AND sid != ". $value['sid']; |
| 825 |
} |
} |
| 826 |
//Removes first " AND ". |
//Removes first " AND ". |
| 827 |
$nsids = substr($nsids, 5); |
$nsids = drupal_substr($nsids, 5); |
| 828 |
db_query("DELETE FROM {facebook_status} WHERE %s ORDER BY sid ASC", $nsids); |
db_query("DELETE FROM {facebook_status} WHERE %s ORDER BY sid ASC", $nsids); |
| 829 |
drupal_set_message(t('All statuses except the most recent one were cleared for each user.')); |
drupal_set_message(t('All statuses except the most recent one were cleared for each user.')); |
| 830 |
} |
} |
| 840 |
} |
} |
| 841 |
|
|
| 842 |
//Sets variables because the form refuses to do it for us! >:( |
//Sets variables because the form refuses to do it for us! >:( |
| 843 |
foreach ($form_values as $values) { |
$values = array(); |
| 844 |
foreach ($values as $key => $value) { |
$values['fbs_general'] = $form_values['fbs_general']; |
| 845 |
variable_set($key, $value); |
$values['fbs_lengths'] = $form_values['fbs_lengths']; |
| 846 |
} |
$values['fbs_number'] = $form_values['fbs_number']; |
| 847 |
|
$values['fbs_misc'] = $form_values['fbs_misc']; |
| 848 |
|
foreach ($values as $key => $value) { |
| 849 |
|
variable_set($key, $value); |
| 850 |
} |
} |
| 851 |
variable_del('facebook_status_clear_user_records_string'); |
variable_del('facebook_status_clear_user_records_string'); |
| 852 |
variable_del('facebook_status_clear_user_records'); |
variable_del('facebook_status_clear_user_records'); |