I've implemented this module on my site. It's working great, many thanks to the creator's work on this.

My question: I would like to rebrand the word "Achievement" as "Badge" throughout the site. This means URL paths, head titles, page titles, user profile tabs, etc. I'm not sure if there is a great approach to do this:
1. hook_page_alter - I can dive deep into the render arrays, but it would be an absolute mess of string replaces and would be fragile.
2. hook_menu_alter - I can change some titles and tabs, but not the paths, as that breaks the links
3. Patch the module to support this feature in the GUI - If I built this, would you consider such a patch? (I'm thinking the user would enter in a custom name, if they wanted, and that would percolate out into links, paths, page titles, names, etc.)

Am I missing an easier method?

Comments

morbus iff’s picture

Status: Active » Fixed

Sorry for the delay.

URL paths can be handled with path.module (which is part of core). You can specify (via a UI) the paths you want all the achievements/ stuff to be under instead (you'd have to do this for every achievements URL manually). So, you could define achievements/leaderboard to be badges/leaderboard and achievements/comments-50 to be badges/comments-50 instead, etc. They'd still be accessible at the achievements/ URL, but any internal links would be rewritten to the badges version instead. There's another contrib module (whose name I've forgotten, but it's likely findable via an "SEO" keyword) that can force redirects for all the old URLs to the new URLs. The page, head, and user titles/tabs could be done with hook_menu_alter(), yep! I don't necessarily think you'd need to use hook_page_alter() for anything, though - you should be able to get everything else with template overrides, unless I've forgotten something.

I wouldn't be interested in supporting this feature in the GUI, no.

Anonymous’s picture

Here's the module you mentioned:

http://drupal.org/project/globalredirect

jemond’s picture

Hey Morbus - Thanks for the reply.

If I understand correctly you are suggesting creating manual aliases for each badge URL to change it? That isn't very sustainable. Global Redirect would work fine to redirect these in an SEO-friendly manner, but having to set each one up is kind of a pain. What is your concern with this being in the achievements GUI? Just curious.

morbus iff’s picture

Concern: it doesn't fit into the known taxonomy. An achievement is the "parent" term, and an achievement contains properties of title, description, points, image (or badge) and unlock condition. The term "badge" doesn't fit into that taxonomic hierarchy because then you'd have the notion that a badge has a badge (image). A colorized (or visible) badge (image), along with the points, is "merely" the reward you get for unlocking an achievement. "Achievement", in my opinion, is the more common and clear phrasing of this whole concept, given that "badge" can be used for many different things that have nothing to do with achievements (one recent example: https://developers.google.com/+/plugins/badge/).

As for "creating manual aliases", I suspect the effort to do that (even for hundreds of achievements) is far less than the effort required to happily support such a UI renaming feature. You could even automate the process by using hook_achievements_info_alter(), which is called every time the achievement info cache is recreated, and coding the path alias creation there.

jemond’s picture

Morbus - Great idea for creating the aliases. That should work just fine. Thanks!

However, I don't think I was clear about what I was asking. I'm not advocating for the word badge at all, or a drop-down/radio button list where people can select from some preset words. I was suggesting a text field that defaulted to the word achievement where a user could enter in something else.

What about a simple hook that returned an array of
'machine_name' => 'Display name'
that people could invoke to change this? I haven't even checked if this is possible with the module, just an idea.

morbus iff’s picture

Still not really interested :)

morbus iff’s picture

(Incidentally, I couldn't stop you from creating a contrib module that does all the above. If you feel strongly enough, that option exists.)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.