Advertisement:

Author Topic: User tickbox to show email address [SOLVED]  (Read 4769 times)

gary.wds

  • Newbie
  • *
  • Posts: 17
User tickbox to show email address [SOLVED]
« on: April 10, 2015, 07:10:04 pm »
hi.. i need help with this.. when someone posts an ad and is not registered it shows the tick box to show email address but if the user is registered it doesnt give the option to show or hide email.. i would like the user to have the option to show or hide email address.. anyone have any ideas please??? :)
« Last Edit: April 17, 2015, 12:28:29 am by gary.wds »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address
« Reply #1 on: April 11, 2015, 01:42:06 pm »
Hi,

What theme are you using?

Regards

gary.wds

  • Newbie
  • *
  • Posts: 17
Re: User tickbox to show email address
« Reply #2 on: April 12, 2015, 01:08:58 am »
Hi Teseo, im using the azul theme.. im pulling my hair out with thi problem! lol

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address
« Reply #3 on: April 12, 2015, 03:22:32 pm »
Sorry, this can be done but I don't know that theme, please paste here the contents of item-post.php and I tell you how to do it.

Regards

gary.wds

  • Newbie
  • *
  • Posts: 17
Re: User tickbox to show email address
« Reply #4 on: April 14, 2015, 06:09:31 pm »
Hi.. here is the content from item-post.. i think the problem is where i marked it in red but im not sure..

<?php

    // meta tag robots
    osc_add_hook('header','azul_nofollow_construct');

    osc_enqueue_script('jquery-validate');
    azul_add_body_class('');//item item-post
   osc_add_hook('after-main','sidebar');
    function sidebar(){
        osc_current_web_theme_path('itempost-sidebar.php');
    }
    $action = 'item_add_post';
    $edit = false;
    if(Params::getParam('action') == 'item_edit'){
        $action = 'item_edit_post';
        $edit = true;
    }

    ?>
