Jump to content
WebFlake
  • 0

Calling Custom Field in Theme


TomDoesDownloads

Question

Hi

 

I'm trying too make it so my users can have custom profile background if they're in a certain group. This is the code I have so far:

{{if $member->inGroup(48) or  $member->inGroup(49)}}
<style>
  body {
    background: url() no-repeat left center fixed;
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
    background-size: cover;
    background-color: #22252A;
  }
  </style>
{{endif}}

How Would I call the Custom Field (called VIPBackground) to go in the url() part

 

Thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

This is the code I pulled from the custom fields template;

{{foreach $author->contentProfileFields() as $group => $fields}}
	{{foreach $fields as $field => $value}}
	<li class='ipsResponsive_hidePhone ipsType_break'>
		{$value|raw}
	</li>
	{{endforeach}}
{{endforeach}}

 

  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0
1 hour ago, Testmyluck said:

This is the code I pulled from the custom fields template;


{{foreach $author->contentProfileFields() as $group => $fields}}
	{{foreach $fields as $field => $value}}
	<li class='ipsResponsive_hidePhone ipsType_break'>
		{$value|raw}
	</li>
	{{endforeach}}
{{endforeach}}

 

Thanks! I Adapted this into this and it works perfectly:

 

{{if $member->inGroup(48) or  $member->inGroup(49)}}
<style>
  body {
    background: url({{foreach $sidebarFields as $group => $fields}}
{{foreach $fields as $field => $value}}
      {{if $field != "core_pfield_6"}}
      {{else}}
{$value|raw}
      {{endif}}
{{endforeach}}
{{endforeach}}) no-repeat left center fixed;
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
    background-size: cover;
    background-color: #22252A;
  }
  </style>
{{endif}}

(The New If makes sure the Loop only outputs the URL Field)

  • Upvote 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...