Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*custom functions to get next/prev group id*/
- //find next group id, return false if current group is last
- function custom_get_next_group_id(){
- //global $group;
- $current_group_id=bp_get_current_profile_group_id();
- //get all the groups
- $groups = BP_XProfile_Group::get( array( 'fetch_fields' => false ) );
- $group_id=false;
- foreach($groups as $group){
- if($group->id>$current_group_id){
- $group_id= $group->id;//this is immediate next group
- break;
- }
- }
- return $group_id;
- }
- //find prev group, 0 if this is first group
- function custom_get_prev_group_id(){
- //global $group;
- $current_group_id=bp_get_current_profile_group_id();
- //get all the groups
- $groups = BP_XProfile_Group::get( array( 'fetch_fields' => false ) );
- //sniff prev group_id
- $group_id=0;//which is non existent
- foreach($groups as $group){
- if($group->id<$current_group_id){
- $group_id= $group->id;//immediate next group is
- continue;
- }
- }
- return $group_id;
- }
- //get the edit link for a group
- function custom_get_group_edit_link($group_id){
- global $bp;
- return $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $group_id;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement