Skip to content
Ray Li edited this page Mar 7, 2019 · 8 revisions

Welcome to the brothers-training wiki!

Here are some non-obvious notes about the site:

Setup Super Admin

To create a super admin that can see across localities, set member's locality to Admin in the database.

Debugging authentication/sessions

Account lockdown

If you try too many times logging into your account with an incorrect password (i.e. during development), your account will be locked down. Clear your login_attempts table so you can login again.

Login redirects break on blank page

Login redirects will break when you put print or echo statements in authentication functions to debug or add extra spaces/text outside of any <?php ?> tags. Your error logs will complain header has already been sent before you can try to set it to another Location

Changing the year

The year variable is stored in navigation.php as $year, update to propagate throughout the site.

Update localities list in dropdowns

Edit includes/localities.txt in the format: value|name, for example:

Cambridge, MA|Cambridge, MA
Boston, MA|Boston, MA

Adding users to .htaccess to register admin members

If portal/admin/register.php breaks in production, it's usually b/c the .htaccess file isn't setup correctly. Check to make sure the path is correct:

AuthUserFile #absolute_path_to_.htpasswd#
AuthName Register
AuthType Basic
<Files "register.php">
  require valid-user
</Files>

To generate new users to add to the .htpasswd file, do this (on Macbook):

htpasswd -nb username password

You'll get a string like this to put into the .htpasswd file.

admin:$apr1$dE6EM7ob$w9RWqDEkPpYM9ydVzqY/O1

Everything should work and that page will be password-protected.

Brand New Church Setup

You'll need to update the following files to alter database config, year, dates, localities supported

psl-config.php
global-config.php
localities.txt
header.html
navigation.php

Backup db + schema

Run the following php file in the project

php -f backup_db.php

How to show errors when debugging

To see any errors in page (much easier than tailing the logs), follow these instructions:

Go to Applications/Mamp/bin/php/phpVERSION/conf/php.ini Set

error_reporting=E_ALL
display_errors=On

How to see warning (non-fatal) errors

To see warnings, you'll need to comment out the line error_reporting(E_ERROR | E_PARSE); in psl-config.php.

How to create a new branch off of existing one

Fork with:

git co -B <new_branch_name>
git push origin <new_branch_name>

Now, you can check out the new branch anywhere with git fetch --all + git co <new_branch_name>