Zasha_82 Posted September 22, 2015 Share Posted September 22, 2015 Hi, Can anyone please help me with the following: The code below is the function to display users created groups on a page. I want to change this to display groups user has joined. Can anyone please help with this? public function userViewSidebarGroups($user) { if ( !$user['total_groups'] || !session::permission('groups_browse', 'groups') && $user['user_id'] != session::item('user_id') ) { return ''; } loader::helper('groups/groups'); echo groups_helper::getGroups(array('user' => $user, 'limit' => 4, 'select_users' => false, 'template' => 'groups/helpers/groups_sidebar')); } Thanks Quote Link to comment Share on other sites More sharing options...
rwhite35 Posted September 22, 2015 Share Posted September 22, 2015 (edited) It looks like you're using a framework and it has a helper method called groups_helper. Does the frameworks groups_helper have a method to do what you want? Also have you var_dumped the $user array? Does $user have some element that id's which group(s) they belong to? Example(pseudocode): //pseudocode $user = array( 'group_id' => array ( 'a_group' => 123, 'b_group' => 456, ), ) Since you're using some framework, you'll need to fully understand that frameworks methods in order to change your code above. Edited September 22, 2015 by rwhite35 Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 22, 2015 Share Posted September 22, 2015 Also- should you have a need to post more code in the future, please try and format it to make it easier to read and comprehend. Your first post is pretty bad reading. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.