コード例 #1
0
 /**
  * filter post content and excerpt adding the report link
  *
  * @param string $content
  * @return string
  */
 function append_link($content)
 {
     //only for posts
     if ('post' != get_post_type()) {
         return $content;
     }
     //this is the method that generate the report link, read the method doc and look the defaults for details
     //if this content has also activities is better to have id and id2 consistent with ids used in the activity
     $link = bpModFrontend::get_link(array('type' => 'blog_post_example', 'id' => $GLOBALS['wpdb']->blogid, 'id2' => get_the_ID(), 'author_id' => get_the_author_meta('id'), 'unflagged_text' => __('Flag this post as inappropriate', 'your-text-domain')));
     //autop will run after this, so we space with two lines
     return "{$content}\n\n{$link}";
 }
コード例 #2
0
 /**
  * print flag/unflag link
  *
  * static method for printing a reporting link
  *
  * @see bpModFrontend::generate_link for args details
  */
 function link($args = '')
 {
     echo bpModFrontend::get_link($args);
 }
コード例 #3
0
 function private_message_print_links()
 {
     $report_links = array();
     foreach ((array) $GLOBALS['thread_template']->thread->sender_ids as $sender_id) {
         if ($sender_id != bp_loggedin_user_id()) {
             $report_links[] = bpModFrontend::get_link(array('type' => 'private_message', 'id' => bp_get_the_thread_id(), 'id2' => $sender_id, 'unflagged_text' => bp_core_get_user_displayname($sender_id), 'flagged_text' => bp_core_get_user_displayname($sender_id), 'custom_class' => 'button'));
         }
     }
     if (!count($report_links)) {
         return;
     }
     echo '<p class="bp-mod-pm-thread-links">';
     printf(__('Flag as inappropriate messages by: %s', 'bp-moderation'), join(' ', $report_links));
     echo '</p>';
 }
コード例 #4
0
 function forum_post_print_link()
 {
     global $topic_template, $bp;
     $link = bpModFrontend::get_link(array('type' => 'forum_post', 'author_id' => $topic_template->post->poster_id, 'id' => $bp->groups->current_group->id, 'id2' => $topic_template->post->post_id, 'unflagged_text' => __('Flag', 'bp-moderation'), 'custom_class' => 'bpm-no-images'));
     echo "{$link} | ";
 }