Skip to content

Commit

Permalink
Making websites with October CMS - Part 23 - Extending User Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Doric committed Nov 21, 2016
1 parent b98a765 commit 669474f
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 45 deletions.
97 changes: 52 additions & 45 deletions octobermovies.sublime-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -520,28 +520,28 @@
"buffers":
[
{
"file": "plugins/watchlearn/contact/components/ContactForm.php",
"file": "plugins/watchlearn/profile/updates/version.yaml",
"settings":
{
"buffer_size": 1304,
"buffer_size": 56,
"encoding": "UTF-8",
"line_ending": "Unix"
}
},
{
"file": "plugins/watchlearn/contact/components/contactform/default.htm",
"file": "plugins/watchlearn/profile/updates/add_new_fields.php",
"settings":
{
"buffer_size": 499,
"buffer_size": 471,
"encoding": "UTF-8",
"line_ending": "Unix"
}
},
{
"file": "plugins/watchlearn/contact/components/contactform/messages.htm",
"file": "plugins/watchlearn/profile/Plugin.php",
"settings":
{
"buffer_size": 374,
"buffer_size": 782,
"encoding": "UTF-8",
"line_ending": "Unix"
}
Expand All @@ -554,10 +554,14 @@
"build_varint": "",
"command_palette":
{
"height": 354.0,
"last_filter": "",
"height": 220.0,
"last_filter": "sysphp",
"selected_items":
[
[
"sysphp",
"Set Syntax: PHP"
],
[
"proje",
"Project: Save As"
Expand Down Expand Up @@ -791,7 +795,7 @@
"Package Control: Install Package"
]
],
"width": 944.0
"width": 467.0
},
"console":
{
Expand All @@ -814,18 +818,25 @@
[
"/Users/ivan/Development/public/octobermovies",
"/Users/ivan/Development/public/octobermovies/plugins",
"/Users/ivan/Development/public/octobermovies/plugins/rainlab",
"/Users/ivan/Development/public/octobermovies/plugins/rainlab/user",
"/Users/ivan/Development/public/octobermovies/plugins/rainlab/user/models",
"/Users/ivan/Development/public/octobermovies/plugins/rainlab/user/models/user",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components/contactform",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/profile",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/profile/updates",
"/Users/ivan/Development/public/octobermovies/themes",
"/Users/ivan/Development/public/octobermovies/themes/olympos",
"/Users/ivan/Development/public/octobermovies/themes/olympos/layouts",
"/Users/ivan/Development/public/octobermovies/themes/olympos/pages",
"/Users/ivan/Development/public/octobermovies/themes/olympos/partials"
],
"file_history":
[
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/profile/Plugin.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components/ContactForm.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components/contactform/default.htm",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components/contactform/messages.htm",
"/Users/ivan/Development/public/octobermovies/themes/olympos/layouts/default.htm",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/Plugin.php",
"/Users/ivan/Development/public/octobermovies/themes/olympos/pages/add-actors.htm",
Expand All @@ -834,8 +845,6 @@
"/Users/ivan/Development/public/octobermovies/themes/olympos/pages/movies.htm",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/components/ActorForm.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/components/actorform/default.htm",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components/contactform/default.htm",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/components/ContactForm.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/Plugin.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/views/mail/message.htm",
"/Users/ivan/Development/public/octobermovies/config/mail.php",
Expand Down Expand Up @@ -951,9 +960,7 @@
"/Users/ivan/Library/Caches/com.binarynights.ForkLift2/#0/_edit-article.tpl",
"/Users/ivan/Development/public/springfall/resources/assets/sass/modules/_messages.scss",
"/Users/ivan/Development/public/springfall/public/js/app.js",
"/Users/ivan/Development/public/springfall/config/recaptcha.php",
"/Users/ivan/Development/public/springfall/config/app.php",
"/Users/ivan/Development/public/springfall/resources/assets/sass/vendor/_rating.scss"
"/Users/ivan/Development/public/springfall/config/recaptcha.php"
],
"find":
{
Expand Down Expand Up @@ -1165,93 +1172,93 @@
[
{
"buffer": 0,
"file": "plugins/watchlearn/contact/components/ContactForm.php",
"file": "plugins/watchlearn/profile/updates/version.yaml",
"semi_transient": false,
"settings":
{
"buffer_size": 1304,
"buffer_size": 56,
"regions":
{
},
"selection":
[
[
885,
885
56,
56
]
],
"settings":
{
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/PHP/PHP.sublime-syntax"
"syntax": "Packages/YAML/YAML.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 1145.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 2,
"type": "text"
},
{
"buffer": 1,
"file": "plugins/watchlearn/contact/components/contactform/default.htm",
"file": "plugins/watchlearn/profile/updates/add_new_fields.php",
"semi_transient": false,
"settings":
{
"buffer_size": 499,
"buffer_size": 471,
"regions":
{
},
"selection":
[
[
193,
205
340,
340
]
],
"settings":
{
"_anf_new": "",
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
"syntax": "Packages/PHP/PHP.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"translation.y": 292.0,
"zoom_level": 1.0
},
"stack_index": 1,
"type": "text"
},
{
"buffer": 2,
"file": "plugins/watchlearn/contact/components/contactform/messages.htm",
"file": "plugins/watchlearn/profile/Plugin.php",
"semi_transient": false,
"settings":
{
"buffer_size": 374,
"buffer_size": 782,
"regions":
{
},
"selection":
[
[
218,
218
397,
397
]
],
"settings":
{
"_anf_new": "",
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
"syntax": "Packages/PHP/PHP.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"translation.y": 628.0,
"zoom_level": 1.0
},
"stack_index": 0,
Expand Down Expand Up @@ -1830,9 +1837,17 @@
"select_project":
{
"height": 500.0,
"last_filter": "wat",
"last_filter": "watc",
"selected_items":
[
[
"watc",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"",
"~/Development/public/gaussocto/gaussocto.sublime-project"
],
[
"wat",
"~/Development/public/watchlearn/watchlearn.sublime-project"
Expand All @@ -1845,10 +1860,6 @@
"oc",
"~/Development/public/octobermovies/octobermovies.sublime-project"
],
[
"",
"~/Development/public/gaussocto/gaussocto.sublime-project"
],
[
"octo",
"~/Development/public/gaussocto/gaussocto.sublime-project"
Expand All @@ -1865,10 +1876,6 @@
"watch",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"watc",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"g",
"~/Development/public/gaussdev/gaussdev.sublime-project"
Expand Down
34 changes: 34 additions & 0 deletions plugins/watchlearn/profile/Plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php namespace Watchlearn\Profile;

use System\Classes\PluginBase;
use Rainlab\User\Controllers\Users as UsersController;

class Plugin extends PluginBase
{
public function registerComponents()
{
}

public function registerSettings()
{
}

public function boot(){

UsersController::extendFormFields(function($form, $model, $context){
$form->addTabFields([
'facebook' => [
'label' => 'Facebook',
'type' => 'text',
'tab' => 'Profile'
],
'bio' => [
'label' => 'Biography',
'type' => 'textarea',
'tab' => 'Profile'
]
]);
});

}
}
6 changes: 6 additions & 0 deletions plugins/watchlearn/profile/lang/en/lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php return [
'plugin' => [
'name' => 'Profile',
'description' => ''
]
];
6 changes: 6 additions & 0 deletions plugins/watchlearn/profile/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
plugin:
name: 'watchlearn.profile::lang.plugin.name'
description: 'watchlearn.profile::lang.plugin.description'
author: watchlearn
icon: oc-icon-adjust
homepage: ''
27 changes: 27 additions & 0 deletions plugins/watchlearn/profile/updates/add_new_fields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php namespace Watchlearn\Profile\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class AddNewFields extends Migration
{

public function up()
{
Schema::table('users', function($table)
{
$table->string('facebook')->nullable();
$table->text('bio')->nullable();
});
}

public function down()
{
$table->dropDown([
'facebook',
'bio'
]);

}

}
3 changes: 3 additions & 0 deletions plugins/watchlearn/profile/updates/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1.0.1:
- Initialize plugin.
- add_new_fields.php

0 comments on commit 669474f

Please sign in to comment.