Advertisement:

Author Topic: SOLVED ad posting - only for company  (Read 2335 times)

andrei2987

  • Newbie
  • *
  • Posts: 40
Re: ad posting - only for company
« Reply #15 on: August 01, 2017, 01:28:55 pm »
I did a test and it looks like it works with osc_logged_user_id()
I try to integrate into my code and come back with details

andrei2987

  • Newbie
  • *
  • Posts: 40
Re: ad posting - only for company
« Reply #16 on: August 01, 2017, 01:57:33 pm »
i try this:

Code: [Select]
<ul class="dropdown-menu">
<li>
  <a href="<?php echo osc_user_dashboard_url(); ?>">
  <?php _e('My account''theme'); ?>
  </a>
        </li>


<?php
$seller User::newInstance()->findByPrimaryKey(osc_logged_user_id());
if ($seller['b_company'] == '1'
if( osc_users_enabled() || ( !osc_users_enabled() && !osc_reg_user_post() )) { ?>


<li>
<a href="<?php echo osc_item_post_url() ; ?>">
<?php _e('Ad new''theme'); ?>
</a>
</li>
<li>
<a href="<?php echo osc_user_list_items_url(); ?>">
<?php _e('My ads''theme'); ?>
</a>
</li>


<?php }?>


<li>
<a href="<?php echo osc_user_logout_url(); ?>">
<?php _e('Logout''theme'); ?>
        </a>
</li>
</ul>

and is WORKING - if is company link to "new ad" and "my ads" is visible (to all pages) and if is not company is not visible.

But my question is: is ok how I used the code?
I am referring to this section

Code: [Select]
$seller = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
if ($seller['b_company'] == '1')
if( osc_users_enabled() || ( !osc_users_enabled() && !osc_reg_user_post() )) { ?>

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: ad posting - only for company
« Reply #17 on: August 01, 2017, 02:08:31 pm »
If you are refering to
if( osc_users_enabled() || ( !osc_users_enabled() && !osc_reg_user_post() )) { ?>

These are for the option in admin to let nonregistered user post ads.

osc_users_enabled() - Gets if users are enabled or not
osc_reg_user_post() - Gets if only registered users can publish new items or anyone could
https://doc.osclass.org/HPreference.php


andrei2987

  • Newbie
  • *
  • Posts: 40
Re: ad posting - only for company
« Reply #18 on: August 01, 2017, 02:19:39 pm »
I understand.
It works fine now.


thank you very much for your time.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: ad posting - only for company
« Reply #19 on: August 01, 2017, 02:45:03 pm »
Please edit your first post with SOLVED in the title.