[buddypress-trac] [BuddyPress] #4940: bp_is_current_action() not working for groups if using page name other than 'groups'
buddypress-trac
noreply at wordpress.org
Mon Apr 22 21:57:30 UTC 2013
#4940: bp_is_current_action() not working for groups if using page name other than
'groups'
-------------------------------+------------------------------
Reporter: rogercoathup | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version: 1.7
Severity: major | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Comment (by rogercoathup):
@Ray - No, follow is a piece of custom code - not related to those plugins
(which I think are related to following members, not groups)
The test is in an action hooked on 'bp_actions':
function ar_firms_follow_firm_action() {
global $bp;?>
<script type="text/javascript">
console.log( <?php echo $bp->current_component ?> );
console.log( <?php echo $bp->current_action ?> );
</script>
<?php
if ( !bp_is_single_item() || !bp_is_groups_component() ||
!bp_is_current_action( 'follow' ) )
return false;
// Nonce check
if ( !check_admin_referer( 'firms_follow_firm' ) )
return false;
// Skip if already following
if ( !ar_firms_is_following ( $bp->groups->current_group->id,
bp_loggedin_user_id() ) ) {
ar_firms_follow_firm( $bp->groups->current_group->id,
bp_loggedin_user_id() );
bp_core_add_message( __( 'You are now following this
firm', 'architype' ) );
bp_core_redirect( bp_get_group_permalink(
$bp->groups->current_group ) );
}
bp_core_load_template( apply_filters(
'groups_template_group_home', 'groups/single/home' ) );
}
add_action( 'bp_actions', 'ar_firms_follow_firm_action' );
As mentioned in OP -- this works fine if the Groups page is set to
'Groups', but not if set to something else like 'Firms'. Component part
is correct in both cases, but the action part isn't set when the page is
different. i.e.:
http://mysite.com/groups/test-group/follow - the action hook works with
both component and action set correctly
http://mysite.com/firms/test-group/follow - the action hook doesn't work -
the component is set correctly, but not the action
@Boone - there's no new tabs for the follow, just some actions and related
functions / dialogs. Yes, it uses Group_Extension for setting up meta and
some other tabs.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4940#comment:3>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list