SingSnap

Online karaoke community

Singsnap is a free online karaoke community where you can sing and record from a large variety of karaoke songs and comment on other karaoke enthusiasts' performances. To take full advantage, all you need is an inexpensive web cam and microphone.

Plugins Used

Code Samples

Interesting samples of code shared by the site maker.

Sample 1: Unblocking a member

This code is used when a member is unblocking someone else on the site. First we get both members, then we call the "unblock" method which returns true if the user was unblocked successfully. Then we just set a random Flash message to keep things interesting for people who use this feature often :)

<cfset currentUser = model("user").findByKey(request.user.id)>
<cfset otherUser = model("user").findByKey(params.key)>
<cfif currentUser.unblock(otherUser)>
    <cfset messages = ArrayNew(1)>
    <cfset messages[1] = "The block was removed for #otherUser.screenName#.">
    <cfset messages[2] = "How sweet of you to unblock #otherUser.screenName#.">
    <cfset messages[3] = "#otherUser.screenName# should be happy now that the block has been lifted.">
    <cfset flashInsert(notice=messages[RandRange(1,ArrayLen(messages))])>
<cfelse>
    <cfset flashInsert(alert="Sorry, there was an error unblocking that member.")>
</cfif>
<cfset redirectTo(back=true)>