hwdsb / BP-Moderation

Content flagging and moderation for BuddyPress social networks
http://wordpress.org/plugins/bp-moderation/
8 stars 4 forks source link

Add Support for Video Custom Post Type #12

Closed mrjarbenne closed 8 years ago

mrjarbenne commented 8 years ago

It would be helpful to be able to flag videos posted on the Video Portal as inappropriate. These notes from the wp repo "Other Notes" section should help:

Register a content type

The main entry point in bp-moderation is bpModeration::register_content_type(), it allows you to register a content type and has to be called at every page load.

You'll need to provide:

a slug: used to differentiate between content types (alfanumeric and underscore only) a label: human readable name of the content type (used in backend) some callbacks: called by bp-moderation to request information/operations on your contents activity types: the activity types that your content are posted on the activity stream with (if any)

Code sample

examples/bpMod_ContentType_BlogPostExample.php

is a code sample that shows how to integrate content types with bp-moderation taking blog posts as an example, you can also modify and adapt it to your content type.

Other informations are in the doc of bpModeration::register_content_type() and bpModFrontend::get_link()

, those are most likely the only two bp-moderation methods you need to use.

All core content types are in bpModDefaultContentTypes.php, but they are hardcoded for speed reasons, so don't use them as an example.

Advanced integration with activities

If you use the same primary and secondary id convention for activities and bp-moderation you only have to tell the activity types of your content when registering, bp-moderation is already hooked in the activity loop and will print the links for your contents too.

Instead if some reason you cat use the same convention or you want to customize the activity loop flag button, you can use the filter bp_moderation_activity_loop_link_args_{the activity type}

where {the activity type} is the activity type you'd like to filter. Look in bpModFrontend::activity_loop_link() to see what to filter. Contents generated by non members

It's possible to have contents generated by not members (e.g. blog comments). If you have to provide a user id to bp-moderation give 0 for it, but you'll also need to filter author information for displaying them in backend table. Use the filter

bp_moderation_author_detailsfor{slug used in content type registration}

to add missing info, look in bpModBackend::author_details() to see info needed.

If none of the above this is the easier way to get a custom content type loaded:

place your custom content type php file in wp-content/plugins/bp-moderation-content-types/ copy this line in wp-config.php define('BPMOD_LOAD_CUSTOM_CONTENT_TYPES', true);

mrjarbenne commented 8 years ago

https://github.com/hwdsbcommons/BP-Moderation/blob/master/examples/bpMod_ContentType_BlogPostExample.php

r-a-y commented 8 years ago

I decided to fix this in Video Portal instead.

mrjarbenne commented 8 years ago

Cool. Thanks.