First Name can not be empty."; $error_name = TRUE; $error = TRUE; } if (!$friend_email) { $msg .= "
Email address field can not be empty."; $error_email = TRUE; $error = TRUE; } elseif ($email_validation == '0') { $msg .= "
The email address is invalid."; $error_email = TRUE; $error = TRUE; } elseif($friend_email == $_SESSION["user"]["email"]) { $msg .= "
You can not invite yourself."; $error_email = TRUE; $error = TRUE; } $array_error = array('error_email'=>$error_email, 'error_name'=>$error_name); $inv = new Invitation(); $inv->user_id = $_SESSION['user']['id']; $inv->username = $_SESSION['user']['name']; // for invitation not for any group invitation collection id is -1 $inv->inv_collection_id = -1; $inv->inv_status = PENDING; $inv->register_url = $base_url."/register.php?InvID=".$inv->inv_id; $inv->accept_url = $base_url."/homepage.php?action=accept&InvID=".$inv->inv_id; $inv->inv_user_id = NULL; $inv->inv_username = NULL; $inv->inv_user_first_name = $first_name; $inv->inv_user_last_name = $last_name; $inv->inv_email = $friend_email; $inv->inv_summary = "Invitation from $user->first_name $user->last_name to join PeopleAggregator"; $inv->inv_message = $message; if ($error != TRUE) { try { //print '
'; print_r($inv); exit;
      $inv->send();
      //header("Location: user.php?uid=".($_SESSION['user']['id']));
    }
    catch (PAException $e) {
      $msg = "$e->message";
      $save_error = TRUE;
    }
  }
  if ($error == TRUE || $save_error == TRUE) {
    $msg = "Sorry: you are unable to invite a friend. 
Reason: ".$msg; } else { $msg1 = "An invitation has been sent to ($friend_email)."; } } // invitation.php-specific module initialization code function setup_module($column, $moduleName, $obj) { global $array_error; switch ($column) { case 'left': if ($moduleName=='RecentCommentsModule') { $obj->cid = $_REQUEST['cid']; $obj->block_type = HOMEPAGE; $obj->mode = PRI; } break; case 'middle': $obj->content_id = $_REQUEST['cid']; $obj->mode = PUB; $obj->uid = $uid; $obj->block_type = 'media_management'; if ($moduleName == 'InvitationModule') { global $msg; $obj->msg = $msg; $obj->array_of_errors = $array_error; } break; } } $page = new PageRenderer("setup_module", PAGE_INVITATION, "Invite people into PeopleAggregator", 'media_gallery_pa.tpl', 'header.tpl', PRI, HOMEPAGE, $network_info); // if it succeeds, add the message before the middle modules if (!empty($msg1)) { $msg_tpl = & new Template(CURRENT_THEME_FSPATH."/display_message.tpl"); $msg_tpl->set('message', $msg1); $page->add_module("middle", "top", $msg_tpl->fetch()); } echo $page->render(); print ''; ?>