Opened 16 years ago
Closed 10 years ago
#14581 closed defect (bug) (wontfix)
No magic numbers
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Database | Keywords: | has-patch dev-feedback close |
| Focuses: | Cc: |
Description
Add defines for the numeric user_status and comment_status values.
Attachments (1)
Change History (14)
#3
@
15 years ago
- Keywords needs-patch added
If someone wants to get this in for 3.1, please post a patch now, as freeze is right around the corner.
#6
@
12 years ago
- Keywords has-patch dev-feedback added; needs-patch removed
- Milestone changed from Future Release to 4.0
There are magic numbers EVERYWHERE - but mainly, comments and multisite. 14581.diff replace thems throughout core with constants: WP_STATUS_ON and WP_STATUS_OFF. Also, it prepares a bunch of SQL queries instead of hard-coding '0' and '1' in them
#7
@
12 years ago
As discussed elsewhere with @wonderboymusic, I could definitely see simplifying with something like this, though we'll need to be careful with the verbiage of whatever term we use for "on" and "off".
Perhaps something more like *_ENABLED|DISABLED", or *_TRUE|FALSE`.
#10
@
12 years ago
Note you left single quotes on comment_date_gmt < '%s'" in wp-includes/comment.php line 1093 (scroll to the right to see it):
$sql = $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = %s AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, WP_STATUS_ON, $comment->comment_date_gmt );
Also, . $comtypewhere (scroll right further) is confusing within a format string, but I guess that's out of scope of this bug.
Looks like Ryan forgot to attach a patch here.