<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Likes</title><link>https://community.telligent.com/community/11/w/developer-training/65104/likes</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>Likes</title><link>https://community.telligent.com/community/11/w/developer-training/65104/likes</link><pubDate>Tue, 04 Aug 2020 21:28:19 GMT</pubDate><guid isPermaLink="false">e59822ac-e757-43e5-94e1-93a64d239ba4</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65104/likes#comments</comments><description>Current Revision posted to Developer Training by Former Member on 08/04/2020 21:28:19&lt;br /&gt;
&lt;p&gt;The [[api-documentation:ILikeableContentType Plugin Type|ILikeableContentType]] interface provides support for liking content.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h3&gt;&lt;a id="Why_should_I_make_my_content_likable" name="Why_should_I_make_my_content_likable"&gt;&lt;/a&gt;Why should I make my content likable?&lt;/h3&gt;
&lt;p&gt;If you would like users to provide feedback by demonstrating that they like your content then consider implementing the [[api-documentation:ILikeableContentType Plugin Type|ILikeableContentType]] within your&amp;nbsp;[[api-documentation:IContentType Plugin Type|IContentType]] plugin.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Creating_an_ILikeableContentType_plugin" name="Creating_an_ILikeableContentType_plugin"&gt;&lt;/a&gt;Creating an ILikeableContentType plugin&lt;/h3&gt;
&lt;p&gt;The [[api-documentation:ILikeableContentType Plugin Type|ILikeableContentType]] is defined in the &lt;code&gt;Telligent.Evolution.Extensibility.Content.Version1&lt;/code&gt; namespace of &lt;code&gt;Telligent.Evolution.Core.dll&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is important to note that one or more Core Services can be implemented in the same [[api-documentation:IContentType Plugin Type|IContentType]] class.&lt;/p&gt;
&lt;p&gt;Begin by defining whether a user can like your content. In this sample we limit liking to users that are not the author of the content. It is also a good practice to verify the content exist.&lt;/p&gt;
&lt;p&gt;Similarly it is required to define who can unlike content. This logic can be similar to the &lt;code&gt;CanLike&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;SupportsLikes&lt;/code&gt; member returns whether any content of this content type can be liked. This property can simply return true.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public bool CanLike(Guid contentId, int userId)
{
    var content = LinksData.GetLink(contentId) as IContent;
    if (content == null) return false;

    return content.CreatedByUserId != userId;
}

public bool CanUnlike(Guid contentId, int userId)
{
    var content = LinksData.GetLink(contentId) as IContent;
    if (content == null) return false;

    return content.CreatedByUserId != userId;
}

public bool SupportsLikes
{
    get { return true; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the full sample.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/3581_2E00_LinkItemContentType_2E00_cs"&gt;community.telligent.com/.../3581_2E00_LinkItemContentType_2E00_cs&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: likes&lt;/div&gt;
</description></item><item><title>Likes</title><link>https://community.telligent.com/community/11/w/developer-training/65104/likes/revision/1</link><pubDate>Thu, 13 Jun 2019 19:28:33 GMT</pubDate><guid isPermaLink="false">e59822ac-e757-43e5-94e1-93a64d239ba4</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65104/likes#comments</comments><description>Revision 1 posted to Developer Training by Ben Tiedt on 06/13/2019 19:28:33&lt;br /&gt;
&lt;p&gt;The [[api-documentation:ILikeableContentType Plugin Type|ILikeableContentType]] interface provides support for liking content.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h3&gt;&lt;a id="Why_should_I_make_my_content_likable" name="Why_should_I_make_my_content_likable"&gt;&lt;/a&gt;Why should I make my content likable?&lt;/h3&gt;
&lt;p&gt;If you would like users to provide feedback by demonstrating that they like your content then consider implementing the [[api-documentation:ILikeableContentType Plugin Type|ILikeableContentType]] within your&amp;nbsp;[[api-documentation:IContentType Plugin Type|IContentType]] plugin.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Creating_an_ILikeableContentType_plugin" name="Creating_an_ILikeableContentType_plugin"&gt;&lt;/a&gt;Creating an ILikeableContentType plugin&lt;/h3&gt;
&lt;p&gt;The [[api-documentation:ILikeableContentType Plugin Type|ILikeableContentType]] is defined in the &lt;code&gt;Telligent.Evolution.Extensibility.Content.Version1&lt;/code&gt; namespace of &lt;code&gt;Telligent.Evolution.Core.dll&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is important to note that one or more Core Services can be implemented in the same [[api-documentation:IContentType Plugin Type|IContentType]] class.&lt;/p&gt;
&lt;p&gt;Begin by defining whether a user can like your content. In this sample we limit liking to users that are not the author of the content. It is also a good practice to verify the content exist.&lt;/p&gt;
&lt;p&gt;Similarly it is required to define who can unlike content. This logic can be similar to the &lt;code&gt;CanLike&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;SupportsLikes&lt;/code&gt; member returns whether any content of this content type can be liked. This property can simply return true.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public bool CanLike(Guid contentId, int userId)
{
    var content = LinksData.GetLink(contentId) as IContent;
    if (content == null) return false;

    return content.CreatedByUserId != userId;
}

public bool CanUnlike(Guid contentId, int userId)
{
    var content = LinksData.GetLink(contentId) as IContent;
    if (content == null) return false;

    return content.CreatedByUserId != userId;
}

public bool SupportsLikes
{
    get { return true; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the full sample.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/3581_2E00_LinkItemContentType_2E00_cs"&gt;community.telligent.com/.../3581_2E00_LinkItemContentType_2E00_cs&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>