<?php osc_current_web_theme_path('header.php') ; ?>
<?php ItemForm::location_javascript(); ?>
    <div class="form-container form-horizontal form-container-box">
        <div class="resp-wrapper">
            <h2><?php _e('Post a Free Ad', 'azul'); ?></h2>
            <ul id="error_list"></ul>
                <form name="item" action="<?php echo osc_base_url(true);?>" method="post" enctype="multipart/form-data" id="item-post">
                    <fieldset>
                    <input type="hidden" name="action" value="<?php echo $action; ?>" />
                        <input type="hidden" name="page" value="item" />
                    <?php if($edit){ ?>
                        <input type="hidden" name="id" value="<?php echo osc_item_id();?>" />
                        <input type="hidden" name="secret" value="<?php echo osc_item_secret();?>" />
                    <?php } ?>
                   
                    <h3><?php _e('Ad Information', 'azul'); ?></h3>
                   
                    <div class="control-group">
                        <label class="control-label" for="title[<?php echo osc_locale_code(); ?>]"><?php _e('Ad Title', 'azul'); ?></label>
                        <div class="controls">
                            <?php ItemForm::title_input('title',osc_locale_code(), osc_esc_html( azul_item_title() )); ?><font color="red">&nbsp;&nbsp;*</font>
                        </div>
                    </div>
                       
                    <div class="control-group">
                        <label class="control-label" for="select_1"><?php _e('Category', 'azul'); ?></label>
                        <div class="controls">
                            <?php ItemForm::category_select(null, null, __('Select a category', 'azul')); ?><font color="red">&nbsp;&nbsp;*</font>
                        </div>
                    </div>
                       
                    <div class="control-group">
                        <label class="control-label" for="description[<?php echo osc_locale_code(); ?>]"><?php _e('Description', 'azul'); ?></label>
                        <div class="controls">
                            <?php ItemForm::description_textarea('description',osc_locale_code(), osc_esc_html( azul_item_description() )); ?><font color="red">&nbsp;&nbsp;*</font>
                        </div>
                    </div>
                   
               <?php if( osc_price_enabled_at_items() ) { ?>
                    <div class="control-group">
                        <label class="control-label" for="price"><?php _e('Price', 'azul'); ?></label>
                        <div class="controls">
                            <?php ItemForm::price_input_text(); ?>
                            <?php ItemForm::currency_select(); ?>
                        </div>
                    </div>
                    <?php } ?>
                       
               <?php if( osc_images_enabled_at_items() ) {
                        ItemForm::ajax_photos();
                     } ?>
                    <div class="box location">
                        <h3><?php _e('Location', 'azul'); ?></h3>

                        <div class="control-group">
                            <label class="control-label" for="country"><?php _e('Country', 'azul'); ?></label>
                            <div class="controls">
                                <?php ItemForm::country_select(osc_get_countries(), osc_user()); ?><font color="red">&nbsp;&nbsp;*</font>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="region"><?php _e('Region', 'azul'); ?></label>
                            <div class="controls">
                              <?php ItemForm::region_select(osc_get_regions(), osc_user()); ?><font color="red">&nbsp;&nbsp;*</font>
                              <?php //ItemForm::region_select(osc_user()); ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="city"><?php _e('City/Area', 'azul'); ?></label>
                            <div class="controls">
                                <?php ItemForm::city_select() ; ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="address"><?php _e('Address', 'azul'); ?></label>
                            <div class="controls">
                              <?php ItemForm::address_text()  ; ?>
                            </div>
                        </div>
                    </div>
                    <!-- seller info -->
                    <?php if(!osc_is_web_user_logged_in() ) { ?>
                    <div class="box seller_info">
                    <h3><?php _e("Seller information", 'azul'); ?></h3>
                   
                   
                       
                        <div class="control-group">
                            <label class="control-label" for="contactName"><?php _e('Name', 'azul'); ?></label>
                            <div class="controls">
                                <?php ItemForm::contact_name_text(); ?>
                            </div>
                        </div>
                  
                  <div class="control-group">
                            <label class="control-label" for="contactPhone"><?php _e('Phone', 'azul'); ?></label>
                            <div class="controls">
                     <?php ItemForm::contact_phone_text(); ?><font color="red">&nbsp;&nbsp;*</font>
                        </div>
                       </div>
                  
                          <div class="control-group">
                            <div class="controls checkbox">
                                <?php ItemForm::show_phone_checkbox(); ?> <label for="showPhone"><?php _e('Show Phone on the listing page', 'azul'); ?></label>
                            </div>
                          </div>
                       
                       
                        <div class="control-group">
                            <label class="control-label" for="contactEmail"><?php _e('E-mail', 'azul'); ?></label>
                            <div class="controls">
                                <?php ItemForm::contact_email_text(); ?><font color="red">&nbsp;&nbsp;*</font>
                            </div>
                        </div>
                       
                        <div class="control-group">
                            <div class="controls checkbox">
                                <?php ItemForm::show_email_checkbox(); ?> <label for="showEmail"><?php _e('Show my e-mail', 'azul'); ?></label>
                            </div>
                        </div>
                       
                        <?php
                        }
                        if($edit) {
                            ItemForm::plugin_edit_item();
                        } else {
                            ItemForm::plugin_post_item();
                        }
                        ?>
                       
                    </div>
                       
                    <div class="control-group">
                        <?php if( osc_recaptcha_items_enabled() ) { ?>
                            <div class="controls">
                                <?php osc_show_recaptcha(); ?>
                            </div>
                        <?php }?>
                        <div class="controls">
                            <button type="submit" class="ui-button"><?php if($edit) { _e("Update", 'azul'); } else { _e("Publish", 'azul'); } ?></button>
                        </div>
                    </div>
                    </fieldset>
                </form>
            </div>
        </div>
        <script type="text/javascript">
      <?php if(osc_locale_thousands_sep()!='' || osc_locale_dec_point() != '') { ?>
      $().ready(function(){
         $("#price").blur(function(event) {
            var price = $("#price").prop("value");
            <?php if(osc_locale_thousands_sep()!='') { ?>
            while(price.indexOf('<?php echo osc_esc_js(osc_locale_thousands_sep());  ?>')!=-1) {
               price = price.replace('<?php echo osc_esc_js(osc_locale_thousands_sep());  ?>', '');
            }
            <?php }; ?>
            <?php if(osc_locale_dec_point()!='') { ?>
            var tmp = price.split('<?php echo osc_esc_js(osc_locale_dec_point())?>');
            if(tmp.length>2) {
               price = tmp[0] '<?php echo osc_esc_js(osc_locale_dec_point())?>' tmp[1];
            }
            <?php }; ?>
            $("#price").prop("value", price);
         });
      });
      <?php }; ?>
      </script>
