phpjqueryosclass

Osclass osc_user_phone () is not working


Recently i use this function to hide the last numbers of osc_user_phone() in Osclass 3.6.1

jQuery

<script>
    $(document).ready(function(){
        $("#showPhone").click(function () {
            $("#showPhone").hide();
            $("#hidePhone").show();
        });

        $("#hidePhone").click(function () {
            $("#showPhone").show();
            $("#hidePhone").hide();
        });
    });
</script>

HTML

<?php _e('user phone'); ?> :
<span>
    <a href="#"  id="hidePhone" style="display: none;">
        <?php echo osc_user_phone_mobile(); ?>
    </a>
</span>
<span>
    <a href="#"  id="showPhone">
        <?php echo substr(osc_user_phone_mobile(),0,-4).'XXXX'; ?>
    </a>
</span>

Up here everything is ok. If complete the Phone Cell field in User profile is ok, the phone number show in item page. If post a new ad, without account and complete the Cell Phone input, the phone number not showing in item page.

from item-post.php, problem is here (i hope)

<div class="control-group">
    <label class="control-label" for="phoneMobile"><?php _e('Cell phone', 'infinity'); ?></label>
    <div class="controls">
        <?php UserForm::mobile_text(osc_user()); ?>
    </div>
</div>

and from user-profile.php, the cell phone input:

<div class="control-group">
    <label class="control-label" for="phoneMobile"><?php _e('Cell phone', 'infinity'); ?></label>
    <div class="controls">
        <?php UserForm::mobile_text(osc_user()); ?>
    </div>
</div>

the same code that item-post.php

How do input field to work and when user posted new ad the phone number show in the item page?


Solution

  • In osclass 3.7.1 (bender theme) I managed to put the registered user phone into item-post.php The code:

    <?php if(osc_is_web_user_logged_in()) { ?>
     <?php if (!$edit) { ?>
                <div class="control-group">
                    <label class="control-label" for="phoneLand"><?php _e('Phone', 'bender'); ?>*</label>
                    <div class="controls">
                        <?php UserForm::phone_land_text(osc_user()); ?>
    <p style="font-size: 0.85em; color:red;">* empty => <u>it will miss from all the listings !</u></br>* filled => <u>it will show in all the listings !</u></p>
             </div>
        </div>
     <?php } ?>
     <?php if ($edit) { ?>
                <div class="control-group">
                    <label class="control-label" for="phoneLand">The <?php _e('Phone', 'bender'); ?></label>
                    <div class="controls">
    <p style="font-size: 0.85em;"> can be edited <a href="<?php echo osc_user_profile_url(); ?>" target="_blank">here</a>.</p>
             </div>
        </div>
     <?php } ?>
    <?php } ?>