Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
notmacknelson Posted September 24, 2019 Posted September 24, 2019 Hey all, Thanks for reading; just looking for a bit of guidance on how exactly I can solve an issue I'm having. I have custom coded a few custom profile options to be given to those that contribute to the website, using the IPS included Custom Profile Fields functionality. Everything works in terms of the custom options themselves, but the issue I'm having is that only the people who have access to the specific perk themselves can view it. For example, people who are default members and people who are logged out of the site cannot see the custom options. Below I have pasted my current code for custom fonts and colors on the UserLinkFromData template file. {{$member = \IPS\Member::load( $id );}} {{$setting = $member->profileFields();}} {{$profileColor = $setting['core_pfieldgroups_1']['core_pfield_6'];}} {{$profileColor2 = $setting['core_pfieldgroups_1']['core_pfield_7'];}} {{$profileFont = $setting['core_pfieldgroups_1']['core_pfield_15'];}} <style> @keyframes anim{$member->member_id}{ from { color: {$profileColor}; } 50% { color: {$profileColor2}; } to { color: {$profileColor}; } } a[data-uid='{$member->member_id}'], a[data-uid='{$member->member_id}'] span { animation-name: anim{$member->member_id}; animation-duration: 5s; animation-iteration-count: infinite; font-family: {$profileFont}; } </style> Basically, anything using profileFields(); is not visible to anyone except those who have access to edit the perk. Any pointers on how I can fix this? Thanks 😄
Daniel F Posted September 24, 2019 Posted September 24, 2019 {{$member = \IPS\Member::load( $id );}} {{$setting = $member->profileFields();}} Could you clarify what you're trying to achieve? Looking at your code, you're using the CURRENT VISITORS profile field data to generate some custom css code. This means, that guests, but also members which haven't filled out this custom fields OR which have no access to these fields, won't have any data here => no css code
notmacknelson Posted September 24, 2019 Author Posted September 24, 2019 8 hours ago, Daniel F said: Could you clarify what you're trying to achieve? My forum runs perks based on how much you have contributed (donated) to the community. We want those perks to accessible to fill out on a per-group basis (for example, our 6th and 7th tier have access to custom fonts), but visible to all users as well as guests. For a screenshot of the issue: This is what members who have access to fill out the perks see in the UserLinkFromData template And this is what guests or people who do not have access to fill out the perks see: The custom font and colors are a donator perk, but they are only visible to those who can fill out that donator perk. That is not the intended result. We want everyone to be able to view other people's donator perks, but only have access to fill them out if they have donated enough to do so. For full visibility, here is the link to my forums: https://bastionrp.com/forums/
notmacknelson Posted September 27, 2019 Author Posted September 27, 2019 Bump... does anyone have any idea on how to make these profile fields visible to all, not just those who have access?
opentype Posted September 27, 2019 Posted September 27, 2019 A) I would check the field permissions: B) As Daniel already said: it’s not really clear what your custom code does, since you stripped it from the original context. Is the member $id filled properly? It’s impossible to tell from the code sample.
notmacknelson Posted September 27, 2019 Author Posted September 27, 2019 7 hours ago, opentype said: A) I would check the field permissions: B) As Daniel already said: it’s not really clear what your custom code does, since you stripped it from the original context. Is the member $id filled properly? It’s impossible to tell from the code sample. Thanks opentype, A) Show to all is set for both profile and posts for these custom profile fields. B) Forgive me for my explanation, as I'm not extremely well versed in PHP or IPS4 templating; What I am trying to do is make the results of these custom profile fields (a custom font on names and a custom color on names) visible on more than just profiles and posts, but on links as well. I connected it to each individual user's link by using the UserLinkFromData and UserLink templates and writing CSS inside of them that changes per user, based on the ID. As quoted above: Quote This is what members who have access to fill out the perks see in the UserLinkFromData template And this is what guests or people who do not have access to fill out the perks see: As you can see, the people who have access to fill out the custom profile fields in the first image can see the result of their profile field; for example, Cipher and Jimmy both have custom fonts, and CUDA has a custom font and a custom color that overrides the original rank color. These are all filled out via a custom profile field. The second image is from the viewpoint of a guest, or someone who does not have access to the custom profile fields. Here, the custom fonts and colors of all three members are not accessible. All I'm trying to do is figure out how to make the resulting data from an individual user's profile fields input show up to everyone, regardless of a user's ability to fill out that field or not. I hope I have explained it well - apologies if not.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.