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


Creating custom Jamroom template functions and modifiers Index Using the Jamroom Upload Progress Meter

Adding support for Jamroom Comments into your Module

If you would like to be able to support Jamroom Comments for the items that your custom Jamroom Module provides, the Jamroom Comment script (comment.php) offers support for storing, and the Jamroom Ranking System offers support for viewing/displaying the comments.

Storing a Comment

Storing a custom module comment into the Jamroom Comments database table is fairly easy and straightforward - there is no function or code that must be written that is specific to your module.  Instead, you simply must create the comment form with the proper variables in place so that Jamroom "sees" it is a module comment - it will then store it appropriately.  To do this, you must create your comment form with 2 additional hidden form values like this:

<form method="post" action="{$JAMROOM_URL}/comment.php?mode=save_comment">
<input type="hidden" name="module" value="MODULE_NAME">
<input type="hidden" name="media_id" value="{$UNIQUE_MEDIA_ID}">
... the rest of the comment add form ...

So there are TWO (2) hidden fields that have been added to our "save_comment" form:

  • MODULE_NAME - this must be the name of your module directory - i.e. "jrYouTube".
  • {$UNIQUE_MEDIA_ID} - In order for Jamroom to differentiate the comments that might be attached to one media item from the next (i.e. if you want to allow comments on pictures that your module manages), then you must pass in a valid unique "media_id".  Most likely this is going to be the AUTO_INCREMENT column value from your Jamroom custom module database table.

That's it - as long as Jamroom sees these 2 additional values set properly, the comment will be stored in the comments table within the Jamroom database.

Viewing Comments

To view the comments that have been saved for a specific module's media item, you will use the Jamroom Ranking System just like viewing any of the internally support comments - i.e.

{jr_ranking mode="comment" type="MODULE_NAME" media_id=$UNIQUE_MEDIA_ID ... }

Once again, we see the same 2 unique fields that must be provided:

  • MODULE_NAME - this must be the name of your module directory - i.e. "jrYouTube".
  • $UNIQUE_MEDIA_ID - In order for Jamroom to differentiate the comments that might be attached to one media item from the next (i.e. if you want to allow comments on pictures that your module manages), then you must pass in a valid unique "media_id".  Most likely this is going to be the AUTO_INCREMENT column value from your Jamroom custom module database table.

This will ensure Jamroom only grabs the comments that are associated with a specific media item in your module's Jamroom database table.  Details on using the {jr_ranking} template function can be found here.

Important Note

One thing that is important to know when "viewing" your custom Jamroom Comments, is that the Jamroom Ranking System has no way of knowing information about the specific media item you are displaying the comments for.  For the most part this shouldn't be an issue, but it does work differently then the "internally" supported comment types (where each comment that is displayed has access to all of the Media Item's template variables as well).

If you need access to information about the media item the comment is related to WITHIN each row of the comment output by the Ranking System, you'll want to use an embedded {jr_ranking} call to a custom Ranking System mode you have created for your module.

Creating custom Jamroom template functions and modifiers Creating custom Jamroom template functions and modifiers page 18 of 23 Using the Jamroom Upload Progress Meter Using the Jamroom Upload Progress Meter
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
Documentation
Support Center
Contact Support
Community Forum
Member Sites
Developers
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network