Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ideas_user_subscribe()
- {
- if(!xarVarFetch('idea_id', 'id', $idea_id, NULL, XARVAR_NOT_REQUIRED)) {return;}
- if (!isset($idea_id) || !is_numeric($idea_id)) {
- $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)',
- 'idea_id', 'user', 'subscribe', 'ideas');
- throw new Exception($msg);
- }
- $uid = xarUserGetVar('uid');
- // Load up database details.
- $dbconn = xarDB::getConn();
- $xartable = xarDB::getTables();
- $prefix = xarDB::getPrefix();
- $subscriptions_table = $prefix . '_ideas_subscriptions';
- // Insert instance details.
- $query = 'INSERT INTO ' . $subscriptions_table . ' (
- role_id, idea_id,
- status
- ) VALUES (?, ?, ?)';
- $dbconn->Execute($query, array($uid, $idea_id, 1));
- $redirect = xarModURL('ideas','user','display',array('itemid' => $idea_id, 'name' => 'ideas_ideas'));
- xarResponse::redirect($redirect);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement