You are here

function follow_links_form_submit in Follow 5

Same name and namespace in other branches
  1. 6 follow.module \follow_links_form_submit()
  2. 7.2 follow.module \follow_links_form_submit()
  3. 7 follow.module \follow_links_form_submit()

Submit handler for the follow_links_form.

File

./follow.module, line 488
Allows users to add links to their social network profiles.

Code

function follow_links_form_submit($form_id, $form_state) {
  $links = $form_state['follow_links'];
  foreach ($links as $name => $link) {
    $link = (object) $link;
    $link->url = trim($link->url);

    // Check to see if there's actually a link
    if (empty($link->url)) {

      // If there's an lid, delete the link.
      if (isset($link->lid)) {
        follow_link_delete($link->lid);
      }

      // Continue to the next link.
      continue;
    }
    else {
      $link->uid = $form_state['uid'];
      $link->name = $name;
      follow_link_save($link);
    }
  }
}