Tagged: member type, profile, profile tabs, tabs
Hi Beuza,
Sorry about that. Will certainly have some update today.Thank you
BrajeshHi Beuza,
I am almost done with all my backlogs. I will be able to assist you tomorrow.Regards
BrajeshHi Beuza,
here is the code/** * Remove groups from user profile based on member type. */ function buddydev_remove_group_based_on_member_types() { if ( ! bp_is_user() ) { return; } $user_id = bp_displayed_user_id(); if ( ! bp_has_member_type( $user_id, 'agent' ) ) { bp_core_remove_nav_item( 'groups' ); $access = bp_core_can_edit_settings(); $friends_link = bp_displayed_user_domain()? bp_displayed_user_domain() : bp_loggedin_user_domain(); $friends_link = trailingslashit( $friends_link . bp_get_friends_slug() ); bp_core_new_subnav_item(array( 'name' => __( 'Invitations', 'buddypress' ), 'slug' => 'invites', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'buddydev_groups_screen_group_invites', 'user_has_access' => $access, 'position' => 30 )); // move the invitations to the friends screen. } } add_action( 'bp_setup_nav', 'buddydev_remove_group_based_on_member_types', 1001 ); /** * Helps us detect screen. */ function buddydev_groups_screen_group_invites() { add_action( 'groups_screen_group_invites', 'buddydev_load_invite_template' ); groups_screen_group_invites(); } /** * Load our template. */ function buddydev_load_invite_template() { add_action( 'bp_template_content', function () { bp_get_template_part('members/single/groups/invites'); }); bp_core_load_template('members/single/plugins' ); } /** * Change the invite link url for the non 'agent' users. * * @param string $link original link. * * @return string */ function buddydev_update_group_invite_link( $link ) { // for agent, do not break it. if ( bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) { return $link; } global $groups_template; if ( empty( $group ) ) { $group =& $groups_template->group; } return wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/invites/accept/' . $group->id ), 'groups_reject_invite' ) ; } add_filter( 'bp_get_group_accept_invite_link', 'buddydev_replace_group_to_friends_in_group_invite' ); /** * Change the reject link url for the non 'agent' users. * * @param string $link original link. * * @return string */ function buddydev_update_group_reject_link( $link ) { // for agent, do not break it. if ( bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) { return $link; } global $groups_template; if ( empty( $group ) ) { $group =& $groups_template->group; } return wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/invites/reject/' . $group->id ), 'groups_reject_invite' ) ; } add_filter( 'bp_get_group_reject_invite_link', 'buddydev_replace_group_to_friends_in_group_invite' ); /** * Remove groups from adminbar based on member type. * * @param array $nav nav items. * * @return array */ function buddydev_filter_show_hide_groups_in_adminbar( $nav ) { if ( ! is_user_logged_in() ) { return $nav; } if ( ! bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) { $nav = array(); } return $nav; } add_filter( 'bp_groups_admin_nav', 'buddydev_filter_show_hide_groups_in_adminbar' );
It should work. Can you please give it a try? I haven’t tested it but it should work.
Regards
BrajeshHi Beuza,
It’s strange but quiet possible as we are moving the handlers and all.I was trying to avoid settings up it on local as I will need to recreate the whole thing, so Yes, It will be nice if you can give me an account who has the requests pending.
Regards
Brajesh
You must be logged in to reply to this topic.
This topic is: not resolved