Skip to:
Content
Pages
Categories
Search
Top
Bottom

disable email Email (required) config ?

Viewing 21 replies - 1 through 21 (of 21 total)
  • @robin-w

    Moderator

    This is in a file called form-anonymous.php :

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-anonymous.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-anonymous.php
    bbPress will now use this template instead of the original
    and you can amend this

    you will see that lines 26-29 contain

    <p>
    			<label for="bbp_anonymous_email"><?php _e( 'Mail (will not be published) (required):', 'bbpress' ); ?></label><br />
    			<input type="text" id="bbp_anonymous_email"   value="<?php bbp_author_email(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_email" />
    		</p>

    Just delete this and save, and this field will not be shown

    @crewockeez

    Participant

    yes. i bbPress will now use this template instead of the original. but test don’t work

    @robin-w

    Moderator

    untested, but try adding this to your functions file

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'bbp_filter_anonymous_post_data', $retval, $r );
    }

    @crewockeez

    Participant

    no insert code on fuctions file. on site error

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'bbp_filter_anonymous_post_data', $retval, $r );
    }

    @robin-w

    Moderator

    not sure what you mean, but corrected code here

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'rew_filter_anonymous_post_data', $retval, $r );
    }

    @crewockeez

    Participant

    i insert code on functions.php on my team

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'bbp_filter_anonymous_post_data', $retval, $r );

    upload file functions.php on server. open site error.

    @robin-w

    Moderator

    can you try the new version please

    @crewockeez

    Participant

    Where download ?

    @robin-w

    Moderator

    this – it has some parts changed !!

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'rew_filter_anonymous_post_data', $retval, $r );
    }

    @crewockeez

    Participant

    i try insert new code. not work.

    @robin-w

    Moderator

    sorry, not sure I can help further !!

    @crewockeez

    Participant

    I can sent file fuctions theme. Your try ?

    @fuskeren

    Participant

    Hi Crewockeez,

    1. Line of Robins code appears to be broken, can you try replacing it with:

    add_filter ('bbp_filter_anonymous_post_data' , 'rew_filter_anonymous_post_data' 10, 2);

    @robin-w

    Moderator

    @fuskeren good spot !!

    @crewockeez

    Participant

    not work @fuskeren

    https://cldup.com/zCz9k4xmBA.php

    file fuctions my theme

    @fuskeren

    Participant

    Hi Crew,

    It should be placed a little like this:

    http://pastebin.com/raw/jPjfsnce

    If this does not seem to work, i can’t do much more, with my very limited coding experience.

    -Fuske

    @crewockeez

    Participant

    http://selectseek.com/demo/forums/forum/webboard


    @fuskeren
    try it.

    Error : Send an email address is not valid.
    Error : Slow down, you’re working too fast.

    @crewockeez

    Participant

    http://pastebin.com/raw/An3NR6Tt

    file form-anonymous.php in bbpress folder in my theme

    @fuskeren

    Participant

    Hi Crew,

    I have just tried running the code on my own test invironment, and i can see, that the code, does not seems to work.

    I do however not have enough knowhow to help you further.

    I am glad to see, that you got your functions file to work atleast.

    @pigpotato

    Participant

    I fixed it like this.

    1. make css folder in wordpress>wp-content>theme>[mytheme]
    2. cp wordpress>wp-content>plugins>bbpress>templates>default>css>bbpress.css wordpress>wp-content>theme>[mytheme]>css
    3. add these code lines in the css file.
    #bbpress-forums fieldset.bbp-form input[id=bbp_anonymous_email]{ display: none; }
    4. cp wordpress>wp-content>plugins>bbpress>templates>default>bbpress>form-anonymous.php wordpress>wp-content>theme>[mytheme]>bbpress
    5. fix any email address in email textfield. Edit the form-anonymous.php
    <input type=”text” id=”bbp_anonymous_email” value=”guest@guest.com” ….

    @masakawai

    Participant

    I have eliminated the need to enter my email address by doing the following

    
    function bbp_set_default_email( $post_author_email ) {
    	if ( empty( $post_author_email ) ) {
    		$post_author_email = 'anonymous@example.com';
    	}
    	return $post_author_email;
    }
    add_filter( 'bbp_pre_anonymous_post_author_email', 'bbp_set_default_email', 10, 1 );
    
    function bbp_remove_default_email( $r, $args ) {
    	if ( $r['bbp_anonymous_email'] == 'anonymous@example.com' ) {
    		$r['bbp_anonymous_email'] = '';
    	}
    	return $r;
    }
    add_filter( 'bbp_filter_anonymous_post_data', 'bbp_remove_default_email', 10, 2 );
    

    First, use the filter hook “bbp_pre_anonymous_post_author_email” to set the default email address if the email address is blank.
    This avoids the “Invalid email address.” error.

    Second, if the return value “$r[‘bbp_anonymous_email’]” is set to the email address set earlier, return it blank.

    This way, if an email address is entered, its value is returned, if it is blank, it is returned blank.

Viewing 21 replies - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.
Skip to toolbar