inherit
229600
0
Sept 7, 2022 11:09:51 GMT -8
Ben Goodman
96
February 2016
benhun
|
Post by Ben Goodman on Apr 24, 2017 10:23:02 GMT -8
Hi all!
The title explains what I want, if it is possible. My members would write the color they want their post to apper to field Chat text color, and the code should change it. Any idea how to make this to work?
<font style="{foreach $[user.mini_custom_field]}{if $[user.mini_custom_field.name] == "Chat text color "}color:('$[user.mini_custom_field.value]'){/if}{/foreach}"><span class="message">$[shoutbox_post.message]</span></font>
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on Apr 24, 2017 13:59:20 GMT -8
Hi, Ben Goodman . The easiest way to do this would be to edit the <span class="message"> element with the style attribute. Please also note that you're essentially giving the user access to change what shows in the forum's raw HTML with this modification. Thankfully, since this is for a section where a hex color must be specified you can limit their power to make malicious changes by using the custom field options. In Members > Custom Profile Fields in your admin area click on the (View/Edit) link next to your chat text color field and change its options to look like this: This will make it so that users can only save alphanumeric characters (A-Z, 0-9) as the value of that field. With this limitation in place they can't manipulate the field to include content that's not supposed to be there such as a completely different CSS property.
|
|
inherit
229600
0
Sept 7, 2022 11:09:51 GMT -8
Ben Goodman
96
February 2016
benhun
|
Post by Ben Goodman on Apr 25, 2017 0:59:50 GMT -8
Brian Thanks for the help, works like charm, for me but is it possible to set it visible for every user?Because it is sometimes visible, but sometimes is not. Like on the main page, I only see the colors of mine.
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on Apr 25, 2017 7:50:29 GMT -8
It looks like the custom field variables for that section only load their values when you're logged into the account they're associated with. In that case I'm afraid it wouldn't be possible to use the templates to achieve this modification and have it visible to everyone. On the other hand a plugin could also do this just as easily by using a super user key. I would suggest requesting a plugin here: support.proboards.com/board/36/request-plugin
|
|