aditya-wiguna/flarum-lock-profile 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aditya-wiguna/flarum-lock-profile

Composer 安装命令:

composer require aditya-wiguna/flarum-lock-profile

包简介

Prevents users from editing their profile information including name, username, email, and profile picture

README 文档

README

A Flarum extension that prevents users from editing their profile information, including username, email, bio, and profile picture.

Features

  • 🔒 Blocks Profile Editing: Prevents regular users from modifying their profile information
  • 👤 Locks Username: Users cannot change their username
  • 📧 Locks Email: Users cannot change their email address
  • 📝 Locks Bio: Users cannot edit their bio/about section
  • 🖼️ Locks Avatar: Users cannot upload or change their profile picture
  • 👑 Admin Exception: Administrators can still edit any user profile
  • 🎨 UI Modifications: Hides/disables edit buttons and form fields for regular users
  • 🛡️ Backend Protection: Server-side validation prevents API bypasses

Installation

Manual Installation

  1. Download this extension
  2. Extract it to your Flarum extensions directory: extensions/aditya-wiguna-flarum-lock-profile
  3. Install dependencies:
cd extensions/aditya-wiguna-flarum-lock-profile
composer install --no-dev
npm install
npm run build
  1. Enable the extension in your Flarum admin panel

Via Composer (if published)

composer require aditya-wiguna/flarum-lock-profile

Usage

Once installed and enabled:

  1. Go to your Flarum admin panel
  2. Navigate to Extensions
  3. Enable "Lock Profile"
  4. Regular users will no longer be able to edit their profile information
  5. Administrators retain full editing capabilities

How It Works

This extension works on two levels:

Frontend (JavaScript)

  • Disables input fields in the settings page
  • Hides edit buttons and avatar upload controls
  • Provides visual feedback that fields are locked

Backend (PHP)

  • Listens to user save events
  • Blocks any attempts to modify locked fields via API
  • Returns permission denied errors for unauthorized edits
  • Allows admin users to bypass restrictions

Customization

Modify Locked Fields

Edit src/Listener/PreventProfileEdit.php and modify the $lockedFields array:

$lockedFields = ['username', 'email', 'bio', 'avatarUrl'];

Change Vendor Name

Replace all instances of:

  • aditya-wiguna with your vendor name
  • AdityaWiguna with your capitalized vendor name
  • Update composer.json and package.json accordingly

Styling

Modify less/forum.less to customize the appearance of locked elements.

Development

Building Assets

# Development mode with watch
npm run dev

# Production build
npm run build

File Structure

flarum-lock-profile/
├── composer.json          # PHP dependencies and autoloading
├── extend.php            # Extension configuration
├── js/
│   └── src/
│       ├── admin/        # Admin panel JavaScript
│       └── forum/        # Forum frontend JavaScript
├── less/
│   └── forum.less        # Forum styles
├── locale/
│   └── en.yml           # English translations
├── src/
│   └── Listener/
│       └── PreventProfileEdit.php  # Backend event listener
├── LICENSE
├── README.md
├── package.json          # npm dependencies
└── webpack.config.js     # Build configuration

Compatibility

  • Flarum Version: ^1.2.0 or higher
  • PHP Version: ^7.3 or ^8.0

Security

This extension provides both frontend UI restrictions and backend API validation to ensure users cannot bypass the restrictions using browser developer tools or direct API calls.

Support

For issues, questions, or contributions, please visit:

  • GitHub Issues (add your repository URL)
  • Flarum Community Forum

License

MIT License - see LICENSE file for details

Credits

  • Extension created for Flarum community
  • Built with Flarum Extension API

Changelog

Version 1.0.0

  • Initial release
  • Lock username, email, bio, and avatar editing
  • Admin bypass functionality
  • Frontend and backend protection

TODO / Future Enhancements

  • Add admin panel settings to selectively enable/disable specific fields
  • Add permission-based locking (lock for specific groups)
  • Add option to lock fields only after certain conditions (e.g., after X days)
  • Add logging for edit attempts
  • Support for custom profile fields from other extensions

aditya-wiguna/flarum-lock-profile 适用场景与选型建议

aditya-wiguna/flarum-lock-profile 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「security」 「profile」 「lock」 「flarum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 aditya-wiguna/flarum-lock-profile 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aditya-wiguna/flarum-lock-profile 我们能提供哪些服务?
定制开发 / 二次开发

基于 aditya-wiguna/flarum-lock-profile 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-08