Database Description

rtMedia Table Overview

rtMedia uses the following tables:

  • {wp_}rt_rtm_media for indexing media
  • {wp_}rt_rtm_media_meta for storing metadata as key-value pairs.
  • {wp_}rt_rtm_media_interaction for storing data on actions carried out on media.
  • {wp_}rt_rtm_activity for storing rtMedia BuddyPress activity data.

{wp_}rt_rtm_media

Field Type null default key WP relation

idbigint(20)NOT NULLPRIMARY
blog_idbigint(20)NULLNULLblog_id
media_idbigint(20)NOT NULLKEYpost ID of attachment
media_authorbigint(20)NOT NULLKEYpost_author
media_titletextpost_title
album_idbigint(20)KEYpost_parent
media_typevarchar(100)NULLNULL
contextvarchar(100)NULLNULLpost_type, current BuddyPress Component, custom
context_idbigint(20)NULLNULLpost ID, component ID
activity_idbigint(20)NULLNULLBuddyPress activity ID
cover_artvarchar(250)NULLNULLmedia_id reference to {wp_}rt_rtm_media table
privacyint(3)NULLNULL
viewsbigint(20)NULL0
downloadsbigint(20)NULL0
ratings_totalbigint(20)NULL0
ratings_countbigint(20)NULL0
ratings_averagedecimal(4,2)NULL0
likesbigint(20)NULL0
dislikesbigint(20)NULL0

All Keys:

Following keys are defined for this table:

  • PRIMARY KEY (id)
  • KEY media_id (media_id)
  • KEY media_author (media_author)
  • KEY album_id (album_id)
  • KEY media_author_id (album_id,media_author)
  • KEY context_author_album_id (context_id,album_id,media_author)
  • KEY context(context)

Description

id

The unique id for each media item, including albums. This media object is accessible at the /media/{id} REST endpoint from a valid context.

blog_id

The id of the blog in a multisite install. For single wordpress site this will be always set to 1.

media_id

This will always refer to a post_id from wp_posts table.

  • For media files: The id of the attachment post_type
  • For albums: The id of the post that is considered an album. Can be any post type or the inbuilt rt_media_album post type.

media_author The id of the author of the media. This has the same value as post_author for the media_id in the WordPress posts table. In short, this will be always set to the logged in user who is uploading media from the web-interface.

media_title The title for the media. This has the same value as post_title for the media_id in the WordPress wp_poststable.

album_id The id of the album, to which this media belongs.

  • For media files: The post_parent in the WordPress table
  • For albums: Default NULL. In future, when we add the parent-child album concept, this will be set to post_parent in the WordPress table.

media_type

  • Any of the registered types photo, audio, video, album or a custom one.
  • rtMedia-PRO adds playlist, docs and others as media_type. context *The context associated with the media. *This could be any of the following:

WordPress:

  • For Post type: post, page, etc
  • For Comments: comment
  • For Dashboard upload: dashboard
  • bbPress topic or reply
  • BuddyPress component: activity, group, profile
  • WordPress Comment: comment
  • A custom context

context_id The unique id for the context to differentiate among them. For example, for BuddyPress profiles upload, when context is set to profile, context_id will be set to buddypress profile_id (i.e. wordpress user_id). This can be NULL also for some context where differentiation is not required, e.g. dashboard uploads.

activity_id Default is NULL. The id of the activity generated if BuddyPress is active and the Activity component is enabled.

covert_art Default is NULL Used for media_type album, music and video only. For album, it is media_id in {wp_}rt_rtm_media table. For music and video, it is URL.

privacy Default is NULL. Used for BuddyPress Profile media tab. Valid values are:

  • 0 = Public
  • 20 = Logged-in/Registered-Users
  • 40 = Friends
  • 60 = Private
  • _80 = in moderation queue. This will be changed to

For BuddyPress Groups and bbPress Forums, values are:

  • 0 = public group/forum
  • 60 = private/hidden group/forum

When uploading from BuddyPress Activity Stream Uploader, if upload is sent to “My Profile”, only the privacy value will be set as per above. For BuddyPress Group uploads, this privacy column is not used. Media visibility is controlled by Group’s visibility setting.

views

Default is 0. View count will be incremented by 1 for every single media view inside lightbox or from single-media page. Counter is incremented by AJAX call to reduce load on server and avoid cache-effects. Currently PHP sessions are used to identify unique views from a visitor. We plan to make this more robust and gaming-safe in future.

Another table {wp_}rt_rtm_media_interaction is used to store details about views and other interactions.

downloads

Default is 0. The download count is incremented for every download action on that media. This will only work if download option is enabled in rtMedia-PRO settings.

ratings-total

Default is 0. The total ratings received, each instance adding a percentage based value.

**ratings-count

Default is 0. The total number of times, a media item has received ratings.

ratings-average

Default is 0. The average ratings received upto 1 decimal digit.

likes

Default is 0. The total number of like interactions. If user unlike, previously liked post this will be decremented.

dislikes

Default is 0. The total number of dislike interactions. This is reserved for future thumbs-up/down (vote-up/vote-down) style functionality.

{wp_}rt_rtm_media_meta

Field Type

meta_idbigint(20)
media_idbigint(20)
meta_keyvarchar(255)
meta_valuelongtext

All Keys

PRIMARY KEY (meta_id)

Description

  • meta_id The unique id for indexing.
  • media_id The id from the wp_rtm_media table
  • meta_key The key of the key-value pair
  • meta_value The value of the key-value pair

{wp_}rt_rtm_media_interaction

Field Type null Default Key Extra

idbigint(20)NOT NULLPRIMARYAUTO_INCREMENT
user_idbigint(20)NOT NULL0KEY
media_idbigint(20)NOT NULL0KEY
actionvarchar(255)
valuevarchar(255)
action_dateTIMESTAMPNULLCURRENT_TIMESTAMP

### All Keys * PRIMARY KEY (id), * KEY user_id(user_id), * KEY media_id(media_id) ### Description * `id` The unique id for indexing. * `user_id` The id of the user. * `media_id` The id from the _wp_rtm_media_ table. * `action` This could be a Like, Rating, or View. * `value` The value related to the action. * `action_date` The timestamp of the action. ## {wp_}rt_rtm_activity Field Type null Default Key Extra

activity_idbigint(20)NULLKEY
user_idbigint(20)NOT NULL0KEY
privacyint(3)NULLKEY
blog_idbigint(20)NULLNULL

All Keys

  • KEY activity_id(activity_id),
  • KEY user_id(user_id),
  • KEY privacy(privacy)

Description

  • activity_id The activity id of rtMedia activity.
  • user_id The id of the user.
  • privacy Privacy of this particular activity according to attached media.
  • blog_id The id of the blog in a multisite install. For single wordpress site, this will be always set to 1.