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

id bigint(20) NOT NULL PRIMARY
blog_id bigint(20) NULL NULL blog_id
media_id bigint(20) NOT NULL KEY post ID of attachment
media_author bigint(20) NOT NULL KEY post_author
media_title text post_title
album_id bigint(20) KEY post_parent
media_type varchar(100) NULL NULL
context varchar(100) NULL NULL post_type, current BuddyPress Component, custom
context_id bigint(20) NULL NULL post ID, component ID
activity_id bigint(20) NULL NULL BuddyPress activity ID
cover_art varchar(250) NULL NULL media_id reference to {wp_}rt_rtm_media table
privacy int(3) NULL NULL
views bigint(20) NULL 0
downloads bigint(20) NULL 0
ratings_total bigint(20) NULL 0
ratings_count bigint(20) NULL 0
ratings_average decimal(4,2) NULL 0
likes bigint(20) NULL 0
dislikes bigint(20) NULL 0

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_id bigint(20)
media_id bigint(20)
meta_key varchar(255)
meta_value longtext

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

id bigint(20) NOT NULL PRIMARY AUTO_INCREMENT
user_id bigint(20) NOT NULL 0 KEY
media_id bigint(20) NOT NULL 0 KEY
action varchar(255)
value varchar(255)
action_date TIMESTAMP NULL CURRENT_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_id bigint(20) NULL KEY
user_id bigint(20) NOT NULL 0 KEY
privacy int(3) NULL KEY
blog_id bigint(20) NULL NULL

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.