Skip to main content
8 events
when toggle format what by license comment
May 3, 2020 at 20:27 comment added Jaypan In Drupal, printing often doesn't print to the screen. Try drupal_set_message('Here');.
May 3, 2020 at 20:19 comment added Imogen Johnson I put <?php if ($group == menu_get_object('group')) { print ('true'); } ?>, nothing happened, I checked log it said group not defined, this was on a group page.
May 3, 2020 at 15:13 comment added Jaypan I'm not sure why you think this doesn't work. It only loads $group when menu_get_object('group') returns a group. If you are on a group page, the if() conditional is entered. If you are not on a group page, the if() conditional is not entered. And when on a group page, this will load the group for you, so you don't need to call node_load() after the fact, as menu_get_object('group') will have already returned the group on group pages.
May 3, 2020 at 14:08 vote accept Imogen Johnson
May 3, 2020 at 11:09 comment added Imogen Johnson I managed to do it by checking if menu_get_object('group') is set first.
May 3, 2020 at 10:25 comment added Imogen Johnson Hi, Thanks for replying but this doesn't work and I don't know the syntax to make it work. I think it isn't working because $group has already been loaded as a group, what I want to do is check that the path is a group before loading $group. So I need to get type from menu_get_object and check if it is of type group, if menu_get_object([0]) = 'group', or menu_get_object($type) = 'group'. But I do't know how to structure menu_get_object.
May 1, 2020 at 21:34 history edited berramou CC BY-SA 4.0
added 100 characters in body
May 1, 2020 at 19:18 history answered Jaypan CC BY-SA 4.0