Media Comments on Activity Stream when using Open Social

I have added the ability for users to upload Media to my OS install. I have a Media Type of Photo and have configured media to create a Message that displays in the activity stream.

For some reason no matter what media activity you comment on in the stream, the comment is displayed to the top most media activity. The stream is sorted by Authored on (descending)

I have easily recreated this on a fresh OS install as well.

Fresh Install
Enable Media
Create Comment type for Media
Create Media Type of Photo
Add Comment field to Media Type: Photo
Create new message template to display Media: Photo on the Stream (home) when media is created.
You also need to edit the Activity stream view and remove “Activity: Filter activities for personalised homepage (= )” from the filter. (I still don’t know what this fully filters activities by.)

Error,

essage Notice: Trying to get property ‘target_id’ of non-object in
Drupalsocial_postPluginFieldFieldFormatterCommentPostFormatter->viewElements() (line 115 of
/var/www/opensocial/html/profiles/contrib/social/modules/social_features/social_post/src/Plugin/Field/FieldFormatter/CommentPostFormatter.php)

Complete Code:

<?php

namespace Drupalsocial_postPluginFieldFieldFormatter;

use DrupalcommentPluginFieldFieldTypeCommentItemInterface;
use DrupalcommentPluginFieldFieldFormatterCommentDefaultFormatter;
use DrupalCoreFieldFieldItemListInterface;
use DrupalCoreFormFormStateInterface;
use DrupalCoreEntityEntityInterface;
use DrupalcommentCommentManagerInterface;
use DrupalcommentCommentInterface;
use DrupalCoreLink;

/**
 * Provides a post comment formatter.
 *
 * @FieldFormatter(
 *   id = "comment_post",
 *   module = "social_post",
 *   label = @Translation("Comment on post list"),
 *   field_types = {
 *     "comment"
 *   },
 *   quickedit = {
 *     "editor" = "disabled"
 *   }
 * )
 */
class CommentPostFormatter extends CommentDefaultFormatter {

  /**
   * {@inheritdoc}
   */
  public static function defaultSettings() {
    return (
      'num_comments' => 2,
      'order' => 'ASC',
    );
  }

  /**
   * {@inheritdoc}
   */
  public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = ();
    $output = ();

    $field_name = $this->fieldDefinition->getName();
    $entity = $items->getEntity();

    $status = $items->status;

    $comments_per_page = $this->getSetting('num_comments');

    if ($status != CommentItemInterface::HIDDEN && empty($entity->in_preview) &&
      // Comments are added to the search results and search index by
      // comment_node_update_index() instead of by this formatter, so don't
      // return anything if the view mode is search_index or search_result.
      !in_array($this->viewMode, ('search_result', 'search_index'))) {
      $comment_settings = $this->getFieldSettings();

      $comment_count = $entity->get($field_name)->comment_count;

      // Only attempt to render comments if the entity has visible comments.
      // Unpublished comments are not included in
      // $entity->get($field_name)->comment_count, but unpublished comments
      // should display if the user is an administrator.
      $elements('#cache')('contexts')() = 'user.permissions';
      if ($this->currentUser->hasPermission('access comments') || $this->currentUser->hasPermission('administer comments')) {
        $output('comments') = ();

        if ($comment_count || $this->currentUser->hasPermission('administer comments')) {
          $mode = $comment_settings('default_mode');
          $comments = $this->loadThread($entity, $field_name, $mode, $comments_per_page, FALSE);
          if ($comments) {
            $build = $this->viewBuilder->viewMultiple($comments);
            $output('comments') += $build;
          }

          if ($comments_per_page && $comment_count > $comments_per_page) {
            $t_args = (':num_comments' => $comment_count);
            $more_link = $this->t('Show all :num_comments comments', $t_args);

            // Set link classes to be added to the button.
            $more_link_options = (
              'attributes' => (
                'class' => (
                  'btn',
                  'btn-flat',
                  'brand-text-primary',
                ),
              ),
            );

            // Set path to post node.
            $link_url = $entity->urlInfo('canonical');

            // Attach the attributes.
            $link_url->setOptions($more_link_options);

            // Build the link.
            $more_button = Link::fromTextAndUrl($more_link, $link_url);
            $output('more_link') = $more_button;
          }
        }
      }

      // Append comment form if the comments are open and the form is set to
      // display below the entity. Do not show the form for the print view mode.
      if ($status == CommentItemInterface::OPEN && $comment_settings('form_location') == CommentItemInterface::FORM_BELOW && $this->viewMode != 'print') {
        // Only show the add comment form if the user has permission.
        $elements('#cache')('contexts')() = 'user';
        $add_comment_form = FALSE;
        // Check if the post has been posted in a group.
        $group_id = $entity->field_recipient_group->target_id;
        if ($group_id) {
          /** @var DrupalgroupEntityGroup $group */
          $group = entity_load('group', $group_id);
          if ($group->hasPermission('add post entities in group', $this->currentUser) && $this->currentUser->hasPermission('post comments')) {
            $add_comment_form = TRUE;
          }
        }
        elseif ($this->currentUser->hasPermission('post comments')) {
          $add_comment_form = TRUE;
        }
        if ($add_comment_form) {
          $output('comment_form') = (
            '#lazy_builder' => ('comment.lazy_builders:renderForm', (
              $entity->getEntityTypeId(),
              $entity->id(),
              $field_name,
              $this->getFieldSetting('comment_type'),
            ),
            ),
            '#create_placeholder' => TRUE,
          );
        }
      }

      $elements() = $output + (
        '#comment_type' => $this->getFieldSetting('comment_type'),
        '#comment_display_mode' => $this->getFieldSetting('default_mode'),
        'comments' => (),
        'comment_form' => (),
        'more_link' => (),
      );
    }

