[buddypress-trac] [BuddyPress Trac] #5919: Xprofile field meta values not deleted with field
buddypress-trac
noreply at wordpress.org
Fri Oct 3 20:55:16 UTC 2014
#5919: Xprofile field meta values not deleted with field
----------------------------------------+-----------------------------
Reporter: tometzky | Owner:
Type: defect (bug) | Status: new
Priority: low | Milestone: Future Release
Component: XProfile | Version: 2.1
Severity: minor | Resolution:
Keywords: needs-patch good-first-bug |
----------------------------------------+-----------------------------
Comment (by tometzky):
Replying to [comment:3 boonebgorges]:
> Can you give more details about what breaks? Are you getting some sort
of error? Here is the relevant unit test:
https://buddypress.trac.wordpress.org/browser/tags/2.1/tests/phpunit/testcases/xprofile/functions.php#L243
When there's no meta values to delete, then this function returns a value
which is `==false`. It should return a `==true` value.
So the relevant unit test would be something like:
{{{
public function test_bp_xprofile_delete_meta_when_no_meta() {
$this->assertTrue( bp_xprofile_delete_meta( 0x7FFFFFFF, 'field' ) );
}
}}}
> These are highly targeted substring replacements that are covered by
extensive unit tests.
I'm sorry, but I don't understand how they're highly targeted. Both
Wordpress and Buddypress are very extensible programs - the both have many
hooks that allow plugins or themes to modify their behavior. And that's
why they're so popular. But this causes that there can be no "highly
targeted substring replacements", as relevant strings are moving targets.
Please consider the following example. A function
bp_xprofile_update_meta(), as I understand, should be used to add
additional meta values to xprofile fields. This is used by my plugin to
add two strings, controlled from dashboard, to any xprofile field.
But these string can very much contain for example a substring "WHERE ".
Like a message "PLEASE GO SOMEWHERE ELSE". Trying to save this string as a
meta value would generate SQL error:
''WordPress database error: [You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'field' AND ELSE' WHERE object_type = 'field' AND
`object_id` = '24' AND `meta_ke' at line 1]
UPDATE `wp_bp_xprofile_meta` SET `meta_value` = 'PLEASE GO SOMEWHERE
object_type = 'field' AND ELSE' WHERE object_type = 'field' AND
`object_id` = '24' AND `meta_key` = 'validate_with_regex_error_message' ''
And all this so Wordpress functions like `update_meta` could be used on
different table than `wp_postmeta` or `wp_usermeta`. When simply using
`$wpdb->insert()` and `$wpdb->update()` would be much, much simpler and
robust.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5919#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list