Skip to content

Instantly share code, notes, and snippets.

<?php
// Bootstrap ProcessWire
require 'index.php';
// Make sure that FieldtypeRepeater is installed and ready for use
if (!wire('modules')->isInstalled('FieldtypeRepeater')) {
if (wire('modules')->isInstallable('FieldtypeRepeater')) {
wire('modules')->install('FieldtypeRepeater');
echo "Module FieldtypeRepeater installed\n";
<?php
/*
CODE COPIED FROM https://processwire.com/talk/topic/6142-hide-page-tree-in-the-admin/
One hook returns false for Page::viewable() for the ProcessPageList page.
Another Hook can be used to redirect users to a custom admin page after login.
*/
// This needs to be an autoload module
public function init() {
<?php
/*
Code by Ryan Cramer
Integrating a member visitor login form
https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919
*/
/*
I recently had to setup front-end system to handle logins, password resets and changing passwords, so here's about how it was done. This should be functional code, but consider it pseudocode as you may need to make minor adjustments here and there. Please let me know if anything that doesn't compile and I'll correct it here.
<?php
$out = '';
// create a new form field (also field wrapper)
$form = $modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name",'subscribe-form');
<?php
// front-end form example with multiple images upload
// add new page created on the fly and adding images
$message = '';
if($input->post->submit){
// tmp upload folder for additional security
<?php
/*
* as per http://processwire.com/talk/topic/2928-pagination-by-date/
* list posts by day, show prev next day if any posts found
*
* - posts have a date field "publish_from"
* with no time selection but only days
* this will save the timestamp of today 00:00 (starting) so we can simply
* use "publish_from=$prevday" in selectors
<?php
// include("./head.inc");
/**
* Script Example
*
* This script generates a prev next pagination to show posts per day of a specified date
* The category is set by the first url segment the date in the second
<?php
// ------------------------------ FORM Processing ---------------------------------------
$errors = null;
$success = false;
// helper function to format form errors
function showError($e){
return "<p class='error'>$e</p>";
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";
<?php
/**
* Example use:
*
* $helper = $modules->get("RandomImages");
* $image = $helper->getRandomImages(1,"images");
* echo "<img src='{$image->size(150,0)->url}'>";
*/