Advertisement:

Author Topic: [SOLVED] How to allow users Publish Ads without email?  (Read 3060 times)

volunteer

  • Full Member
  • ***
  • Posts: 241
[SOLVED] How to allow users Publish Ads without email?
« on: March 07, 2014, 07:08:45 pm »
what modification should I make to allow user to publish ads without providing email address?

in item-post.php the code is the following

Code: [Select]
    <div class="clearfix">
                                <label><?php _e('E-mail''repurpose') ; ?></label>
                                <div class="input">
                                    <?php echo item_contact_mail_input() ; ?>
                                </div>
                            </div>
                            <div class="clearfix">
                                <div class="input">
                                    <ul class="inputs-list">
                                        <li>
                                            <label for="showEmail">
                                                <?php echo item_contact_show_email_checkbox() ; ?>
                                                <span><?php _e('Show e-mail on the item page''repurpose'); ?></span>
                                            </label>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <!-- seller end -->

and in item.php what will happen with the contact button?

Code: [Select]
<?php ?>
                    <p>
                        <?php if ( !$is_expired && $is_user && $is_can_contact ) { ?>
                        <a class="btn primary item-contact-button" data-controls-modal="item-contact" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Contact seller''repurpose') ; ?></a>
                        <?php ?>
                        <a class="btn primary item-share-button" data-controls-modal="item-sendfriend" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Share''repurpose') ; ?></a>
                    </p>
                    <?php osc_run_hook('location') ; ?>
                </div>
                <!-- item detail end -->

thanks guys! :)
« Last Edit: March 09, 2014, 10:37:23 pm by volunteer »

Ecs

  • Newbie
  • *
  • Posts: 17
  • You can't handle the truth!
Re: How to allow users Publish Ads without email?
« Reply #1 on: March 09, 2014, 06:38:18 pm »
Hello volunteer,

First of all, before you alter any file, make some back-ups for them. Backup, backup, backup!


Step one. Go to "Listing" ---> "Settings"  and make the following changes.

- Don't check (uncheck) the "Only logged in users can post listings".
- Don't check (uncheck) the "Users have to validate their listings".

Save settings.


Step two. Go to
Code: [Select]
public_html/oc-includes/osclass/helpers/hValidate.php

On line 259, find the following:

 
Code: [Select]
function osc_validate_email ($email, $required = true) {
Change the statement to false, like this:

 
Code: [Select]
function osc_validate_email ($email, $required = false) {
Save file.

Step three

Go to your theme folder:

Code: [Select]
public_html/oc-content/themes/modern/item-post.php
From the line 172, you have to alter the followings:

Code: [Select]
<div class="row">
<label for="contactEmail"><?php _e('E-mail''modern'); ?> *</label>
<?php ItemForm::contact_email_text(); ?>
</div>
<div class="row">
<div style="width: 120px;text-align: right;float:left;">
<?php ItemForm::show_email_checkbox(); ?>
</div>
<label for="showEmail" style="width: 250px;"><?php _e('Show e-mail on the listing page''modern'); ?></label>
</div>

Put some <!-- ... --> before and after these lines, and you are OK. Like this:

Code: [Select]
<!--<div class="row">
<label for="contactEmail"><?php _e('E-mail''modern'); ?> *</label>
<?php ItemForm::contact_email_text(); ?>
</div>
<div class="row">
<div style="width: 120px;text-align: right;float:left;">
<?php ItemForm::show_email_checkbox(); ?>
</div>
<label for="showEmail" style="width: 250px;"><?php _e('Show e-mail on the listing page''modern'); ?></label>
</div>-->


OR in your case, the syntax you showed us.
Save file.

Step four. Go to your website. Refresh your browser. Try to put an ad. Tada! No email required.


I hope this is what you are looking for. Have a nice one!
« Last Edit: March 09, 2014, 06:41:32 pm by Ecs »

volunteer

  • Full Member
  • ***
  • Posts: 241
[SOLVED] How to allow users Publish Ads without email?
« Reply #2 on: March 09, 2014, 10:36:57 pm »
genius ! thanks!!  :)

Ecs

  • Newbie
  • *
  • Posts: 17
  • You can't handle the truth!
Re: [SOLVED] How to allow users Publish Ads without email?
« Reply #3 on: March 09, 2014, 11:50:13 pm »
You're welcome!

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [SOLVED] How to allow users Publish Ads without email?
« Reply #4 on: March 10, 2014, 02:48:09 am »
now every time someone posts without email and is contacted the email is sent to the admin@mysite.com

what would u recommend? a php else to hide contact button if ad has no email?


Ecs

  • Newbie
  • *
  • Posts: 17
  • You can't handle the truth!
Re: [SOLVED] How to allow users Publish Ads without email?
« Reply #5 on: March 10, 2014, 09:54:48 am »
Hello again volunteer,

Well, that's kinda tricky. You have to take in consideration that, my above-presented solution, is just an "hiding" solution, and one little tweak about the validation. So, if you want to hide the contact button on the ad page, that's easy. But, that solution will apply to all users. What I mean is, if you "hide" the contact button bellow the ad, it's hidden for all kind of users. Registered or not.

So, think about it, and if this is what you want, just go to your theme folder, open item.php file, and alter the following:

Line 110:

Code: [Select]
<a class="btn primary item-contact-button" data-controls-modal="item-contact" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Contact seller''twitter') ; ?></a>                       
Comment the line like this:

Code: [Select]
<!--<a class="btn primary item-contact-button" data-controls-modal="item-contact" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Contact seller''twitter') ; ?></a>-->

And that's it. Save the file, refresh the browser. There you go.




But! And this is what I have in mind for you. I imagine that the sellers have to be somehow contacted. As an alternative solution, after you hide all above, you can use the "Custom fields" where you can make custom requests from users. As in telephone number, email, etcetera. Make some custom fields, "TEXT" , and make them non-mandatory, or not-required.

With this solution, the seller will be able to leave some contact information, without being restricted by validation or mandatory fields.

The custom fields will appear under the ads text, and will be visible to visitors. Witch is a good thing, if someone wants to contact the seller.


I hope this is what you are searching for. Have a nice day!
« Last Edit: March 10, 2014, 09:57:02 am by Ecs »

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: [SOLVED] How to allow users Publish Ads without email?
« Reply #6 on: March 10, 2014, 11:41:10 am »
thanks for the work around

I was thinking in something like what I use to change contact button for a log in message for non-registered users

<!-- IF LOGGED SEE CONTACT BUTTON / DEFAULT CODE -->
Code: [Select]
<?php if ( !$is_expired && $is_user && $is_can_contact ) { ?>
                        <a class="btn primary item-contact-button" data-controls-modal="item-contact" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Contact seller''repurpose') ; ?></a>

<!-- IF NOT LOGGED SEE MESSAGE -->
<?php } else { ?>
<p style="color:red;"><strong>Please login to Contact</strong></p>
<?php ?>   
                 
<a class="btn primary item-share-button" data-controls-modal="item-sendfriend" data-backdrop="true" data-keyboard="true" href="javascript://"><?php _e('Share''repurpose') ; ?></a>

can u think about something like that?
<!-- IF NOT EMAIL in data base for this ad dont show contact button? -->
is just an idea. I am bad with php
thanks!

zerocoder

  • Newbie
  • *
  • Posts: 12
Re: [SOLVED] How to allow users Publish Ads without email?
« Reply #7 on: March 08, 2018, 11:39:10 am »
Great Help Ecs.  I am finally able to remove email field. 
Thanks  a lot buddy