<?php osc_current_web_theme_path('footer.php'); ?>
Thanks in advance teseo
« Last Edit: April 14, 2015, 07:15:53 pm by gary.wds »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address
« Reply #5 on: April 14, 2015, 08:54:30 pm »
Ok, change this block:

Code: [Select]
                        <div class="control-group">
                            <label class="control-label" for="contactEmail"><?php _e('E-mail''azul'); ?></label>
                            <div class="controls">
                                <?php ItemForm::contact_email_text(); ?><font color="red">&nbsp;&nbsp;*</font>
                            </div>
                        </div>
                       
                        <div class="control-group">
                            <div class="controls checkbox">
                                <?php ItemForm::show_email_checkbox(); ?> <label for="showEmail"><?php _e('Show my e-mail''azul'); ?></label>
                            </div>
                        </div>
                       
                        <?php
                        
}
                        if(
$edit) {
                            
ItemForm::plugin_edit_item();

to:

Code: [Select]
                        <div class="control-group">
                            <label class="control-label" for="contactEmail"><?php _e('E-mail''azul'); ?></label>
                            <div class="controls">
                                <?php ItemForm::contact_email_text(); ?><font color="red">&nbsp;&nbsp;*</font>
                            </div>
                        </div>
                                               
                        <?php
                        
?>

                        <div class="control-group">
                            <div class="controls checkbox">
                                <?php ItemForm::show_email_checkbox(); ?> <label for="showEmail"><?php _e('Show my e-mail''azul'); ?></label>
                            </div>
                        </div>
                        <?php if($edit) {
                            
ItemForm::plugin_edit_item();

Regards

gary.wds

  • Newbie
  • *
  • Posts: 17
Re: User tickbox to show email address
« Reply #6 on: April 15, 2015, 08:32:17 pm »
hi teseo.. thanks for the reply.. the code id working ok for non registered users but it removes the Name, Phone number and email options if the user is registered and logged in.. i want to give the registered users the option to show phone and email to not just the non registered users..

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address
« Reply #7 on: April 15, 2015, 09:36:52 pm »
Oh, didn't realize your theme has these Phone options. Well, if what you want is everyone seeing that block there, restore your original item-post.php and just replace this line:

Code: [Select]
<?php if(!osc_is_web_user_logged_in() ) { ?>
with:

Code: [Select]
<?php // if(!osc_is_web_user_logged_in() ) { ?>
<?php if(== 1) { ?>

Regards

gary.wds

  • Newbie
  • *
  • Posts: 17
Re: User tickbox to show email address
« Reply #8 on: April 16, 2015, 02:50:29 pm »
thanks teseo.. worked sweet.. you the man.. took you a few mins to sort it and it took me 3 days and i still couldnt sort it! lol.. thanks again..  can i ask you another question?? would it be possible to have the registered users phone number and email in the box when there posting an ad?? thanks in advance

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address
« Reply #9 on: April 16, 2015, 03:22:22 pm »
would it be possible to have the registered users phone number and email in the box when there posting an ad?? thanks in advance

For that I can only help you with email, replace this line:

Code: [Select]
<?php ItemForm::contact_email_text(); ?><font color="red">&nbsp;&nbsp;*</font>
with:

Code: [Select]
<?php ItemForm::contact_email_text(!$edit ? array('s_contact_email' => osc_user_email()) : ''); ?><font color="red">&nbsp;&nbsp;*</font>
Problem to do the same with Phone is that you are using a function ItemForm::contact_phone_text() that I couldn't find in Osclass core, so I guess it's something specific to your theme. ??? Better ask to its developer.

Regards

gary.wds

  • Newbie
  • *
  • Posts: 17
Re: User tickbox to show email address
« Reply #10 on: April 16, 2015, 05:00:46 pm »
Hi Teseo.. thank you very much for your help.. works well.. i just changed "s_contact_email to s_contact_phone and  osc_user_email to osc_user_phone and that worked aswell.. really appreciate your help thanks again

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address
« Reply #11 on: April 16, 2015, 05:43:10 pm »
You're welcome. :) Please add [SOLVED] to the title of this thread.

Regards

gary.wds

  • Newbie
  • *
  • Posts: 17
Re: User tickbox to show email address [SOLVED]
« Reply #12 on: April 28, 2015, 08:19:34 pm »
Hi Teseo.. i was wondering if i could bother you again?? having a wee problem with the main image..  the main image is working if the user uploads one but if the user doesnt upload any images it wont show the No-photo.gif image can u help me with this please here is the code from the item.php... thanks in advance..

<div class="fav"><img src="<?php echo osc_current_web_theme_url(); ?>images/fav.png" width="25px" /><?php //watchlist(); ?>Favorite</div> <div class="shr"><img src="<?php echo osc_current_web_theme_url(); ?>images/ishare.png" width="25px" />Share</div> <div class="spm"><img src="<?php echo osc_current_web_theme_url(); ?>images/flg.png" width="21px" />Spam</div> </div>
           </div> 
                <div class="clear"></div>
                <div class="container">
                <div class="gal">
           
                <div class="bigphoto"><a href="<?php echo osc_resource_url(); ?>" data-fancybox-group="gallery" class="fancybox" title="<?php _e('Image', 'azul'); ?> <?php echo $i 1;?> / <?php echo osc_count_item_resources();?>">
                <img class="img-responsive" src="<?php echo osc_resource_url(); ?>" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
            </a>
            </div>

                     
         <div class="thumbs">
         
   <?php for ( $i = 0; osc_has_item_resources(); $i   ) { ?>
            <a href="<?php echo osc_resource_url(); ?>" data-fancybox-group="gallery" class="fancybox" title="<?php _e('Image', 'azul'); ?> <?php echo $i 1;?> / <?php echo osc_count_item_resources();?>">
                <img src="<?php echo osc_resource_thumbnail_url(); ?>" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
            </a>
            <?php } ?>
            </div>
   
            <?php if( osc_images_enabled_at_items() ) { ?>
            <?php
            if( osc_count_item_resources() > 0 ) {
                $i = 0;
            ?>
            <div class="item-photos">
            <?php for ( $i = 1; osc_has_item_resources(); $i   ) { ?>
                <a href="<?php echo osc_resource_url(); ?>" data-fancybox-group="gallery" class="fancybox" title="<?php _e('Image', 'azul'); ?> <?php echo $i 1;?> / <?php echo osc_count_item_resources();?>">
                    <img src="<?php echo osc_resource_thumbnail_url(); ?>" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
                </a>
                <?php } ?>
                <script>
               $(document).ready(function() {
               $('.fancybox').fancybox();
               });
            </script>
            
            </div><!-- Item Photos End -->

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: User tickbox to show email address [SOLVED]
« Reply #13 on: April 28, 2015, 08:55:53 pm »
Please, don't mix different subjects in the threads, I've already answered you in the other thread you opened.

Regards

madee

  • Newbie
  • *
  • Posts: 8
Re: User tickbox to show email address [SOLVED]
« Reply #14 on: October 25, 2016, 03:23:44 pm »
Hi Teseo,

I am using the Zara Theme and I am facing the same issue. Can you please help me with that?

I have attached my item-post file below.

I want to hide both phone and email.