#2701 closed defect (bug) (fixed)
BP_Group_Extension - Adding Navigation Item
Reported by: | andrewteg | Owned by: | DJPaul |
---|---|---|---|
Milestone: | 1.2.7 | Priority: | major |
Severity: | Version: | ||
Component: | Core | Keywords: | BP_Group_Extension, nav_item, group extension api |
Cc: | andrewteg |
Description
I have found that group extension api is no longer functioning properly when upgrading to 1.2.6 in regards to creating navigation items for a group. In 1.2.5.2, the sample code to create new group tabs (attached) properly displays "My Group Extension" for all users, even logged out users. However, in 1.2.6, it only shows for an admin user. This is using the sample code from the codex at http://codex.buddypress.org/developer-docs/group-extension-api/ and the referenced loader file "out of the box" without any modification. I first created a forum post today at http://buddypress.org/community/groups/creating-extending/forum/topic/starting-out-with-bp_group_extension/ before I was able to verify it is indeed a bug. Below were my steps to recreate this bug:
Log of Actions
Install WP 3.0.1
Install BP
Change Permalinks
Active BP Default Theme
Active My Plugin (bp_plugin)
Create Group
Create Subscriber Level User
View as admin = OK on both versions!
View as Subscriber = Tab Missing on 1.2.6, OK on 1.2.5.2!
Thanks,
Andrew
Attachments (1)
Change History (7)
#2
@
14 years ago
- Cc andrewteg added
I'm not sure if you take fixes or not, but here is what I believe will fix this bug:
File: bp-groups-classes.php
Class: class BP_Group_Extension (line 1136)
Function: function _register() (line 1183)
Fix: line 1198
Currently: if ( $this->enable_edit_item ) {
Proposed Fix: if ( $this->enable_edit_item && $bp->is_item_admin ) {
You can then remove the true problem lines of 1201-1203 where it returns false if a user is not an item admin. Most users should not be item admins but the default is properly set to enable_edit_item so admins can edit it. I believe this means non admins hit that return on line 1203 so the code to only show the tab to non-admins starting on line 1220 will never fire, making the group extension API non-visible to non-admins. By checking both cases initially it should allow non-admins to just skip that code block and let line 1220 fire based on settings but not have even direct URL admin access to the plugin's admin screen while admins can still view and admin just fine.
Thanks for considering this,
Andrew
#4
@
14 years ago
- Owner set to DJPaul
- Status changed from new to assigned
We love receiving fixes! This is open source development, after all. Thank you very much for the sample plugin to demonstrate the problem.
I have put the two test versions I did online at http://test.andrewteg.com. You can login as admin/admin or test/test to see the issue. You can see the issue demonstrated directly at these links:
No "My Group Extension" tab unless admin/admin @
http://test.andrewteg.com/126/groups/group-one/
Always "My Group Extension" tab @
http://test.andrewteg.com/1252/groups/test-1/
Thanks,
Andrew