Advertisement:

Author Topic: Help with this piece of code  (Read 674 times)

ezybusy

  • Full Member
  • ***
  • Posts: 193
Help with this piece of code
« on: September 26, 2016, 05:08:02 pm »
hi guys,
I have the following code which puts a calling button on the mobile version of my website:

Code: [Select]
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn_color_2  btn-block "><?php echo 'Call user' ;?></a>
upon pressing the button the dialing screen of the cell phone is opened, pre-filled with the number of the user who posted the ad. It works perfectly but only when the user who posted the ad is registered and attached a valid telephone number to his account

Now in order to allow unregistered users to also post ads and add their telephone number, i used the free plugin telephone which provides the following two codes:

Code: [Select]
<?php if(function_exists('osc_set_telephone_number')){ osc_set_telephone_number();} ?>// To display the field on ad posting page

<?php if(function_exists('osc_telephone_number')){ osc_telephone_number();} ?>// to display the phone number on item page

So far so good!!!

Now i want to come up with a code to do the following:

1 - If the user who posted an ad is registered and has a telephone number, then upon pressing the calling button the system should launch the dialing screen with his number already pre-filled.

2 - If the user is not registered, but provided a telephone number (through telephone plugin) when he was posting an ad, then when the  calling button is pressed the system should launch the dialing screen with the number associated to the post already filled.


So that we can use the calling button at anytime even if a user who posted an ad was registered or not.

I tried the following but it wasn't successful:

Code: [Select]
<a href="tel:<?php if(osc_user_phone() !== ''){
               echo 
osc_user_phone();} 
               elseif
               (
function_exists('osc_telephone_number')){osc_telephone_number();} ?>
" class="btn btn_color_2  btn-block ">
          <?php echo 'Call user' ;?></a>

Can someone help me out please ??? :-[ :-[

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Help with this piece of code
« Reply #1 on: September 27, 2016, 11:01:10 am »
Guys no one to help?

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Help with this piece of code
« Reply #2 on: October 27, 2016, 08:35:06 pm »
Guys still no one to help????