Search Results for 'bpfr_custom_group_default_tab'
-
AuthorSearch Results
-
July 11, 2016 at 8:33 pm #256498
In reply to: How to hide profile menu items from other users
danbp
ParticipantI use that function bpfr_custom_group_default_tab and it works.
Have you replaced the group slug to yours in ‘case’ ? This must fit the exact slug, the one you see by mouse over the group name in the bottom left corner of your brower (and normally in the browser’s address bar).Please ask one question at a time. Make an effort to be clear. It’s difficult to follow your post !
– I want to do this on profile: details, item names…
– I want to do this on groups: details, item names…
NB 1: if you want to change the landing tab for ALL groups, you can use:
define( 'BP_GROUPS_DEFAULT_EXTENSION', 'members' );
With this, all groups will use the group members directory as landing tab instead the group activity.
If you want a different landing tab for each group, use the snippet and don’t use define.NB 2: the tab name has no influence on the landing tab. The name and the slug are handled separately, precisely because of that
NB 3: where you put functions in bp-custom has no importance.
July 11, 2016 at 6:02 pm #256490In reply to: How to hide profile menu items from other users
danbp
ParticipantThe Home tab is the default one. If you remove that tab, BP has no way to know where to output the other group tabs content. If you remove Home(aka activity) you should define another landing tab.
But when you want to modify groups, you shouldn’t define ‘profile’, but ‘groups’. (read what you wrote!)
For the profile landing tab, see this codex page.For groups, you can try this snippet. This let you define a different landing tab for each of your groups (not profile, ok ?).
function bpfr_custom_group_default_tab($default_tab){ /** * class_exists() is recommanded to avoid problems during updates * or when Groups Component is deactivated */ if ( class_exists( 'BP_Group_Extension' ) ) : // $group=groups_get_current_group();//get the current group if(empty($group)) return $default_tab; switch($group->slug){ case 'kill-bill': // group name (use slug format) $default_tab='forum'; break; case 'groupe-2014': $default_tab='members'; break; default: $default_tab='home';// the original default landing tab break; } return $default_tab; endif; // end if ( class_exists( 'BP_Group_Extension' ) ) } add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');
January 11, 2016 at 12:37 am #248587In reply to: Redirect After “Join Group” Continued
ma3ry
ParticipantThis is some code that I got from another page. Is there any chance that you could adapt it?
/* Redirect to Forum after Join Group. */
function bpfr_custom_group_default_tab($default_tab){
/**
* class_exists() is recommanded to avoid problems during updates
* or when Groups Component is deactivated
*/
if ( class_exists( ‘BP_Group_Extension’ ) ) : //$group=groups_get_current_group();//get the current group
if(empty($group))
return $default_tab;switch($group->slug){
case ‘social-group-547668396′: // group name (slug format)
$default_tab=’calendar’;
break;case ‘husbands-out’: // another group
$default_tab=’forum’; // goes on a different tab
break;// case etc, etc…
default:
$default_tab=’home’;// the default landing tab
break;}
return $default_tab;
endif; // class end
}add_filter(‘bp_groups_default_extension’,’bpfr_custom_group_default_tab’);
Sat Jan 9 2016, 9:03:59 PM
(0) ReplyAdd file
April 20, 2015 at 11:11 am #238094danbp
Participantalready solved many times on the forum. Choose from here !
February 5, 2015 at 10:32 pm #233873danbp
ParticipantTry this snippet, which let’s you determine wich tab you will see first when on a group.
function bpfr_custom_group_default_tab($default_tab){ /** * class_exists() is recommanded to avoid problems during updates * or when Groups Component is deactivated */ if ( class_exists( 'BP_Group_Extension' ) ) : // $group=groups_get_current_group();//get the current group if(empty($group)) return $default_tab; switch($group->slug){ case 'kill-bill': // group name (use slug format) $default_tab='forum'; break; case 'titanic': $default_tab='members'; break; default: $default_tab='home';// the original default landing tab break; } return $default_tab; endif; // end if ( class_exists( 'BP_Group_Extension' ) ) } add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');
Comment shane’s function before using this function.
August 20, 2014 at 4:05 pm #187260In reply to: Redirect after "Join Group"
danbp
Participantthis button has two functions: Join group or Leave group and is ajax dependent. So you cannot modify it easily. See /bp-legacy/budypress-functions.php:1157 how it’s done.
The best approach is to modify the landing page when you go on a group. By default, you go to the group home page.
Add this to your child-theme functions.php
function bpfr_custom_group_default_tab($default_tab){ /** * class_exists() is recommanded to avoid problems during updates * or when Groups Component is deactivated */ if ( class_exists( 'BP_Group_Extension' ) ) : // $group=groups_get_current_group();//get the current group if(empty($group)) return $default_tab; switch($group->slug){ case 'XYZ': // group name (slug format) $default_tab='forum'; break; case 'another-group': // another group $default_tab='members'; // goes on a different tab break; // case etc, etc... default: $default_tab='home';// the default landing tab break; } return $default_tab; endif; // class end } add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');
May this help !
July 30, 2014 at 2:53 pm #185759danbp
Participantin other words, you want to change the landing tab when visiting one of these groups.
Each group screen as his own search filter. So if you are on the group forum screen, you see the forum activity filter. When you are on the group members screen, you see the group members search filter. And so on…
So no matter about filtering, if you bring the visitors to the right screen as soon as they arrive on the group, they get the correct filter.
FYI function is theme dependant and bp-custom is completely independant from bp updates and will work even if you change your theme.
Here’s the code you can use (in functions.php or bp-custom.php)function bpfr_custom_group_default_tab($default_tab){ /** * class_exists() is recommanded to avoid problems during updates * or when Groups Component is deactivated */ if ( class_exists( 'BP_Group_Extension' ) ) : // $group=groups_get_current_group();//get the current group if(empty($group)) return $default_tab; switch($group->slug){ case 'Public Events': // group name (slug format) $default_tab='members'; break; case 'Private Investigations': $default_tab='members'; break; case 'another group': $default_tab='admin'; break; default: $default_tab='home';// the original default landing tab break; } return $default_tab; endif; // end if ( class_exists( 'BP_Group_Extension' ) ) } add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');
Add or remove the “case” part into the switch to your needs. Don’t forget to modify the groups name to yours.
July 24, 2014 at 12:06 pm #185514danbp
ParticipantHi @offthepage,
Put this into bp-custom.php or in your child theme functions.php
This is only an example ! Don’t forget to change group names and tabs name to your needs.
Just add/remove a case into the switch for each group you want to modify.function bpfr_custom_group_default_tab($default_tab){ /** * class_exists() is recommanded to avoid problems during updates * or when Groups Component is deactivated */ if ( class_exists( 'BP_Group_Extension' ) ) : // $group=groups_get_current_group();//get the current group if(empty($group)) return $default_tab; switch($group->slug){ case 'kill-bill': // group name (slug format) $default_tab='forum'; break; case 'another-group': $default_tab='members'; break; case 'group-test': $default_tab='admin'; break; default: $default_tab='home';// the original default landing tab break; } return $default_tab; endif; // end if ( class_exists( 'BP_Group_Extension' ) ) } add_filter('bp_groups_default_extension','bpfr_custom_group_default_tab');
-
AuthorSearch Results