[wp-meta] [Making WordPress.org] #859: Warn WordCamp organizers when their site is in Coming Soon mode
Making WordPress.org
noreply at wordpress.org
Mon Mar 21 18:29:24 UTC 2016
#859: Warn WordCamp organizers when their site is in Coming Soon mode
----------------------------------------+-----------------------
Reporter: iandunn | Owner: iandunn
Type: enhancement | Status: accepted
Priority: normal | Milestone:
Component: wordcamp.org | Resolution:
Keywords: good-first-bug needs-patch |
----------------------------------------+-----------------------
Changes (by iandunn):
* keywords: good-first-bug => good-first-bug needs-patch
Comment:
Thanks @JayantiC, this is a good good first pass attempt.
While there are always multiple ways to solve a problem, often WordPress
has a specific way of doing things, and there are a few changes that need
to be made to conform to that. I also have a couple general
recommendations to improve the code, and some minor nitpicky things just
to make it perfect.
== Major changes ==
* Functions should only do 1 thing, so `display_coming_soon_notice()`
should be modularized.
* Rather than using JavaScript to print messages in the DOM at runtime,
there is a WP action you can use to hook into the rendering process of the
Publish metabox.
* Rather than using JavaScript to disable the Publish button, use
WordPress' capabilities system to remove the `publish_posts` capability.
See `current_user_can()`.
* Use `get_current_screen()` instead of the `$pagenow` global. Accessing
globals directly should be avoided whenever possible. the API functions
are the best way to get/set data because they're forwards-compatible and
will avoid creating an unintended side-effects
* You'll need to check that only the `post` post type is affected.
Otherwise custom custom post types like Speakers would also be prevented
from publishing.
== Minor changes ==
* There's no need to pass `$this` by reference when registering the action
callback
* `add_node()` should be used instead of `add_menu()`, since `add_menu()`
is an alias for `add_node()`.
* Use the reference to `$wp_admin_bar` that gets passed by the
`admin_bar_menu` action handler, rather than accessing the global directly
* Check out WordPress' coding standards for PHP; there are several things
related to indentation, spacing, and Yoda conditionals that need to be
tweaked.
* When localizing strings, only the text itself should be translated, not
the surrounding CSS, etc.
* The plugin uses the `wordcamporg` text domain, rather than `coming-soon`
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/859#comment:8>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list