function mediafront_user_set_status in MediaFront 6
Same name and namespace in other branches
- 6.2 plugins/mediafront_user/mediafront_user.module \mediafront_user_set_status()
1 string reference to 'mediafront_user_set_status'
- mediafront_user_service in plugins/
mediafront_user/ mediafront_user.module - Implementation of hook_service()
File
- plugins/
mediafront_user/ mediafront_user.module, line 30
Code
function mediafront_user_set_status($verb, $noun) {
global $user;
if ($user->uid) {
// Look for an existing status by looking for the same user & verb.
if (db_result(db_query("SELECT COUNT(*) FROM {mediafront_user} WHERE uid=%d", $user->uid)) > 0) {
// We just need to update the current status.
db_query("UPDATE {mediafront_user} SET verb='%s', noun='%s' WHERE uid=%d", $verb, $noun, $user->uid);
}
else {
// Insert a new user status into the mediafront_user database.
db_query("INSERT INTO {mediafront_user} (uid, verb, noun) VALUES (%d, '%s', '%s')", $user->uid, $verb, $noun);
}
}
return true;
}