Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 12 months ago

#8578 closed enhancement (fixed)

"Send To" field text/recipient of new message thread cleared when user attempts to send message without a "Subject" or "Message" text

Reported by: niftythree's profile niftythree Owned by: imath's profile imath
Milestone: 12.0.0 Priority: normal
Severity: normal Version: 2.4.0
Component: Messages Keywords: has-patch
Cc:

Description

Hello,

We've noticed that if a user attempts to start a new message thread, but doesn't include a "Subject" or any content within the "Message" field, and attempts to send the message, then the "Send To" text/recipient will be cleared.

We're using BuddyPress version 9.1.1 and the Legacy template pack. We've tested this on a clean install, with no other plugins, and using a default WordPress theme.

Thanks.

Attachments (4)

BuddyPress No Subject message 1.png (22.8 KB) - added by niftythree 22 months ago.
BuddyPress No Subject message 2.png (15.0 KB) - added by niftythree 22 months ago.
8578.patch (3.3 KB) - added by amitgrhr 13 months ago.
patch for #8578
BuddyPress No Subject message Fixed.png (50.0 KB) - added by amitgrhr 13 months ago.
BuddyPress No Subject message Fixed.png

Download all attachments as: .zip

Change History (14)

#1 @imath
3 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 10.0.0
  • Type changed from defect (bug) to enhancement
  • Version changed from 9.1.1 to 2.4.0

Hi thanks for your feedback. The reason is if these two post variables are empty we stop the sending process and redirect the user to the same screen.

I agree it's a bit annoying to have to retype the conversation participants. So it could be improved :

  • using JavaScript to intercept the form submission and interrupt it if the corresponding field are missing if it's not a sitewide notice.
  • From the bp_messages_action_create_message() function adding query vars containing the usernames to the redirection URL.

Who wants to submit a patch! I'd be happy to review it and help you have it committed 😉

#2 @niftythree
3 years ago

Hi @imath

Thanks for your response and the information.
We've found it's mostly problematic if you have the "Friend Connections" Component of BuddyPress turned off, because then you can't type a username into the "Send To" field, and have to relocate the user's profile to start the message again.

Thanks. 🙂

#3 @imath
3 years ago

Hi @niftythree

FYI you can add the following constant to your wp-config.php file to perform the autocomplete Ajax action on all users (not only friends).

define( 'BP_MESSAGES_AUTOCOMPLETE_ALL', true );

#4 @imath
3 years ago

  • Milestone changed from 10.0.0 to Awaiting Contributions

We're running out of time to include this into 10.0.0, don't hesitate to submit a patch to bring some lights to this ticket. For now I'm moving it into "awaiting contributions"

#5 @niftythree
22 months ago

Hi,

Adding extra information to this ticket:

When the message "Your message was not sent. Please enter a subject line." is displayed after trying to submit a message without a subject line, it is shown again after going to another page in your account, such as the Notifications area for your account or your profile page. Presumably, this shouldn't be an issue once the suggested changes above have been applied (such as using JavaScript to intercept the form submission).

Thanks.

#6 @amitgrhr
13 months ago

I was able to replicate the above issue with the legacy template. I have attached the patch and screenshot after the fixes; please check them once.

@amitgrhr
13 months ago

patch for #8578

@amitgrhr
13 months ago

BuddyPress No Subject message Fixed.png

#7 @imath
13 months ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Contributions to 12.0.0

Hi @amitgrhr

Thanks for your patch, I'll look at it asap.

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


12 months ago

This ticket was mentioned in PR #167 on buddypress/buddypress by @imath.


12 months ago
#9

  • Use a redirect to be sure to clear notice errors when a required field is missing.
  • Preserve submitted texts and contacts in case of missing required fields.
  • Improve the feedback message so that it informs about all missing required fields.

Trac ticket: https://buddypress.trac.wordpress.org/ticket/8578

#10 @imath
12 months ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13584:

BP Legacy: improve private messages user feedback management

  • Use a redirect to be sure to clear template notices when a required field is missing at next page load.
  • Preserve submitted texts and contacts in case of missing required fields (using cookies, see messages_add_callback_values()).
  • Improve the template so that it directly informs about all missing required fields at once.

Props niftythree, amitgrhr

Fixes #8578
Closes https://github.com/buddypress/buddypress/pull/167

Note: See TracTickets for help on using tickets.