mysite_content_remove

Definition

mysite_content_remove($uid = NULL, $mid = NULL)
mysite.module, line 2584

Description

Menu callback to delete a content item.

All values are set to NULL to force error checking and guard against spoofing.

Parameters

$uid The $user->uid of the owner of this MySite page.

$mid The unique mysite_id (mid) of the content to be altered.

Code

function mysite_content_remove($uid = NULL, $mid = NULL) {
  global $user, $base_url;
  $uid = arg(1);
  $mid = arg(3);
  // set the referer to a destination path so we can append it to the form action
  $refer = referer_uri();
  $q = str_replace($base_url .'/', '', $refer);
  $dest = str_replace('?q=', '', $q);
  // get the user's MySite settings and name.
  $mysite = mysite_get($uid);
  $prompt = variable_get('mysite_confirm_delete', 0);
  // If the admin has turned on the confirmation message, the user will see it.
  // But the user can disable it here, too.
  // Since it's a checkbox, 0 means that the user has not disabled this function.
  if ($prompt && $mysite->confirm == 0) {
    return drupal_get_form('mysite_confirm_delete_form', $mysite->uid, $mid, $mysite->name, $dest);
  }
  // this function includes a drupal_goto, so no return is needed.
  mysite_delete_item($uid, $mid, $dest);
}