*
* @return boolean success.
*/
- function setMonitor() {
- if (!session_loggedin()) {
- $this->setError(_('You can only monitor if you are logged in'));
- return false;
+ function setMonitor ($u = -1) {
+ if ($u == -1) {
+ if (!session_loggedin()) {
+ $this->setError(_('You can only monitor if you are logged in'));
+ return false;
+ }
+ $u = user_getid() ;
}
$result = db_query_params ('SELECT * FROM forum_monitored_forums WHERE user_id=$1 AND forum_id=$2',
- array (user_getid(),
+ array ($u,
$this->getID())) ;
-
if (!$result || db_numrows($result) < 1) {
/*
User is not already monitoring thread, so
insert a row so monitoring can begin
*/
$sql="INSERT INTO forum_monitored_forums (forum_id,user_id)
- VALUES ('".$this->getID()."','".user_getid()."')";
+ VALUES ('".$this->getID()."','$u')";
$result = db_query_params ('INSERT INTO forum_monitored_forums (forum_id,user_id) VALUES ($1,$2)',
array ($this->getID(),
*
* @return boolean success.
*/
- function stopMonitor() {
- if (!session_loggedin()) {
- $this->setError(_('You can only monitor if you are logged in'));
- return false;
+ function stopMonitor ($u = -1) {
+ if ($u == -1) {
+ if (!session_loggedin()) {
+ $this->setError(_('You can only monitor if you are logged in'));
+ return false;
+ }
+ $u = user_getid() ;
}
return db_query_params ('DELETE FROM forum_monitored_forums WHERE user_id=$1 AND forum_id=$2',
- array (user_getid(),
+ array ($u,
$this->getID())) ;
}
*
* @return false - always false - always use the getErrorMessage() for feedback
*/
- function setMonitor() {
- if (session_loggedin()) {
-
- $user_id=user_getid();
- $user =& user_get_object(user_getid());
-
- } else {
-
- $this->setError(_('SetMonitor::Valid Email Address Required'));
- return false;
-
+ function setMonitor ($user_id = -1) {
+ if ($user_id == -1) {
+ if (!session_loggedin()) {
+ $this->setError(_('You can only monitor if you are logged in'));
+ return false;
+ }
+ $user_id = user_getid() ;
}
$res = db_query_params ('SELECT * FROM artifact_type_monitor WHERE group_artifact_id=$1 AND user_id=$2',
array ($this->getID(),
$user_id)) ;
-
if (!$res || db_numrows($res) < 1) {
//not yet monitoring
$res = db_query_params ('INSERT INTO artifact_type_monitor (group_artifact_id,user_id) VALUES ($1,$2)',