BP_DISABLE_AUTO_GROUP_JOIN is part of BuddyPress core. It ought to work.
thats the only line i put into the bp-custom.php file. does that affect anything? and im pretty sure i put the bp-custom file in the right place.
== adding the line: define(‘BP_DISABLE_AUTO_GROUP_JOIN’,true); – but that doesnt work either. in fact that line replaces the admin bar at the top of my site. ==
@tommyhoang Your bp-custom.php should contain not only that line but also the opening and closing tags.
`<?php
define(‘BP_DISABLE_AUTO_GROUP_JOIN’,true);
?>`
bp-custom.php should be uploaded in plugins folder => wp-content/plugins/bp-custom.php
@mercime, thanks for the help. although when i post as a test user, i don’t automatically join the group. BUT the phrase “You will auto join this group when you reply to this topic.” still appears.
any tips on getting rid of that?
@tommyhoang you can remove that line from the relevant file in your child theme, probably something like groups> forum> single.php although you’ll need to check that file name
awesome suggestion ewebber. i found that line in the file forum.php located in bp-default/groups/single/. i made a copy of the folders and file into my child theme: childtheme/groups/single/forum.php. and i deleted the line “You will auto join when you create a new topic”.
my users now don’t auto join when creating a new topic and the message is no longer there. HOWever, my users still auto join to the group when replying to a topic, and the message “You will auto join this group when you reply to this topic” is still there and it still works.
i thought the custom.php command would disable both of them. but apparently it only disabled the new topic auto join and not the new post auto join.
thanks for the help btw @ewebber
@tommyhoang use language file to change the text or add this to your functions.php file
`class Tommys_Translation_Mangler {
function filter_gettext($translation, $text, $domain) {
$translations = &get_translations_for_domain( $domain );
if ( $text == ‘You will auto join this group when you reply to this topic.’ ) {
return $translations->translate( ‘Feel free to reply.’ );
}
return $translation;
}
}
add_filter(‘gettext’, array(‘Tommys_Translation_Mangler’, ‘filter_gettext’), 10, 4);`
Reference: http://blog.ftwr.co.uk/archives/2010/01/02/mangling-strings-for-fun-and-profit/
@mercime, yeah im not sure what thats suppose to do. but as soon as i log out of admin, i get a bunch of error messages saying cannot modify header etc.
im still trying to disable the autojoin function. the code define(‘BP_DISABLE_AUTO_GROUP_JOIN’,true);
only disables the autojoin when starting a new topic. the autojoin for post reply is still active.
@tommyhoang “headers already sent error” usually means that there’s space before the opening “ tags required in functions.php just like it is in bp-custom.php
What the code above does is to replace the text string “You will auto join this group when you start a new topic.” to something else like ‘Feel free to reply.’ You could also leave the replacement text as blank by not adding text and just space between ‘ ‘
@mercime, but it doesnt change the fact that my members are still autojoining the group when they reply to a post. the original code only disables the autojoin when starting a new topic.
HOLY SMOKES! i figured it out, the bp-custom.php file mustve been corrupted because i deleted and simply tried to replace the code. and now it works!!!
thanks for all the help @mercime!!!!
@tommyhoang what did you do to get this working? I’ve got bp-custom.php in place but it doesn’t seem to be doing anything. I just created the file using my ftp client. Is there a particular way I need to add the file in order for BuddyPress to recognize it?
I’ve done some more testing and it looks like the super admin for the blog can post to groups without becoming a member but no one else can. As soon as I use a test account to post to a forum that account gets auto added to the group.
It seems like a major assumption on BuddyPress’ part that people will always want to auto join groups….why didn’t they even think to make this an option?
Is this method deprecated? I can’t find the constant BP_DISABLE_AUTO_GROUP_JOIN mentioned anywhere in the buddy press core…
Went into the plugin code and found the lines relevant to auto joining (lines 29-30 of bp-forums-screens.php and I don’t see anything regarding BP_DISABLE_AUTO_GROUP_JOIN so I’m guessing it was removed some time in the last 11 months. I commented out those two lines and my test users no longer auto join when posting new topics or replying. I realize I may have to redo this if BuddyPress gets updated in the future…