Comments item_action - Use module_name

PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
When the comment's item_action prints "xyz commented on abc's module" it prints the module url.

{jrCore_module_url module=$item.action_data.comment_module}

But I want it to print the module_name. I tried this, but it did not work:

{jrCore_module_name module=$item.action_data.comment_module}

Any suggestions?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

updated by @the-patria-company: 11/21/16 08:06:07AM
michael
@michael
8 years ago
7,715 posts
That question could use a little more info, you're working the abstraction parts of my brain too hard :)

the way {jrCore_module_url} works is you pass it the module name, eg 'jrAudio' and it returns the currently assigned url 'audio' or 'uploaded_audio' or whatever else the admin decided to change it to.

So if you're wanting 'jrAudio' instead of 'audio' then from your example what you want is already there:
{$item.action_data.comment_module}

--edit--
Docs: "{jrCore_module_url}"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/761/jrcore-module-url
updated by @michael: 08/13/16 12:40:44AM
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
I am sorry. I am looking to print out the module_name, specifically "Uploaded Audio" instead of "uploaded_audio" or "Group Discussion" instead of "group_discuss". It is a bit confusing for our members.

Thanks :)


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
michael
@michael
8 years ago
7,715 posts
Ah, the title of the module. to me "module name" meant "jrAudio" "jrVideo", I thought you wanted that.

In the {debug} output there is probably a {$_mods} section with all of the active modules and their data. You can target the 'module_name' from that section by giving it the module name you're getting, eg:
{$_mods.jrAction.module_name}
will output "Timeline" or
{$_mods.jrAudio.module_name}
will output "Uploaded Audio" if thats what its set to in the ACP.

So using this structure, you can pass in the variable that contains your 'jrAudio' and get back the display name for the module.

Try:
{$_mods[$item.action_data.comment_module].module_name}


Related docs:

Docs: "{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/development/1477/debug

Docs: Smarty Docs
http://www.smarty.net/docs/en/index.tpl
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
That created an error. It does not like the "[" and the error log said it was unexpected. Can I use { inside of a { statement?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
I have tried

{$_mods.[$item.action_data.comment_module].module_name}

and the square brackets produce an error as stated above. So I tried:

{$_mods.{$item.action_data.comment_module}.module_name}

Which prints nothing. Any suggestions?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
michael
@michael
8 years ago
7,715 posts
What is the output of {$item.action_data.comment_module}? figure out what that is and hard code it into the other variable:

{$_mods.WHATEVER-IT-OUTPUT.module_name}

What does that output, if it outputs what you want, then the issue is the structure your passing in the variable to get back what you want. If it outputs nothing, then the issue is $_mods isn't available in the location where your working.

Tags