*

Vettalo

  • ***
  • 43 posts
user not logged in redirect to login page
« on: September 08, 2021, 05:24:57 PM »
I have displayed messages link in header and when users is not logged it shows them you must be logged in to see conversations.
i need users when they click to messages link will be redirected directly to login page.
Regards.

*

MB Themes

Re: user not logged in redirect to login page
« Reply #1 on: September 08, 2021, 05:28:43 PM »
@Vettalo
You can use this code and place it in any file you like ;)
Code: [Select]
  if(!osc_is_web_user_logged_in()) {
    osc_add_flash_error_message(__('Please log in to see your conversations.', 'instant_messenger'));
    header('Location:' . osc_user_login_url());
    exit;
  }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vettalo

  • ***
  • 43 posts
Re: user not logged in redirect to login page
« Reply #2 on: September 08, 2021, 05:33:31 PM »
@Vettalo
You can use this code and place it in any file you like ;)
Code: [Select]
  if(!osc_is_web_user_logged_in()) {
    osc_add_flash_error_message(__('Please log in to see your conversations.', 'instant_messenger'));
    header('Location:' . osc_user_login_url());
    exit;
  }

I already have this code in the plugin I think you didnt understand my question!
i dont want to show flash message i want users when they click on messages to be redirected directly yo login page like in your latest theme delta not display them flash error.
like i have in favourite plugin when users click on favourite link they are redirected directly to login page without flash error message.
Regards.

*

Vettalo

  • ***
  • 43 posts
Re: user not logged in redirect to login page
« Reply #3 on: September 08, 2021, 05:44:05 PM »
this the code i already have in threads.php

    <?php if(!osc_is_web_user_logged_in()) { ?>
      <div class="im-empty flashmessage flashmessage-warning"><?php _e('Please log in to see your conversations.', 'instant_messenger'); ?></div>
    <?php } else { ?>
      <div class="im-empty flashmessage flashmessage-warning"><?php _e('You have no conversations', 'instant_messenger'); ?></div>
    <?php } ?>

*

MB Themes

Re: user not logged in redirect to login page
« Reply #4 on: September 08, 2021, 05:49:34 PM »
Sorry it is not clear.
You may want to update button link, but even for that you already have pattern from previous code.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vettalo

  • ***
  • 43 posts
Re: user not logged in redirect to login page
« Reply #5 on: September 08, 2021, 06:04:23 PM »
Sorry it is not clear.
You may want to update button link, but even for that you already have pattern from previous code.
how can i do this?

*

Vettalo

  • ***
  • 43 posts
Re: user not logged in redirect to login page
« Reply #6 on: September 08, 2021, 06:07:04 PM »
same as contact button if users not logged in it redirect them to login page.

*

MB Themes

Re: user not logged in redirect to login page
« Reply #7 on: September 08, 2021, 06:08:22 PM »
@Vettalo
Code: [Select]
<a href="<?php if(!osc_is_web_user_logged_in()) { echo osc_user_login_url(); } else { echo $some_other_link; } ?>">Sample button</a>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Vettalo

  • ***
  • 43 posts
Re: user not logged in redirect to login page
« Reply #8 on: September 08, 2021, 06:32:51 PM »
@Vettalo
Code: [Select]
<a href="<?php if(!osc_is_web_user_logged_in()) { echo osc_user_login_url(); } else { echo $some_other_link; } ?>">Sample button</a>
yes, it works but not redirect them to threads pages after login.
anyway thank you for your support.
Regards

*

MB Themes

Re: user not logged in redirect to login page
« Reply #9 on: September 08, 2021, 09:21:15 PM »
Sure, as you did not come to login page from threads page.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots