#4824 closed defect (bug) (fixed)
Autocomplete
Reported by: | stefwilliams | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.5.0 |
Component: | Messages | Keywords: | has-patch 2nd-opinion commit |
Cc: |
Description
In Private Message > Compose screen.
'Send to' field does not get autofilled with:
Uncaught Error: cannot call methods on autocomplete prior to initialization; attempted to call method '[url]/wp-admin/admin-ajax.php'
Also means mail cannot be sent at all, even using username or @name.
Have tried it with twentytwelve and still get the issue...
(Using build 6784)
Cheers
Attachments (1)
Change History (20)
#2
@
12 years ago
Ah,
Yes, that does seem to be the issue - deactivated EM and it works...
The thread above seems unsure whether it's a BP bug or EM...
Any ideas yourself?
PS - sorry, I did do a 'quick search on Google' myself :)
#3
@
12 years ago
- Keywords reporter-feedback removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Judging from that forum thread, it looks like EM introduced the bug in a new version of their plugin so I assume it's a problem on their part. But if it ends up being a BP problem, tell their devs to post a ticket here.
Closing as invalid for now.
#4
@
12 years ago
If buddypress would enqueue the autcomplete scripts in the footer it would fix most issues.
e.g.
wp_enqueue_script( 'bp-jquery-autocomplete', BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.autocomplete{$min}.js", array( 'jquery' ), bp_get_version(), true ); wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.autocompletefb{$min}.js", array(), bp_get_version(), true ); wp_enqueue_script( 'bp-jquery-bgiframe', BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.bgiframe{$min}.js", array(), bp_get_version(), true ); wp_enqueue_script( 'bp-jquery-dimensions', BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.dimensions{$min}.js", array(), bp_get_version(), true );
#5
@
9 years ago
- Severity changed from major to normal
- Version 1.7 deleted
well, I am getting same error if I do use wp_editor
in Private Message > Compose screen.
PS: Event Manager plugin is not active/install on site.
#7
@
9 years ago
this is not ideal but there is work-around at the moment.
<?php /** * Lets preclude the wp_editor from enqueue 'jquery-ui-autocomplete' script. * * Provisional fix for the wordpress core autocomplete * conflict wit buddypress autocomplete * * @todo Remove the 'tiny_mce_plugins' and 'quicktags_settings' filters once get fixed in the buddypress core */ add_filter( 'tiny_mce_plugins', function ( $plugins ) { if ( ( $key = array_search( 'wplink', $plugins ) ) !== false ) { // Remove 'wplink' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors. // It can be added with 'mce_external_plugins'. unset( $plugins[$key] ); } return $plugins; }); add_filter( 'quicktags_settings', function ( $qtInit, $editor_id ) { // Remove 'link' from the quicktag button to prevent errors. if ( ( $key = array_search( 'link', $qtInit['buttons'] ) ) !== false ) { $qtInit['buttons'] = str_replace( 'link,', '', $qtInit['buttons'] ); } return $qtInit; });
`
#9
@
9 years ago
Thank you @pareshradadiya. I applied this provisional fix and it worked for me. I just noticed today that autocomplete on message compose had stopped working.
#10
@
9 years ago
It's throwing warnings, though, on the first and third lines of the code in the snippet below:
add_filter( 'quicktags_settings', function ( $qtInit, $editor_id ) { // Remove 'link' from the quicktag button to prevent errors. if ( ( $key = array_search( 'link', $qtInit['buttons'] ) ) !== false ) {
Warning: Missing argument 2 for {closure}() in /path/functions.php on line 678
Warning: array_search() expects parameter 2 to be array, string given in /path/functions.php on line 680
#11
@
9 years ago
- Keywords has-patch 2nd-opinion added
- Milestone set to 2.6
@pareshradadiya @mlwilkerson Thanks for reviving this issue. The root problem is that we are loading our own library that registers itself as jQuery.fn.autocomplete
, and it's different from the jQuery UI library loaded by wp_editor()
. The only way I can think of to fix this problem is to change the name of our library. In 4824.diff, I've made it jQuery.fn.autocompletebp
. It's ugly, but it resolves the conflict.
The only potential for breakage here is if someone was intentionally trying to do something custom using our autocomplete scripts on their page. I have a feeling this is very unlikely, and I would much rather fix the problem with wp_editor()
than try to maintain this weird bit of backward compatibility. Does anyone disagree?
This would go away if we used something less insane for our autocomplete. See #4580.
#12
@
9 years ago
Thanks for your attention to this @boonebgorges.
As for your suggested workaround, I don't know enough about would it would mean to "fix the problem with wp_editor()"—as in, what that fix would be, and maybe more importantly, what the side effects would be. So your autocompletebp solution, while it may seem ugly, does seem to resolve the conflict with less likelihood of creating new ones. However, again, I don't know enough about the internals to know what impact that fix would have either.
Either way, thank you.
#13
@
9 years ago
You didn't attach the patch, but looking at the code, it's pretty clear that jquery.autocomplete.js is a third-party script, albeit an old one dating back to BuddyPress 1.0. If we went this way, we'd have to change messages_autocomplete_init_jsblock
as that's the one place in core where we call this script. The root problem is a badly? named jQuery module, but I don't know if this script predates jQuery UI's or vice-versa (they must both date from around the same time).
I am generally against modifying third party scripts for this kind of reason, even scripts we're working towards deprecating (see: the at-mentions JS).
This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.
9 years ago
#16
@
9 years ago
- Milestone changed from Future Release to 2.6
Sorry, I initially forgot the attachment. 4824.diff
I am generally against modifying third party scripts for this kind of reason, even scripts we're working towards deprecating (see: the at-mentions JS).
It's not great, but it's also a pretty huge pain that we are incompatible with wp_editor()
. Less of two evils. I don't think there are serious BC concerns here, and I am more sympathetic to making things that work-but-are-ugly than things that are beautiful-but-don't-work.
#17
@
9 years ago
- Keywords commit added
I agree with boonebgorges. Just tested the patch and it's fixing the issue.
@DJPaul i understand your point
I am generally against modifying third party scripts
Problem is we already modified the two scripts!
For instance i doubt that at line 362 of jquery.autocomplete.js that
jQuery('#send-to-input').removeClass('loading');
was there in original version of the script.
And in jquery.autocompletefb.js i'm sure that this part is not into the original script
foundClass : ".friend-tab", inputClass : ".send-to-input"
So i'm in favor of committing 4824.diff.
Are you using any other plugins?
A quick search on Google came up with a conflict with the Events Manager plugin:
https://wordpress.org/support/topic/auto-complete-not-working-in-messages
Are you using that?