Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. function ideas_user_subscribe()
  2. {
  3.  
  4. if(!xarVarFetch('idea_id', 'id', $idea_id, NULL, XARVAR_NOT_REQUIRED)) {return;}
  5.  
  6. if (!isset($idea_id) || !is_numeric($idea_id)) {
  7. $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)',
  8. 'idea_id', 'user', 'subscribe', 'ideas');
  9. throw new Exception($msg);
  10. }
  11.  
  12. $uid = xarUserGetVar('uid');
  13.  
  14. // Load up database details.
  15. $dbconn = xarDB::getConn();
  16. $xartable = xarDB::getTables();
  17. $prefix = xarDB::getPrefix();
  18. $subscriptions_table = $prefix . '_ideas_subscriptions';
  19.  
  20. // Insert instance details.
  21. $query = 'INSERT INTO ' . $subscriptions_table . ' (
  22. role_id, idea_id,
  23. status
  24. ) VALUES (?, ?, ?)';
  25. $dbconn->Execute($query, array($uid, $idea_id, 1));
  26.  
  27. $redirect = xarModURL('ideas','user','display',array('itemid' => $idea_id, 'name' => 'ideas_ideas'));
  28.  
  29. xarResponse::redirect($redirect);
  30. return;
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement