How can I remove or rewrite "group/node" and "og_user_node" from url when user click on OG subscribe link ?


Is there any module like pathauto where I can use to make this url a custom look?



Well you know that all these requests are made using hook_menu.

Yes, you should use hook_menu_alter Create new module and add hook_menu_alter

function my_module_menu_alter(&$items) {
    // Unset core path
    $items['your_new_menu_request'] = array(
        'title' => 'OG subscribe',

Just pass the same page callback and arguments as the menu request for og subscribe


Well try this snippet and see if it works, for OG subscribe menu request

Create a custom module. If you do not know how to create a custom module read This

then in your .module file add this code. It should work, I do not know if the 'file' argument needs an absolute path to the file, but if it does not work you just have to change it for the real path in og '../og/og_ui/og_ui.pages.inc'

function my_module_menu_alter(&$items){
  //unset core path
  //as an example (taking the example url you provided) I will call the new menu request community/node/63/sign-in
  $items['community/%/%/sign-in'] = array(
    'type' => MENU_CALLBACK,
    'file' => 'og_ui.pages.inc',
    'page callback' => 'og_ui_subscribe',
    'page arguments' => array(1, 2),
    'access callback' => 'user_is_logged_in',
    'title' => 'Join group'

Greetings hope it helps you, do not forget to mark the answer.

  • Dear Sir, I am new to drupal (even not a coder), so if you give me more details then it help me to solve this problem. please write more if you have time. Thanks. Oct 11 '14 at 16:36
  • which version are you using? of Drupal? and OG ?
    – svelandiag
    Oct 11 '14 at 16:40
  • It is OG 7.x-2.7 and Drupal 7.31 Oct 11 '14 at 16:44
  • check the answer again, I added an edit. Hope it helps you
    – svelandiag
    Oct 11 '14 at 18:21
  • it's not working when I build a custom module for this. It shows error like: public_html//og_ui.pages.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/includes/menu.inc on line 515 But if I change in OG module directly then it's working fine. Now tell me (if you have time) how can I rename "node/" in url? Thanks Oct 12 '14 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.