Pulling and displaying data from bx_persons_data in its own block.
I'm looking for a way to create a block that can display the contents of a field within the bx_persons_data table.
I have created a new page for user profiles that has one intended purpose and that is to display a very specific profile field the user has filled out to make it easier for fellow users to read, rather than having everything bunched up into the "Info" block.
Can anyone guide me in the right direction?
-
-
·
LeonidS
- ·
Hello @LoneTreeLeaf !
It would be easier to place the same Info block on the necessary page and hide all fewer fields with the CSS / Javascript code.
-
·
LeonidS
-
This is what I'm currently doing, however, it's been very difficult to target each field via CSS as each field doesn't have some field ID that I can select and :nth-child(#) doesn't appear to work when you have multiple of the same field type.
-
For reference, this is what I ended up using, but it also blocks similar field types, so should I add another field type the same as the one I want to display on the specific page, that field will not be hidable.
<style> .character_lore .bx-form-row-view-caption { display: none !important; } .bx-form-row-vc-texte:nth-child(4) { display: none !important; } .bx-form-row-view-wrapper-datepicker .bx-form-row-view-value { display: none !important; } .bx-form-row-view-wrapper-text .bx-form-row-view-value { display: none !important; } .bx-form-row-view-wrapper-select .bx-form-row-view-value { display: none !important; } .bx-form-row-view-wrapper-datetime .bx-form-row-view-value { display: none !important; } </style>
-
A suggestion if I may, have the fields have an ID or className, even if it's just a automatically generated system at random.
I noticed this is done for the Accounts Management page, where each checkbox has the value set to the account ID number, such as the first account having the value of "1" which CAN be selected in CSS via using the attribute targeting method.
The fields displayed in the info section could for example, of the ID or className be referenced by its corresponding field name in the table within the database.
Example:
<div class="character_lore bx-form-row-view-wrapper bx-form-row-view-wrapper-textarea bx-def-padding-sec-top"> <div class="bx-form-row-view-caption"> <span class="bx-form-row-vc-text">Character Lore:</span> </div> <div class="bx-form-row-view-value bx-def-vanilla-html max-w-none"><p>My amazing lore and stuff. :D</p></div> </div>
https://www.w3schools.com/cssref/sel_attribute_value.php
input[value="1"] { color:
#F90; } -
Yes, with the Javascript / JQuery code in the RAW block for certain pages it would be more reliable.
-
Would you have an example that I could use and test with?
-
The JQuery code will look like the following one:
<script>
$("div.bx-form-row-view-wrapper").not(".bx-form-row-view-wrapper-text").hide();
</script>