Skip to content

Instantly share code, notes, and snippets.

View opt-chrisgreen's full-sized avatar

opt-chrisgreen

View GitHub Profile
@opt-chrisgreen
opt-chrisgreen / muraImportUsersViaCSV.cfm
Created April 9, 2020 21:31 — forked from stevewithington/muraImportUsersViaCSV.cfm
Example of how to import Users into Mura CMS via .CSV file. Also see https://gist.github.com/stevewithington/4742829 to import content from an RSS Feed.
<cfscript>
param name='form.csvUrl' default='#getPageContext().getRequest().getScheme()#://#cgi.server_name##getDirectoryFromPath(getPageContext().getRequest().getRequestURI())#users.csv';
param name='form.group' default='Temp';
param name='form.isSubmitted' default='false';
param name='form.isTest' default='true';
param name='form.siteid' default='default';
$ = application.serviceFactory.getBean('$').init(form.siteid);
if ( !$.currentUser().isSuperUser() && !$.currentUser().isInGroup('admin') ) {
@opt-chrisgreen
opt-chrisgreen / muraRequiredSummary.cfm
Created April 9, 2020 21:29 — forked from stevewithington/muraRequiredSummary.cfm
Mura CMS : This is an example of how to make the Summary field a required field. You could use this example to make pretty much any other field, including extended attributes, required as well.
<cfscript>
// Drop this in your Site or Theme eventHandler.cfc
public any function onBeforeContentSave($) {
// reference to the newBean
var newBean = arguments.$.event('newBean');
// reference to the original contentBean
var oldBean = arguments.$.event('contentBean');
// example on how to create some errors
var error = '';
@opt-chrisgreen
opt-chrisgreen / dsp_sharedLogin.cfm
Created April 9, 2020 21:28 — forked from stevewithington/dsp_sharedLogin.cfm
Mura CMS: How to lock down a page/section with a single, shared password. 1) Create a User Group called "Shared User Group" 2) Create a User called "Shared User" and assign that user to the "Shared User Group" ... you could use something like "shareduser" for the username ... just be sure to note the password! 3) Lock down the content node you w…
<!--- drop this file under the theme's display_objects directory --->
<cfoutput>
<form id="login" class="form-horizontal" name="frmLogin" method="post" action="?nocache=1" onsubmit="return validate(this);" novalidate="novalidate" >
<legend>#arguments.$.rbKey('user.pleaselogin')#</legend>
<div class="control-group">
<label class="control-label required" for="txtPassword">#arguments.$.rbKey('user.password')#</label>
<div class="controls">
<input type="password" id="txtPassword" name="password" placeholder="#arguments.$.rbKey('user.password')#" required="true" message="#htmlEditFormat(arguments.$.rbKey('user.passwordrequired'))#" />
<span class="help-inline">#htmlEditFormat($.rbKey('user.required'))#</span>
</div>
@opt-chrisgreen
opt-chrisgreen / muraUserBeans.cfm
Created April 9, 2020 21:26 — forked from stevewithington/muraUserBeans.cfm
Mura CMS: These are examples of how to register an event handler/listener for when a user is being saved or updated, and then access the old user bean along with the new user bean.
<cfscript>
// Place these methods in your Site, Theme, or Plugin's eventHandler.cfc
public any function onBeforeUserSave($) {
var newUserBean = arguments.$.event('userBean');
var oldUserBean = arguments.$.getBean('user').loadBy(userid=arguments.$.event('userid'));
// if you want to stuff the oldUserBean in the event
// $.event('oldUserBean', oldUserBean);
@opt-chrisgreen
opt-chrisgreen / muraCreatePageAndUser.cfm
Created April 9, 2020 21:24 — forked from stevewithington/muraCreatePageAndUser.cfm
Mura CMS : Example of how to create a content item when updating a User
<cfscript>
public any function onAfterUserSave($) {
// reference to new user bean
var user = arguments.$.event('userBean');
// reference to old user bean
//var oldUserBean = arguments.$.getBean('user').loadBy(userid=user.getUserID());
// reference to content item that will be the parent of the 'User' page
var parentbean = $.getBean('content').loadBy(title='Reps');