{"id":821,"date":"2014-08-02T07:14:30","date_gmt":"2014-08-02T07:14:30","guid":{"rendered":"http:\/\/www.advancedwebhelp.com\/blog\/?p=821"},"modified":"2014-08-02T07:17:29","modified_gmt":"2014-08-02T07:17:29","slug":"drupal-7-menu-token-and-me-alias-are-not-working","status":"publish","type":"post","link":"https:\/\/www.advancedwebhelp.com\/blog\/2014\/drupal-7-menu-token-and-me-alias-are-not-working","title":{"rendered":"Drupal 7: menu token and me Alias are not working"},"content":{"rendered":"<p>Currently, modules Menu Token and me Alias are not working (8\/1\/2014).   There may be a way to get them to work &#8230; each has lots of notes around the internet that indicates they are working on &#038; off, with lots of proposed workarounds.   Trying workaround after workaround, I could not get them to work consistently or conveniently.   Trying to use either, insert tokens in a menu is a problem.  I have a solution.   The solution is not sophisticated or convenient, but, it appears to work consistently.   Hopefully, it will work consistently until the menu token or me Alias modules work consistently.<\/p>\n<p>Unfortunately, the work around requires:<\/p>\n<ul>\n<li>Some familiarity with php<\/li>\n<li>Faking out the menu validation<\/li>\n<li>use of hook_url_outbound_alter<\/li>\n<\/ul>\n<p>To insert the current user_id tokens into the path in a menus:<\/p>\n<ul>\n<li>Step 1: Realize you really want the path &#8220;user\/uid\/history&#8221;<\/li>\n<li>Step 2: Create a basic content page with url of &#8220;user\/uid\/history&#8221; <\/li>\n<li>Step 3: Select the menu you would like to add this entry too, add the menu label, path user\/uid\/history  and save, the entry will be allowed because their is a valid page defined at user\/uid\/history.\n<li>Step 4: Before leaving the menu, check the actual node id that is automatically inserted in place of path you specified (ex. node\/13 might be the real address)<\/li>\n<li>Step 5: In the template.php, create the THEME_url_outbound_alter function as follows:\n<pre><code>\r\n \r\n  function THEME_url_outbound_alter(&$path, &$options, $original_path) {\r\n    if ($path == \"node\/13\") {     \/\/ check $path == \r\n                                  \/\/       the dummy address you created\r\n      global $user;               \/\/ prepare to get the token uid value\r\n                                  \/\/ build the $path with the current \r\n                                  \/\/ user uid \r\n      $path = 'user\/' . $user->uid . \"\/history\" ;\r\n                                  \/\/ Set $options['alias'] = path you \r\n                                  \/\/ want accessed\r\n      $options['alias'] = $path;  \r\n    }\r\n    \/\/ repeat the previous path redefine for all pages you would like\r\n    \/\/ to include the token uid.   Other tokens may be dealt with in \r\n    \/\/ a similar manner. \r\n  \r\n  }   \r\n\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Currently, modules Menu Token and me Alias are not working (8\/1\/2014). There may be a way to get them to work &#8230; each has lots of notes around the internet that indicates they are working on &#038; off, with lots of proposed workarounds. Trying workaround after workaround, I could not get them to work consistently [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,12],"tags":[],"class_list":["post-821","post","type-post","status-publish","format-standard","hentry","category-drupal","category-drupal-modules"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts\/821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/comments?post=821"}],"version-history":[{"count":2,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts\/821\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts\/821\/revisions\/826"}],"wp:attachment":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/media?parent=821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/categories?post=821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/tags?post=821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}