Browse files

Better comments, and readme

  • Loading branch information...
Pikkulahti committed Nov 2, 2017
1 parent 9f7392e commit cd5b421be4ef7dc97e2adbc1e3aef01e87f28f94
Showing with 80 additions and 1 deletion.
  1. +7 −0
  2. +61 −0 docs/customize-wp/
  3. +12 −1 models/user-activate.php
@@ -738,3 +738,10 @@ Get the Comments helper from [Geniem Github](
composer require devgeniem/dustpress-comments
# Overriding default templates
DustPress offers a way to override WordPress default templates that could not otherwise be edited.
At the moment it's possible to modify:
- wp-activate.php ([docs](
@@ -0,0 +1,61 @@
### Custom wp-activate.php
Upon user creation an email is sent to the user's email address containing an activation link. Opening this link leads to /wp-activate.php page where user can activate their account.
The view is printed out from wp-activate.php and cant' be modified easily. But in DustPress we do this for you. In the core we stop the wp-activate.php execution and run our own model and view instead.
These can be found in `models/user-activate.php` and `partials/user-activate.dust`. They mimic the original file but you can easily override the partial or even the model in your theme.
Be careful when editing the user-activate.php that nothing breaks!
### Files
### Model
The default user activate model has two functions `Print` and `State`.
#### State
State method runs through the same code found in wp-activate. It collects all strings that need to be outputted and passes them to the Print function. Also it sets an arbitrary state based on the code. This state is returned to the view.
State comes in handy when modifying the view. For example we check for `no-key` state to define if the didn't contain an activation key and show a form to fill that if that is the case.
{@eq key=State value="no-key" }`
... form code ..
#### States
- **no-key**
- No activation key is set. Normally outputs form for user to give the key.
- **site-active-mail**
- Site has been activated and mail sent to user.
- **account-active-mail**
- Account has been activated and mail sent to user.
- **account-active-no-mail**
- Account has been activated but no mail is sent. Normally outputs username and password.
- **error**
- Error occurred during activation. Sets error message to print['error'].
#### Print
Print returns to the view all the translated strings that wp-activate.php would output. They can be used in the partial with `{Print.string_name}`.
#### Strings
- **title**
- Site header
- **wp-activate-link**
- Activation link
- **message**
- Translated message
- **error**
- Possible error
- **username**
- User's loginname
- **password**
- Translated string of "Your chosen password"
### Multisite
This is also tested in multisite. Actually the idea to create this arose from problems with wp-activate.php on multisite.
@@ -80,8 +80,19 @@ public function State() {
return $state;
* Returns strings for printing.
* Available strings:
* title - Site header
* wp-activate-link - Activation link
* message - Translated message.
* error - Possible error
* username - User's loginname
* password - Translated string of "Your chosen password".
* @return $this->print (string) Messages for the view.
public function Print() {

0 comments on commit cd5b421

Please sign in to comment.