*

Ansel

  • *
  • 2 posts
Publish
« on: January 03, 2021, 06:55:45 PM »
Hi guys how to redirect the publish button to the login page? only when not logged in yet!

Code: [Select]
<div class="header">
  <nav class="header-bar" data-topbar role="navigation">
    <ul class="name">
      <li>
        <a href="<?php echo osc_base_url(); ?>"><?php echo osc_page_title(); ?></a>
      </li>
    </ul>
<ul class="menu">
        <?php if( osc_users_enabled() ) { ?>
        <?php if( osc_is_web_user_logged_in() ) { ?>
        <li class="has-dropdown"><a href="#">
          <?php _e('My account''ctg_housing'); ?>
          </a> <?php echo ctg_private_user_menu_dropdown();  ?> </li>
        <li class="divider"></li>
        <li><a href="<?php echo osc_user_logout_url(); ?>">
          <?php _e('Logout''ctg_housing'); ?>
          </a> </li>
        <?php } else { ?>
          <li>
    <a id="login_open" href="<?php echo osc_user_login_url(); ?>">
            <?php _e('Login''ctg_housing') ; ?>
            </a>
  </li>
        <?php if(osc_user_registration_enabled()) { ?>
          <li>
            <a id="menu-btn" href="<?php echo osc_register_account_url() ; ?>">
              <?php _e('Register''ctg_housing'); ?>
            </a>
          </li>
        <?php }; ?>
        <?php ?>
        <?php ?>
       

        <?php if( osc_users_enabled() || ( !osc_users_enabled() && !osc_reg_user_post() )) { ?>
        <li class="publish"><a href="<?php echo osc_item_post_url_in_category() ; ?>">
          <?php _e("Publish"'ctg_housing');?>
          </a></li>
        <?php ?>
</ul>


  </nav>
</div>

Marked as best answer by frosticek on January 04, 2021, 11:37:39 AM
*

MB Themes

Re: Publish
« Reply #1 on: January 04, 2021, 11:37:37 AM »
@Ansel
You should change this code:
Code: [Select]
<a href="<?php echo osc_item_post_url_in_category() ; ?>"><?php _e("Publish"'ctg_housing');?></a>
Into:
Code: [Select]
<a href="<?php echo (osc_is_web_user_logged_in() ? osc_item_post_url_in_category() : osc_user_login_url()) ; ?>"><?php _e("Publish"'ctg_housing');?></a>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

cartagena68

  • ***
  • 71 posts
Re: Publish
« Reply #2 on: January 04, 2021, 02:37:04 PM »
Actually you just need to check the option in listing setting

*

Ansel

  • *
  • 2 posts
Re: Publish
« Reply #3 on: January 05, 2021, 07:58:44 AM »
Thanks for the answer the screenshot was easy!