• Resolved supermurmeli

    (@supermurmeli)


    Is it possible to modify the members list template so that there would be a custom className on a DIV that’s wrapping a certain data field in a members profile card? The class name would need to be based on the option the member has selected on their profile.

    I need it so that I could make a ‘traffic’ light (green,yellow,red) highlight reflecting the member’s availability for work assignments. I used to do it with javascript in the older versions – looked for certain strings of text and when found I would apply the correct className to the parent DIV. It seems the current members list is generated dynamically after the page has loaded and the elements are not a part of the DOM and thus I can’t ‘scrape’ for the strings anymore.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Towhid

    (@cryptex_vinci)

    Hi @supermurmeli

    you can create a child theme then add the data field as your css class name in line 12 of members-grid.php

    https://gist.github.com/cryptexvinci/46a4834b4fedaa67f5cb3d8bf168f211

    Thanks

    • This reply was modified 4 years, 6 months ago by Towhid.
    • This reply was modified 4 years, 6 months ago by Towhid.
    • This reply was modified 4 years, 6 months ago by Towhid.
    • This reply was modified 4 years, 6 months ago by Towhid.
    Thread Starter supermurmeli

    (@supermurmeli)

    Thanks for the reply @cryptex_vinci !

    I have a copy of the the file set up (/mytheme/ultimate-member/templates/members-grid.php) and I tried editing it on line 12 by adding user.mydatafield.

    For some reason it’s not having any effect – adding a class name ‘testclass’ directly doesn’t show up so apparently the members-grid.php in my theme’s templates directory is being ignored. Any idea what I’m doing wrong?

    Thread Starter supermurmeli

    (@supermurmeli)

    Also – I guess this will make the class name same as the chosen value – which in this case would be a pretty long multiword text string. The user sees options like “I’m not able to take new clients” in a dropdown select and this is then shown on the profile card in the members grid.

    I guess I would need more like the selectedIndex value of the select item (or some hidden value attached to the selection) that would generate a more sensible class name. The idea still being that I could hilite available users with a green color and unavailable with red.

    Thread Starter supermurmeli

    (@supermurmeli)

    @cryptex_vinci Ignore the part with the template not working. My bad – I moved the file up from the ‘templates’ as it should be – it works as it’s supposed to.

    Now I just need to figure out a way to clean up those multiword class names into something less messy.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom class name for a wrapping DIV based on selection made in a member profile’ is closed to new replies.