Osclass Support Forums
Osclass plugin support => Instant Messenger Plugin => Topic started by: mwindey on May 10, 2021, 11:08:40 AM
-
I am using the messenger plugin and blocking a user is no problem if you use the plugin button to send messages.
However, if you respond to an item from a seller on the item page (contact seller) it will still leave a message in messenger even though the user is blocked in blocked users (DB). Would there be a possibility to insert the check(blocked users) that is used in create_thread.php into item.php check_form?
// CHECK FOR BLOCK
if(im_check_block($to_user_id, $from_user_id) == 0) {
//osc_add_flash_error_message( __('User has blocked you. You cannot message this user anymore.', 'instant_messenger'));
header('Location: ' . osc_route_url( 'im-threads'));
return;
}
$thread_id = ModelIM::newInstance()->createThread( $item_id, $from_user_id, $from_user_name, $from_id, $to_user_id, $to_user_name, $to_user_email, $title, 0);
$thread = ModelIM::newInstance()->getThreadById( $thread_id );
im_insert_message($thread['i_thread_id'], nl2br(htmlspecialchars(Params::getParam('im-message', false, false))), 0, Params::getFiles('im-file') );
}
}
-
@mwindey
You could modify that code into:
if(im_check_block(osc_item_user_id(), osc_logged_user_id()) == 0) {
... you cannot contact seller ...
} else {
.. you can contact seller ...
}
-
@MB Themes
Thanks again for your help, it is much appreciated. I put the code in:
<div class = "message-block">
<? if (im_check_block (osc_item_user_id (), osc_logged_user_id ()) == 0) {?>
<form> <fieldset>
<button type = "<? php echo (osc_get_preference ('forms_ajax', 'veronika_theme') == 1? 'button': 'submit');?>" class = "send" id = "item-message"> < i class = "fa fa-envelope"> </i> <? php _e ('Send message', 'veronika'); ?> </button>
</fieldset>
</form>
<? } else if (osc_item_is_expired ()) {?>.......
so the ad remains visible and a button appears to send the message. When the send message button is pressed, a message appears(error) saying the user is blocked. Just a few more small improvements to make and I can go live ;-) Thanks!
-
@mwindey
That looks good ;)