Improve plugin logic/clean up repository
-
Hi @stevejonesdev,
There are a few things that could (and should) be improved in this plugin:
- The main plugin file should be called
enable-contributor-uploads.phpinstead offunctions.php. See https://codex.ww.wp.xz.cn/Writing_a_Plugin#Plugin_Files for best practices. - Currently,
\WP_Role->add_cap();is executed on every request (using theadmin_inithook). From theadd_capcode reference:
NB: This setting is saved to the database, so it might be better to run this on theme/plugin activation
Simply use an activation hook.
- Implement uninstall routine. As I said,
\WP_Role->add_cap();persists changes to the database, so if the user deactivates or uninstalls the plugin, the capability should be removed. Use\WP_Role->remove_capin aregister_uninstall_hookcallback. Also see Uninstall Methods. - Remove
assets/folder from the plugin’s source code. There’s a dedicated root folder of the same name to store screenshots. From How Your Plugin Assets Work:
All files should be placed into the
assetsdirectory of your SVN directory and will work for all versions of your plugin. This is a top level directory, just liketrunk. You would not place the screenshots intotrunk/assetsortags/1.0/assets. - Remove the empty
rwc-contributor-uploadsfolder. - Somehow the
trunk/folder was copied totags/1.1. Remove it.
Please consider fixing/improving this. Thanks!
- The main plugin file should be called
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Improve plugin logic/clean up repository’ is closed to new replies.