redirect('/');
}
//--------------------------------------------
// Find and return a list of of suggested author
// names.
//--------------------------------------------
function quickfind(&$reg, &$req, &$resp)
{
$user = &$reg->get('user');
$finder = &$this->getFinder('users');
$users = &$finder->selectAllWhere("name", "user_id <> ? AND user_id <> ? AND name LIKE ?", array(K4_GUEST_ID, $user->getId(), $req->get('query') . '%'), 'name ASC', 'name', 15);
$resp->assign('display_suggestions', intval($users->hasNext()));
$resp->assignRef('users', $users);
$this->setLayout('member_quick_name_search.html');
}
//--------------------------------------------
// Check to see if a member name exists for inviting
// a member to co-author a thread.
//--------------------------------------------
function threadcheckuser(&$reg, &$req, &$resp)
{
$user = &$reg->get('user');
$xml = "\n";
if (!$user->canDo('post', 'threads'))
{
$xml .= "". $this->informationText("You do not have permission to use this feature.") ."";
}
else
{
$finder = &$this->getFinder('users');
$coauthor = &$finder->findBy('name', $req->get('user_name'));
if($coauthor === NULL)
{
$xml .= "". $this->informationText("That user doesn't exist.") ."";
}
else
{
if($coauthor->getId() == $user->getId())
{
$xml .= "". $this->informationText("You can't invite yourself as a co-author.") ."";
}
else if($coauthor->getId() == K4_GUEST_ID)
{
$xml .= "". $this->informationText("You can't invite guest as a co-author.") ."";
}
else
{
$xml .= "". $this->informationText("Success! This user will be invited to co-author your thread when it's added.") ."";
}
}
}
//-------------------------------------------------
// Return this page as an XML document.
//-------------------------------------------------
header("Content-type: text/xml");
$this->informationPage($xml);
}
}
?>