hi guys,
I have the following code which puts a
calling button on the mobile version of my website:
<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 accountNow 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:
<?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:
<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