dpp3047 2017-10-27 02:22
浏览 238

登录和注销用户的发布按钮

Hi i'm using Osclass script and have a problem with the publish button on my item post page!

See image publish button

Listing Location: The publish button needs to hide for the not registered users and appears for the registered users.

How do i change this code to hide when logged out??

<?php if(!osc_is_web_user_logged_in() ) { ?>

Publisher Information: publish button needs to appears for not registered users and hide for the registered users. For this i use this code and looks like this works great!

<?php if(!osc_is_web_user_logged_in() ) { ?>
<fieldset>
  <h2>
     <strong><?php _e("Publisher Information", 'ctg_housing'); ?></strong>
  </h2>
  <div class="item-post-user-name item-post-columns">
    <label class="control-label" for="contactName">
      <span class="required_fields">*</span>
      <?php _e('Name', 'ctg_housing'); ?>
    </label>
    <?php ItemForm::contact_name_text(); ?>
  </div>
  <div class="item-post-user-email item-post-columns">
    <label class="control-label" for="contactEmail">
      <span class="required_fields">*</span>
      <?php _e('E-mail', 'ctg_housing'); ?>
    </label>
    <?php ItemForm::contact_email_text(); ?>
  </div>
  <div class="clearfix"></div>
  <div id="submit-button" class="item-post-button text-center">
    <button type="submit" class="small button_radius">
      <?php if($edit) { _e("Update Listing", 'ctg_housing'); } else { _e("Publish Listing", 'ctg_housing'); } ?>
    </button>
  </div>
</fieldset>
<?php  } ?>  

Thanks

  • 写回答

1条回答 默认 最新

  • doupijin0397 2017-10-27 03:39
    关注

    Solved here the answer!

            <?php if( osc_is_web_user_logged_in() ) { ?>
            <fieldset>
              <h2>
                <strong><?php _e('Listing Location', 'ctg_housing'); ?></strong>
              </h2>
              <?php $aCountries = Country::newInstance()->listAll(); ?>
              <?php $TwoCountry = false ; if(count($aCountries) > 1 ) { $TwoCountry = true ; ?>
              <div class="item-post-country">
                <label class="control-label" for="country">
                  <span class="required_fields">* </span>
                  <?php _e('Country', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::country_select(osc_get_countries()); ?>
              </div>
              <?php } else { ?>
              <input type="hidden" name="countryId" id="countryId" value="<?php echo ctg_country_id(); ?>" />
              <?php } ?>
              <div class="item-post-province">
                <label class="control-label" for="region">
                  <span class="required_fields">* </span>
                  <?php _e('Province', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::region_select(osc_get_regions()); ?>
              </div>
              <div class="item-post-region">
                <label class="control-label" for="city">
                  <span class="required_fields">* </span>
                  <?php _e('Region', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::city_select(osc_get_cities()); ?>
              </div>
              <div class="clearfix"></div>
              <div id="submit-button" class="item-post-button text-center">
                <button type="submit" class="small button_radius">
                  <?php if($edit) { _e("Update Listing", 'ctg_housing'); } else { _e("Publish Listing", 'ctg_housing'); } ?>
                </button>
              </div>
            </fieldset>
            <?php } else { ?>
            <fieldset>
              <h2>
                <strong><?php _e('Listing Location', 'ctg_housing'); ?></strong>
              </h2>
              <?php $aCountries = Country::newInstance()->listAll(); ?>
              <?php $TwoCountry = false ; if(count($aCountries) > 1 ) { $TwoCountry = true ; ?>
              <div class="item-post-country">
                <label class="control-label" for="country">
                  <span class="required_fields">* </span>
                  <?php _e('Country', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::country_select(osc_get_countries()); ?>
              </div>
              <?php } else { ?>
              <input type="hidden" name="countryId" id="countryId" value="<?php echo ctg_country_id(); ?>" />
              <?php } ?>
              <div class="item-post-province">
                <label class="control-label" for="region">
                  <span class="required_fields">* </span>
                  <?php _e('Province', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::region_select(osc_get_regions()); ?>
              </div>
              <div class="item-post-region">
                <label class="control-label" for="city">
                  <span class="required_fields">* </span>
                  <?php _e('Region', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::city_select(osc_get_cities()); ?>
              </div>
            </fieldset>
            <fieldset>
              <h2>
                 <strong><?php _e("Publisher Information", 'ctg_housing'); ?></strong>
              </h2>
              <div class="item-post-user-name item-post-columns">
                <label class="control-label" for="contactName">
                  <span class="required_fields">*</span>
                  <?php _e('Name', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::contact_name_text(); ?>
              </div>
              <div class="item-post-user-email item-post-columns">
                <label class="control-label" for="contactEmail">
                  <span class="required_fields">*</span>
                  <?php _e('E-mail', 'ctg_housing'); ?>
                </label>
                <?php ItemForm::contact_email_text(); ?>
              </div>
              <div class="clearfix"></div>
              <div id="submit-button" class="item-post-button text-center">
                <button type="submit" class="small button_radius">
                  <?php if($edit) { _e("Update Listing", 'ctg_housing'); } else { _e("Publish Listing", 'ctg_housing'); } ?>
                </button>
              </div>
            </fieldset>
            <?php } ?>  

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?