inherit
242395
0
Mar 7, 2017 6:17:41 GMT -8
Sixsmith
3
February 2017
sixsmith
|
Post by Sixsmith on Feb 26, 2017 18:41:04 GMT -8
I've been trying to apply custom text fields that can be customised by the user and having them show up as "shortcuts" in say, the header of the forum. Problem is, it doesn't seem to be showing up at all. Could anyone advise on this? {foreach $[current_user.mini_custom_field]}
{if $[current_user.mini_custom_field.name] == "SHORTCUT URL"}
<a href="$[current_user.mini_custom_field.value]">
{foreach $[current_user.mini_custom_field]}
{if $[current_user.mini_custom_field.name] == "SHORTCUT NAME"}
$[current_user.mini_custom_field.value]
{/if}
{/foreach}
</a>
{/if}
{/foreach}
|
|
Kami
Forum Cat
Posts: 40,020
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,020
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Feb 26, 2017 18:48:17 GMT -8
Custom profile fields are not available outside of the 'profile' and 'mini profile' templates; additionally, template variables can only be used in template pages (I'm not sure if you mean 'header' as in 'headers and footers' or 'header' as in 'the top of the forum').
Hopefully this answers your question as to why it's not working?
|
|
inherit
242395
0
Mar 7, 2017 6:17:41 GMT -8
Sixsmith
3
February 2017
sixsmith
|
Post by Sixsmith on Feb 26, 2017 18:52:54 GMT -8
On the contrary, it's apparently possible (under example 1). It works in the forum wrapper if I don't try to nest the variables, but once I try to let users dictate the shortcut name, it doesn't quite work. Would there be any solution around that?
|
|
Kami
Forum Cat
Posts: 40,020
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,020
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Feb 26, 2017 19:01:14 GMT -8
On the contrary, it's apparently possible (under example 1). It works in the forum wrapper if I don't try to nest the variables, but once I try to let users dictate the shortcut name, it doesn't quite work. Would there be any solution around that? Ooh thanks for the info! *files away for later*
Oh, I see what's going on here, sorry, I misread your post entirely -- yeah um, these variables don't actually nest. I know I and another theme creator have made a suggestion to allow for this in v6.
To work around it is kind of hacky, but I wind up wrapping variables around each portion of the HTML, eg:
[variable 1 start] <a href="link"> [/variable 1]
[variable2]
[variable 1 start] </a> [/variable 1]
|
|
inherit
242395
0
Mar 7, 2017 6:17:41 GMT -8
Sixsmith
3
February 2017
sixsmith
|
Post by Sixsmith on Feb 26, 2017 19:17:31 GMT -8
I'm good with hacky if it works! Thanks for the workaround :>
|
|
Kami
Forum Cat
Posts: 40,020
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,020
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Feb 26, 2017 19:35:07 GMT -8
No problem! Try and keep them all with one 'foreach' loop as much as possible -- there's a 25 loop limit i believe.
|
|