Drupal Answers Asked by Leopathu on December 17, 2021
I have some more custom url with og group id like
www.example.com/book-listing/5367/6953
here 6953 is a group id.
these are the sample link. my questions is how to get the group id from url? And i can’t use arg(). because i have more no of url and group id position also varied.
There is any robust solutions for this.
I have used the following code in hook_preprocess_page() to solve this issue.
$url = current_path();
$arguments = explode('/', $url);
foreach ($arguments as $value) {
if (is_numeric($value)) {
$node = node_load($value);
if (og_is_group('node', $node)) {
drupal_set_message('group id :' . $node->nid);
}
}
}
From now, i can set to group member only could see this page.
Answered by Leopathu on December 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP