{"id":18822825,"url":"https://github.com/a2nt/silverstripe-member-profiles","last_synced_at":"2025-04-14T01:21:30.759Z","repository":{"id":56938852,"uuid":"71901094","full_name":"a2nt/silverstripe-member-profiles","owner":"a2nt","description":"SilverStripe extendable profile areas. Provides registration page and extendable profile page area.","archived":false,"fork":false,"pushed_at":"2017-09-12T22:47:55.000Z","size":52,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T15:21:21.617Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a2nt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-25T13:43:45.000Z","updated_at":"2016-10-26T11:23:18.000Z","dependencies_parsed_at":"2022-08-21T06:50:26.147Z","dependency_job_id":null,"html_url":"https://github.com/a2nt/silverstripe-member-profiles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2nt%2Fsilverstripe-member-profiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2nt%2Fsilverstripe-member-profiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2nt%2Fsilverstripe-member-profiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2nt%2Fsilverstripe-member-profiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a2nt","download_url":"https://codeload.github.com/a2nt/silverstripe-member-profiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248805424,"owners_count":21164327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T00:51:44.897Z","updated_at":"2025-04-14T01:21:30.737Z","avatar_url":"https://github.com/a2nt.png","language":"PHP","funding_links":["https://www.paypal.me/tonytwma"],"categories":[],"sub_categories":[],"readme":"# SilverStripe Profile Area Module\n\n## Maintainer Contact\n * Anton Fedianin\n   \u003ctony (at) twma (dot) pro\u003e\n   \u003chttps://twma.pro\u003e\n\n## Requirements\n * SilverStripe 3.2\n\n\n## Overview\n\nA simplified light-weight alternative for frontend member profile areas.\n\n * Registration page\n * Profile page for updating details.\n * Extendable profile area\n\n### Registration Page\n\nCreate member Registration Page at the CMS or run /dev/build?flush after module instalation\n\n### Member Profile Page\n\nCreate member Profile Page at the CMS or run /dev/build?flush after module instalation\n\n### Profile Area\n\nBy default profile area has only profile information and profile editing form controller to add extra profile areas use this example:\n\n```php\nclass MyProfileArea extends MemberProfilePage_Controller {\n    /* ... your code\n     * private static $allowed_actions = [\n     *    'MyAction'\n     * ];\n     *\n     * public function MyAction() {}\n     *\n    */\n}\n```\n\nProfile information will use /profile URL, sub-controllers will use sub-URLs of this page for example:\n/profile/myprofilearea\n/profile/myprofilearea/action\n\n/profile/myprofileareaCRUD/MyItemClassName/new/\n/profile/myprofileareaCRUD/MyItemClassName/view/11\n/profile/myprofileareaCRUD/MyItemClassName/edit/11\n/profile/myprofileareaCRUD/MyItemClassName/delete/11\n/profile/myprofileareaCRUD/extraaction/*ID*/*OtherID*\n\n\nNew area will be automatically added to frontend member profile area navigation menu, but you can add hide ancestor to keep it hidden:\n```php\nclass MyProfileArea extends ProfileController {\n    private static $hide_ancestor = false; // it's optional if you want to hide this controller set to true\n    private static $menu_icon = '\u003ci class=\"fa fa-pencil-square-o\"\u003e\u003c/i\u003e'; // optional icon\n    private static $menu_title = 'My Profile Area'; // optional title otherwise My Profile Area title will be used\n}\n```\n\nRequirements config example:\n```yml\nProfileController:\n  requirements_css:\n    - site/css/ProfileController.css\n  requirements_javascript:\n    - site/css/ProfileController.js\n```\n\n### Profile CRUD\n\n```php\nclass MyProfileObjectsController extends ProfileCRUD {\n    /*\n     * This controller will let you create, view, edit and delete objects\n     */\n    private static $hide_ancestor = false; // it's optional if you want to hide this controller set to true\n    private static $menu_icon = '\u003ci class=\"fa fa-pencil-square-o\"\u003e\u003c/i\u003e'; // optional icon\n    private static $menu_title = 'My Profile Area'; // optional title otherwise My Profile Area title will be used\n\n    private static $managed_models = [\n        'MyObject',\n        'MyObject2',\n    ];\n\n    private static $allowed_actions = [\n        'ExtraAction'\n    ];\n\n    public function ExtraAction() {}\n}\n```\n\n* to make \"MyProfileArea\" template create templates/profile/controllers/MyProfileArea.ss\n* it will be used as sub-template of MemberProfilePage.ss by using $ProfileArea variable just like $Layout requires sub-template of Page.ss\n\n* to create a specific action template of \"MyProfileArea\" create templates/profile/controllers/MyProfileArea_MyAction.ss\n\nUse following code to customize MemberRegistrationForm:\n\n```yml\nMemberRegistrationForm:\n  extensions:\n    - MyMemberRegistrationFormExtension\n```\n\n```php\nclass MyMemberRegistrationFormExtension extends Extension\n{\n    public function updateMemberRegistrationForm()\n    {\n        /* your code, ex:\n         * $fields = $this-\u003eowner-\u003eFields();\n         * $fields-\u003epush(TextField::create('MyField'));\n         * BootstrapForm::apply_bootstrap_to_fieldlist($fields);\n         * BootstrapForm::apply_bootstrap_to_fieldlist($this-\u003eowner-\u003eActions());\n        */\n    }\n\n    public function onRegister($member)\n    {\n        /* your code to execute on register for an instance extra notifications */\n    }\n}\n```\n\nUse following code to customize MemberEditProfileForm:\n\n```yml\nMemberEditProfileForm:\n  extensions:\n    - MyMemberEditProfileFormExtension\n```\n\n```php\nclass MyMemberEditProfileFormExtension extends Extension\n{\n    public function updateMemberEditProfileForm()\n    {\n        /* your code, ex:\n         * $fields = $this-\u003eowner-\u003eFields();\n         * $fields-\u003epush(TextField::create('MyField'));\n         * BootstrapForm::apply_bootstrap_to_fieldlist($fields);\n         * BootstrapForm::apply_bootstrap_to_fieldlist($this-\u003eowner-\u003eActions());\n        */\n    }\n}\n```\n\nUse following code to extend Profile CRUD item forms:\n```yml\nProfileCRUD:\n  extensions:\n    - BootstrapItemEditForm\n```\n\n```php\nclass BootstrapItemEditForm extends Extension\n{\n    public function permissionDenied()\n    {\n        // your code, for example:\n        Page_Controller::setSiteMessage('You must log in to view your profile.', 'warning');\n    }\n\n    public function updateItemRemoved(DataObject $item)\n    {\n        // your code\n    }\n\n    public function updateItemRemoveDenied()\n    {\n        // your code\n    }\n    public function updateItemEditDenied()\n    {\n        // your code\n    }\n\n    public function updateItemEditSuccess(DataObject $item, array $data, $new = false)\n    {\n        if ($new) {\n            $success_msg = 'New Item Created';\n        } else {\n            $success_msg = 'Item was updated';\n        }\n\n        // your code\n    }\n\n    public function updateItemForm($form)\n    {\n        $fields = $form-\u003eFields();\n        // setup bootstrap classes\n        BootstrapForm::apply_bootstrap_to_fieldlist($fields);\n\n        $fields = $form-\u003eActions();\n        // setup bootstrap classes\n        BootstrapForm::apply_bootstrap_to_fieldlist($fields);\n    }\n}\n```\n\n[My personal website](https://tony.twma.pro)\n\n[Buy me a Beer](https://www.paypal.me/tonytwma)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa2nt%2Fsilverstripe-member-profiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa2nt%2Fsilverstripe-member-profiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa2nt%2Fsilverstripe-member-profiles/lists"}