Jump to content

Profile fields not visible to those who cannot edit them


notmacknelson

Recommended Posts

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 😄

Link to comment
Share on other sites

{{$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

Link to comment
Share on other sites

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

b299bb36555324553ceb805db47edc49.png

And this is what guests or people who do not have access to fill out the perks see:

fc470ba7406b4ea73c1268fa127f529a.png

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/

 

Link to comment
Share on other sites

7 hours ago, opentype said:

A) I would check the field permissions:

935625320_Bildschirmfoto2019-09-27um08_58_56.thumb.png.14008416a3f5b0b0bc9d2fbda6e4e6e9.png

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

b299bb36555324553ceb805db47edc49.png

And this is what guests or people who do not have access to fill out the perks see:

fc470ba7406b4ea73c1268fa127f529a.png

 

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...