Ad

Is There A Way To Extend User Plgin In OctoberCMS In Production

- 1 answer

I'm asking if there's any way to extend user plugin in OctoberCMS by adding more fields when the site is already in production. I know how to do this in development but I don't know how to do it i production. Help

Ad

Answer

just create new plugin in development which is going to extend your user plugin.

fields you are going to add just write them in to update files -> plugins\hardiksatasiya\demotest\updates

1.0.1:
    - 'Initialize plugin.'
1.0.2:
    - 'Created table hardiksatasiya_demotest_'
    - update_user_my_custom_add_seen.php

update_user_my_custom_add_seen.php file

<?php namespace HardikSatasiya\DemoTest\Updates;

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

class UpdateUserMyCustomAddSeen extends Migration
{
    public function up()
    {
        Schema::table('users', function($table)
        {
            $table->timestamp('last_seen')->nullable();
        });
    }

    public function down()
    {
        Schema::table('users', function($table)
        {
            $table->dropColumn('last_seen');
        });
    }
}

this example shows how to add last_seen field in users table

now just use extend api to add field in form extendFormFieldshttps://octobercms.com/docs/backend/forms#extend-form-fields

now test them on development server if all is working fine.

then only put that plugin in plugins directory

directory structure => plugins \ < author name > \ < plugin name >

now in live system - from backend logout and login

i guess this will do all required stuff.

make sure you test plugin well in development. to avoid unwanted problems

if any doubts please comment.

Ad
source: stackoverflow.com
Ad