Forum Replies Created
-
Mr A BParticipant# 1 year, 1 month ago
Thank you for your help. I now have the following code that works well inside my customer-account pages and displayes all the groups a customer is in. Where can I add this code to work accross the entire Customer Area and to add a bodyclass?
$current_user = $this->get_current_user(); // Get the managed-groups and user-group add-on to access required functions $mg_addon = cuar_addon('managed-groups'); $gp_addon = cuar_addon('user-group'); // The current user ID $user_ID = $current_user->ID; // Get an array of group IDs belonging to that user $managedGroups = $mg_addon->get_groups_of_user($user_ID); $userGroups = $gp_addon->get_groups_of_user($user_ID); // get the group name from each ID foreach ( $managedGroups as $managedGroup ) { $groupClasses .= str_replace(' ', '', strtolower($managedGroup->post_title)) . ' '; } foreach ( $userGroups as $userGroup ) { $groupClasses .= str_replace(' ', '', strtolower($userGroup->post_title)) . ' '; } echo $groupClasses;
Viewing 2 posts - 1 through 2 (of 2 total)