Jamroom Logo Jamroom 5 Core
is now Open Source!
Follow Jamroom on Twitter!

This document applies to Jamroom 3 only!
For current Jamroom 4 Documentation, visit the main Jamroom Documentation section.

{jr_media_access} Index {jr_not_logged_in}


The {jr_media_play_key} function is used for adding valid Media Play Keys into the Jamroom database.  This function was first introduced in Jamroom Core 3.3.8.


Name Type Required Default Description
mode string no n/a The "mode" parameter can be used to tell the {jr_media_play_key} function to either "add" a key to a temporary keychain, or "save" the keychain to the database.  By default, if the {jr_media_play_key} function is called without a mode parameter, the key is generated and saved in the same function call.  If the {jr_media_play_key} function is being called in a "loop" (in a row_template that is being used in the Jamroom Ranking System for example), then it is much more efficient to call the {jr_media_play_key} function with the "add" parameter in each row, the call it once in the footer_template with the "save" parameter.
media_id number yes* n/a

The media_id parameter is the $SONG_ID or $VIDEO_ID to add to the Play Keys.

*This parameter is required if no "mode" parameter is given, or the mode parameter is set to "add".

assign string no n/a By default the {jr_media_play_key} function returns the key that was created - if you would like to store this key in a variable for further processing, you can assign the output to a template variable.



Example embedding the {jr_media_play_key} into a Jamroom Ranking System "song" mode row_template (note that the lack of a "mode" parameter means that a database query will be executed for each call of the row template):

<a href="stream.php?mode=song_hifi&band_id={$BAND_ID}&song_id={$SONG_ID}&k={jr_media_play_key media_id=$SONG_ID}">Play song_id {$SONG_ID}</a>


A more efficient way is to use the following code in the row_template:

<a href="stream.php?mode=song_hifi&band_id={$BAND_ID}&song_id={$SONG_ID}&k={jr_media_play_key mode="add" media_id=$SONG_ID}">Play song_id {$SONG_ID}</a>

And then in the "footer_template" call it with the "save" mode, which then stores all generated keys in the database in a single query:

{jr_media_play_key mode="save"}


{jr_media_access} page 161 of 185 {jr_not_logged_in}
Solutions Products Support Community Company
Social Media Platform
Social Networking Software
Musician Website Manager
Community Builder
Jamroom 5
Jamroom 5 Modules
Jamroom Marketplace
Support Forum
Support Center
Contact Support
Community Forum
Member Sites
About Us
Contact Us
Privacy Policy
©2003 - 2023 The Jamroom Network