*

Vettalo

  • ***
  • 59 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

  • ***
  • 59 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

  • ***
  • 59 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

  • ***
  • 59 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

  • ***
  • 59 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

  • ***
  • 59 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

*

rooman

  • ****
  • 231 posts
Re: user not logged in redirect to login page
« Reply #10 on: August 19, 2022, 05:20:11 PM »
If the user is on the item's page or a private page or anywhere on the site and needs to log in
Why when logging in it is not redirected to the last page it was on?
It is only directed to the control panel and then returns to search again (problem)
Is there a way to solve this problem
Directing the user after logging in to the last page he was on

*

MB Themes

Re: user not logged in redirect to login page
« Reply #11 on: August 20, 2022, 01:25:37 PM »
You would need to validate and decide if referrer url is really where user wants to go, but yes it would be worth to have such setting in osclass.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: user not logged in redirect to login page
« Reply #12 on: August 20, 2022, 04:16:19 PM »
Hope it will be in the next version osclass 8.0.3

*

MB Themes

Re: user not logged in redirect to login page
« Reply #13 on: August 23, 2022, 09:18:13 PM »
I will out it on list.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: user not logged in redirect to login page
« Reply #14 on: April 04, 2023, 01:18:03 PM »
I will out it on list.

Do not forget it