    return $elements;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $element = ();
    $element('num_comments') = (
      '#type' => 'number',
      '#min' => 0,
      '#max' => 10,
      '#title' => $this->t('Number of comments'),
      '#default_value' => $this->getSetting('num_comments'),
    );
    $orders = (
      'ASC' => $this->t('Oldest first'),
      'DESC' => $this->t('Newest first'),
    );
    $element('order') = (
      '#type' => 'select',
      '#title' => $this->t('Order'),
      '#description' => $this->t('Select the order used to show the list of comments.'),
      '#default_value' => $this->getSetting('order'),
      '#options' => $orders,
    );
    return $element;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsSummary() {
    return ();
  }

  /**
   * {@inheritdoc}
   *
   * @see DrupalcommentCommentStorage::loadThead()
   */
  public function loadThread(EntityInterface $entity, $field_name, $mode, $comments_per_page = 0, $pager_id = 0) {
    // @TODO: Refactor this to use CommentDefaultFormatter->loadThread with dependency injection instead.
    $query = db_select('comment_field_data', 'c');
    $query->addField('c', 'cid');
    $query
      ->condition('c.entity_id', $entity->id())
      ->condition('c.entity_type', $entity->getEntityTypeId())
      ->condition('c.field_name', $field_name)
      ->condition('c.default_langcode', 1)
      ->addTag('entity_access')
      ->addTag('comment_filter')
      ->addMetaData('base_table', 'comment')
      ->addMetaData('entity', $entity)
      ->addMetaData('field_name', $field_name);

    $comments_order = $this->getSetting('order');

    if (!$this->currentUser->hasPermission('administer comments')) {
      $query->condition('c.status', CommentInterface::PUBLISHED);
    }
    if ($mode == CommentManagerInterface::COMMENT_MODE_FLAT) {
      $query->orderBy('c.cid', $comments_order);
    }
    else {
      // See comment above. Analysis reveals that this doesn't cost too
      // much. It scales much much better than having the whole comment
      // structure.
      $query->addExpression('SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))', 'torder');
      $query->orderBy('torder', $comments_order);
    }

    // Limit The number of results.
    if ($comments_per_page) {
      $query->range(0, $comments_per_page);
    }

    $cids = $query->execute()->fetchCol();

    $comments = ();
    if ($cids) {
      $comments = entity_load_multiple('comment', $cids);
    }

    return $comments;
  }

}

Looking for Quora Comments

Hi,

I'm looking for Quora Comment service provider.

I will give you 50 Quora Questions. You have to answer it by including our link.

Send me your price.

Payment via PayPal.

YouTube Video Promotion Fast Delivery for $1

YouTube Video Promotion Fast Delivery

35 YouTube Comments Promotion Real and genuine fast delivery only for $1.

Quality of my service

# Real and genuine

# Fast Delivery

# Professional service

# High quality service

# Cheap rate

# Extra bonuses

# 24/7 hours online support

NoteYou have to submit your comments list.

Don’t delay to order me

Thanks sir

.

PAIN. Comments Pagination – WordPress Development Stack Exchange

Sorry for flame, but i wasted 7-12 hours trying to understand how comments pagination works….
Never thought that simple step will take that much with WordPress :'((((

i output comments in my theme like this:

wp_list_comments(
      array(
         'callback' => 'regular_comment',
         'avatar_size' => 100,
         'style'       => 'ol',
         'short_ping'  => true,
         'reply_text'  => __( 'Reply', 'twentyseventeen' ) . ' ' . '<img class="comments-icon" src="' . get_path() . '/assets/i/others/chat.svg">',
           )
      );

