• Resolved power506

    (@power506)


    Hi, I’m planning to buy Buddypress addon so my users can contact each other via BP messages.

    In that case I want to remove email as a mandatory option. Is there a way to do that?

    • This topic was modified 7 years, 3 months ago by power506.
    • This topic was modified 7 years, 3 months ago by power506. Reason: Grammar
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    it is possible to remove the email field, but make sure to test your website if everything is working properly, as technically the email and title are two fields that should be never removed.

    One case when it will definitely not work is when you allow users to check a “create account” checkbox in [adverts_add]. If the user will check it but will not provide an email address then this will cause an error. This is not a problem of course if you allow only logged in users to post ads.

    Either way, in order to remove the email field from the [adverts_add] form you can add the code below in your theme functions.php

    
    add_filter( "adverts_form_load", "customize_adverts_add" );
    function customize_adverts_add( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "adverts_email" ) {
            unset( $form["field"][$key] );
        }
      }
      return $form;
    }
    
    Thread Starter power506

    (@power506)

    Thanks, that’s it, it works!

    About the disadvantage… I don’t allow guests to place adverts anyway.

    Plugin Author Greg Winiarski

    (@gwin)

    Ohh ok, in this case, it should work fine, but i would still recommend testing it everything runs smoothly.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Disable email as mandatory option’ is closed to new replies.