disable email Email (required) config ?
-
disable email Email (required) ?
-
This is in a file called form-anonymous.php :
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %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 thisyou 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
yes. i bbPress will now use this template instead of the original. but test don’t work
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 ); }
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 ); }
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 ); }
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.
can you try the new version please
Where download ?
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 ); }
i try insert new code. not work.
sorry, not sure I can help further !!
I can sent file fuctions theme. Your try ?
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);
@fuskeren good spot !!
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
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.http://pastebin.com/raw/An3NR6Tt
file form-anonymous.php in bbpress folder in my theme
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.
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” ….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.
- You must be logged in to reply to this topic.