Hi,
I am using web socket version of your plugin. I find out that I can create many threads with the same user. Is it possible to limit to have only one thread with specific user just like on messenger?
Cheers,
Alfred
AAlfred · · 14 replies · 0 views · 3 readers
Hi,
I am using web socket version of your plugin. I find out that I can create many threads with the same user. Is it possible to limit to have only one thread with specific user just like on messenger?
Cheers,
Alfred
0
Goal reached: it still takes signatures until it closes.
New since you last read
The solution
Goal reached: it still takes signatures until it closes.
The solution
Hi there!
Yes it’s possible by adding some filters and hooks.
Or just wait and I will add this option in next version 🙂
Thanks!
0
Goal reached: it still takes signatures until it closes.
The solution
Andrij,
Thank you for such a quick answer. Can you provide me with those filters and hooks?
It is quite urgent 😉
Cheers,
Alfred
0
Goal reached: it still takes signatures until it closes.
The solution
I haven’t the code ready at the moment. I will send when I have!
0
Goal reached: it still takes signatures until it closes.
The solution
That's great. I really appreciate it! When would it be ready?
0
Goal reached: it still takes signatures until it closes.
The solution
add_action( 'bp_better_messages_before_new_thread', 'disable_start_thread_if_thread_exist', 10, 2 );
function disable_start_thread_if_thread_exist(&$args, &$errors){
global $wpdb;
$recipients = $args['recipients'];
$threadExists = array();
foreach($recipients as $recipient){
$user = get_user_by('login', $recipient);
$from = get_current_user_id();
$to = $user->ID;
$query = $wpdb->prepare("SELECT
{$wpdb->base_prefix}bp_messages_recipients.thread_id
FROM {$wpdb->base_prefix}bp_messages_recipients
INNER JOIN {$wpdb->base_prefix}bp_messages_recipients {$wpdb->base_prefix}bp_messages_recipients_1
ON {$wpdb->base_prefix}bp_messages_recipients.thread_id = {$wpdb->base_prefix}bp_messages_recipients_1.thread_id
WHERE {$wpdb->base_prefix}bp_messages_recipients.user_id = %d
AND {$wpdb->base_prefix}bp_messages_recipients.is_deleted = 0
AND {$wpdb->base_prefix}bp_messages_recipients_1.user_id = %d", $from, $to);
$threads = $wpdb->get_col($query);
if( count($threads) > 0) {
$threadExists[] = $recipient;
}
}
if(count($threadExists) > 0){
$message = sprintf(__('You already have threads with %s', 'bp-better-messages'), implode(', ', $threadExists));
$errors[] = $message;
}
}
0
Goal reached: it still takes signatures until it closes.
The solution
Andrij,
That worked perfectly. Thanks!
Is it possible to open this particular existing thread automatically?
Cheers,
Alfred
0
Goal reached: it still takes signatures until it closes.
The solution
Did you tried fast threads?
0
Goal reached: it still takes signatures until it closes.
The solution
Hi Andrij,
After few days of using your solution I figured out that it is still possible to have many threads with one user. It can be done by using "Private message" button from profile header. After hitting this button user is redirected to new thread without 'You already have threads with %s' message.
Can you help me with figuring out how to fix this?
Cheers,
Alfred
0
Goal reached: it still takes signatures until it closes.
The solution
What is fast threads, please? I'm also looking for solution how to automatically open existing thread.
0
Goal reached: it still takes signatures until it closes.
The solution
Hi there peoples!
I will made better solution including all your notices and place it here.
Thanks!
0
Goal reached: it still takes signatures until it closes.
The solution
Andrij,
That is great. When you will post it?
Cheers,
Alfred
0
Goal reached: it still takes signatures until it closes.
The solution
I was need to change some code in core to make this functionality.
It will be included as option in plugin configuration in next update.
I just need to finish some other things before release.
ETA is 3 to 5 days I think
0
Goal reached: it still takes signatures until it closes.
The solution
Hi Andrij,
Any update?
Cheers,
Alfred
0
Goal reached: it still takes signatures until it closes.
The solution
Hi there!
Im testing new version, need some more time to publish.
Thanks
0
Goal reached: it still takes signatures until it closes.
Log in to reply, and to hear of new replies in this topic.
Log in to replyNotifications