*

mwindey

  • *****
  • 482 posts
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') );
    }
  }

*

MB Themes

@mwindey
You could modify that code into:
Code: [Select]
      if(im_check_block(osc_item_user_id(), osc_logged_user_id()) == 0) {
        ... you cannot contact seller ...
      } else {
        .. you can contact seller ...
      }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 482 posts
@MB Themes

Thanks again for your help, it is much appreciated. I put the code in:

Code: [Select]
<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!
« Last Edit: May 12, 2021, 12:30:53 PM by MB Themes »

*

MB Themes

@mwindey
That looks good ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots