Format Composite Fieldtype

  • I want to use the first_name members tag again to reformat it to just show their first initial, so I figured using the composite fieldtype would do this, but it seems to ignore the format attribute.

    Is there a better way to do this or can I add the format attribute to the composite fieldtype


    HTML
    1. <perch:members type="text" id="first_name" label="First Name" listing="true" order="1"/>
    2. <perch:members type="composite" id="fullname" for="first_name" format="C:1"/>
  • It is still outputting the full name.


    This is in the templates/members/members.html file

    HTML
    1. <perch:members type="text" id="first_name" label="First name" listing="true" order="1"/>
    2. <perch:members type="text" id="last_name" label="Last name" listing="true" order="2" />
    3. <perch:members type="text" id="header" label="Header Image Path" />
    4. <perch:members type="text" id="profile_picture" label="Profile Picture"/>
    5. <perch:members type="text" id="first_name" format="C:1">


    I'm trying to output it in the sidebar with perch_members_get()


    I still need to store and output the full first name


    PHP
    1. echo '<img src="https://dummyimage.com/400/';
    2. perch_content_custom('Brand Colors', [
    3. 'page'=>'/brand-assets.php',
    4. 'template' => 'color.html',
    5. 'sort' => 'color',
    6. 'sort-order' => 'RAND',
    7. 'count'=>1
    8. ]);
    9. echo'/fff.jpg&text=' . perch_member_get('first_name') . '" width="100%" class="circle_img" alt="">';
  • Ah! Beautiful! Thank you, it didn't even cross my mind!


    Here is what I did, if anyone else runs into this.