And trying to use

echo paginate_comments_links();

for outputting pagination. Now after many hours of trying i understood that there is no way to use paginated comments unless you select that option in admin under Settings->Discussion…..

set_option(‘page_comments’);

If that option is not set – no matter how hard i try to get total comments and set ‘per_page’ arg for wp_list_comments() – pagination urls (http://my-site.com/post-1/comment-page-{N}/#comments simply won’t work – url just redicts to http://my-site.com/post-1

So, i have to setup that option… but. If you let’s say want on one page to show 5 comments per page and 10 on another, then you use ‘per_page’ for wp_list_comments(), right ?

wp_list_comments( ...args, 'per_page' => 5)

while in admin panel we have let’s say 10. After setting this up we need to tell paginate_comments_links() total number of comments on pages, because otherwise it will count using values provided in admin settings(under Settings->Discussion)
So,

paginate_comments_links( array( 'total' => count_number_some_way ) )

In this case we will get pagination numbers as we want, but pagination will only work for pages defined in admin panel…. comments now show up on page according to ‘per_page’ argument for wp_list_comments, but pagination still works only for values in admin panel… It does show different number of pages. For example, we have 12 total comments on post, defined 6 per page in admin panel and now want to display 2 per page via ‘per_page’ argument, so pagination number will increase from 1..2 to 1..2..3..4..5..6. But only 1..2 will work, other links will just output no comments…

200 Blog Comments Seo Backlinks On High DA PA for 4 for $4

200 Blog Comments Seo Backlinks On High DA PA for 4

When Google Bots Are Moving A web site they search for Outside links indicate Different websites. If this links is “Do-Follow” then SEO may uses the link and therefore link liquid gets passed. Links that rely as factors, driving SEO link Building and Increasing the web sites, supporting them get higher in the SERP’s As A Result.

.

I will make 170 high quality blog comments backlinks for $3

I will make 170 high quality blog comments backlinks

Manually Blog Commenting backlinks Service is the most trusty and potential link building way in the SEO market.

Are you looking for HA, backlinks? So, we diligently welcome you to my

service. Google loves real work, so we provide manual service that is

done by genuine humans.

.

How to restore the comments on your deleted slides on Google slides

Someone made some comments on some of my google slides but those slides were deleted by some other folks. When I try to restore version history I can only get the slides not the comments, is it possible to get the comments back?thanks!

Dan

I will create 100 high quality unique domain backlinks using blog comments for $4

I will create 100 high quality unique domain backlinks using blog comments

We Manually Build 100 UNIQUE DOMAIN Backlinks.
You Will get Contextual Backlinks along with other powerful Links to skyrocket your website. Latest SEO strategy 2018 to increase the authority of your money site with credible HIGH DA & powerful backlinks. All backlinks are on World Top Authority websites to ensure guaranteed higher ranking. service
Service Features:

  • 100% Manual Working. Mind it ALL SEO by real humans.
  • Made according to Latest Google Update 2018.
  • 100% Google and Matt Cutts animals safe.
  • NO automated software.
  • 100% Approval Rate.
  • Up to 72 hours Order Delivery.
  • 100% customer satisfaction.
  • 24/7 Customer Support.
  • Well-furnished Excel report with order delivery.

.

Is there a collaboration tool where multiple contributors can comment but their comments are only visible to the owner of the doc?

I know, that this is currently not possible with Google Docs, but maybe there is another tool, that is able to provide this?

It can also be a tool that needs to be paid for.

In detail: I want to share a doc with several people, I want them to make comments in the same doc (so I don’t have to bring together several versions with their individual comments afterwards) but I do not want them to be able to see the comments made by others, meaning that they can only see their own comments and only me (as the owner of the doc) can see all comments.

Whats the deal with foreign websites mirroring Youtube Videos *AND* comments 1:1?

Examples:
https://azchart.info/
https://trshow.info/

i dont speak the language there, but it is quite obvious the site, or a user on it, is copying Youtube videos, and somehow even the comments are present in the comment section? It doesnt seem to be some kind of embedded Youtube site – i cant think of how they copy all the comments with names and avatars.

The reason i am asking this is because they copied a video where i was commenting YEARS ago, and back then i used another nickname. I am trying to void this nickname from the internet, and these obscure sites are the only ones still popping up.

I am trying to contact the sites (i have my doubts about their GDPR compliance), but i want to know what their background is in general. Only reason i can think of is some kind of mirror for countries where Youtube is blocked? But it sounds like a lot of work to embed every single Youtube video with comments.