Akismet.Umbraco
5.0.0-beta2
dotnet add package Akismet.Umbraco --version 5.0.0-beta2
NuGet\Install-Package Akismet.Umbraco -Version 5.0.0-beta2
<PackageReference Include="Akismet.Umbraco" Version="5.0.0-beta2" />
paket add Akismet.Umbraco --version 5.0.0-beta2
#r "nuget: Akismet.Umbraco, 5.0.0-beta2"
// Install Akismet.Umbraco as a Cake Addin #addin nuget:?package=Akismet.Umbraco&version=5.0.0-beta2&prerelease // Install Akismet.Umbraco as a Cake Tool #tool nuget:?package=Akismet.Umbraco&version=5.0.0-beta2&prerelease
Akismet Management for Umbraco 9+
Adds Akismet dashboard to Umbraco backoffice.
Note: This package for Umbraco 9+ only. Check here for Umbraco 8
Installation
Install via NuGet
Install-Package Akismet.Umbraco
Post-Installation
After package installation, log into the backoffice and navigate to Users, Groups, Administrators and be sure to add Akismet.
Usage
Once installed, the AkismetService
service becomes available for checking comments. It is up to the developer to wire up to the contact forms but here is an abbreviated example:
using Akismet.NET;
using Akismet.Umbraco;
public class ContactFormController : SurfaceController
{
private readonly AkismetService AkismetService;
public ContactFormController(AkismetService akismetService)
{
AkismetService = akismetService;
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SubmitForm(ContactModel model)
{
// check validation
// eg - required fields, captcha, etc
string ip = Request.Headers["CF-Connecting-IP"] ?? Request.UserHostAddress;
if (String.IsNullOrWhiteSpace(ip))
ip = Request.ServerVariables["REMOTE_HOST"];
// see https://github.com/ahwm/Akismet.Net for all available options
AkismetComment comment = new AkismetComment
{
CommentAuthor = model.Name,
CommentAuthorEmail = model.EmailAddress,
Referrer = Request.UrlReferrer.ToString(),
UserAgent = Request.UserAgent,
UserIp = ip,
CommentContent = model.Message,
CommentType = AkismentCommentType.ContactForm,
Permalink = CurrentPage.Url(mode: UrlMode.Absolute)
};
// Specify true on CheckComment() to not include "Unspecified" as valid comments
bool isValid = AkismetService.CheckComment(comment, true);
if (!isValid)
{
return CurrentUmbracoPage();
}
// continue processing
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- AkismetApi.Net (>= 3.0.0.1)
- Umbraco.Cms.Web.BackOffice (>= 13.0.0 && < 13.99999.0)
- Umbraco.Cms.Web.Website (>= 13.0.0 && < 13.99999.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.0.0-beta2 | 502 | 12/28/2023 |
5.0.0-beta1 | 410 | 12/18/2023 |
4.0.3 | 666 | 8/18/2023 |
4.0.2 | 549 | 8/18/2023 |
4.0.1 | 609 | 8/18/2023 |
4.0.0 | 557 | 8/17/2023 |
3.0.1 | 816 | 1/11/2023 |
3.0.0 | 807 | 1/6/2023 |
2.0.0.1 | 1,011 | 6/28/2022 |
2.0.0 | 1,033 | 6/28/2022 |
2.0.0-beta2 | 620 | 6/28/2022 |
2.0.0-beta1 | 625 | 6/15/2022 |
1.0.0 | 1,189 | 10/1/2021 |
Support for Umbraco 13, (breaking change) now using async calls; please report issues at https://github.com/ahwm/Akismet.Umbraco/issues