Skip to content

Instantly share code, notes, and snippets.

View Rockerby's full-sized avatar
☺️

Richard Ockerby Rockerby

☺️
View GitHub Profile
@Rockerby
Rockerby / ConditionalRedirectWorkflow.cs
Last active May 23, 2025 11:02
A sample workflow for Umbraco forms that allows the editor to select a custom redirect URL. Great to combine with workflow conditions to give dynamic redirects based on form fields. Created for Umbraco v13, not tested in later versions.
using Umbraco.Forms.Core;
using Umbraco.Forms.Core.Enums;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http;
using Umbraco.Forms.Core.Attributes;
using Umbraco.Cms.Core;
using Umbraco.Extensions;
using Microsoft.Extensions.DependencyInjection;
namespace Example.Forms.Workflows
@Rockerby
Rockerby / custom.element.ts
Last active October 15, 2025 07:28
A small example of how to create a custom element to be placed within the Workspace Action part for Umbraco 15+. This takes the existing element that is placed there and adds an icon in the button.
/*
* This file is a copy of the core version from https://github.com/umbraco/Umbraco-CMS/blob/6bca91a52fabfe96b7ede1837b908b33d78136ed/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-action/default/workspace-action-default-kind.element.ts
* with the addition of a document icon in the button!
*/
import type {
ManifestWorkspaceAction,
ManifestWorkspaceActionMenuItem,
MetaWorkspaceActionDefaultKind,
UmbWorkspaceActionDefaultKind,
@Rockerby
Rockerby / PublishDescendantsController.cs
Created April 10, 2025 12:18
An Umbraco (13.8+) Controller that re-publishes content and it's descendants. Useful for if you've made database changes and need the site to puiblish them without going into each.
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.Controllers;
namespace Website.Code
{
public class PublishDescendantsController : UmbracoApiController
{
private readonly IContentService _contentService;
@Rockerby
Rockerby / BespokeMemberService.cs
Last active February 6, 2025 23:55
This is a fix for an error that occurs in Umbraco v8.X when using SQL 2019+ in some instances. It fixes the error "versionDate is not a column name" in the back office. Check out https://our.umbraco.com/forum/using-umbraco-and-getting-started/102016-column-ordering-in-members-listview-error
/*
This file is just a copy of the core MemberService but we can't just overwrite the function we need
so we need to use it as a wrapper to the actual MemberService; the baseService defined below.
*/
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Text.RegularExpressions;
@Rockerby
Rockerby / EnforceTwoFactorAuthentication.js
Last active October 16, 2025 08:58 — forked from markadrake/EnforceTwoFactorAuthentication.js
Force Users to Enable Two-Factor Authentication in Umbraco 13
(() => {
angular.module("umbraco").run(["authResource", "twoFactorLoginResource", "editorService", "notificationsService", "eventsService", "overlayService", async (authResource, twoFactorLoginResource, editorService, notificationsService, eventsService, overlayService) => {
const state = {};
const init = async (firstInit) => {
"app.ready"
state.currentUser = await authResource.getCurrentUser();
state.twoFactorAuthProviders = await twoFactorLoginResource.get2FAProvidersForUser(state.currentUser.id);
@Rockerby
Rockerby / .gitignore
Created October 16, 2024 09:31
.NET Gitignore
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
@Rockerby
Rockerby / DateTimePickerUTC.css
Created March 16, 2023 17:30
A date/time picker for Umbraco that normalises UTC client-side
.offset_container * {
display: block;
}
.offset_container input {
max-width: 200px;
}