Jump to content

Silverman

New Members
  • Posts

    6
  • Joined

  • Last visited

Silverman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes, this works if ($field->name == "email" && $user->guest) { continue; } Thank you 😃
  2. What I was trying to say was "When the foreach finds the email inside $c...do this to it...". But you are right, the name is email. And it should be inside the $field variable i guess. Ok, I don't need to remove it. Only not display it. Maybe I can do: if ($this->content,$field == email && $user->guest) {"Put this field inside a CSS class"} And then hide it with CSS? Or is there any better way?
  3. The value (the users email) will always be inside that array. But sometimes I want to show it, sometimes not. Thats why I need some kind of if-statment to remove the users email-field depending on if the user is logged in or not.
  4. I know I need a if-statment. But I don't know how to write this, I'm a beginner with PHP. if ($c "contains field email" && $user->guest) { "remove field email from $c" } Sorry if these are stupid newbie questions.
  5. Yes, only "if the field is email && the user is logged in". The email is required so that will always be there.
  6. I have a foreach loop in a webpage that displays some fields ($c), it looks like this: foreach($this->fDisplay[5] as $field) { $c = $this->field->showFieldValue($this->content,$field); if(($c !== "")&&($c !== null)) { $title = $this->field->showFieldTitle(@$this->content->catid,$field); echo "<span class='f".$field->name."'>"; if ($title != "") echo "<b>".htmlspecialchars($title)."</b>: "; echo "$c<br/>"; echo "</span>"; } Now I want to put a condition on only one of these fields. I want the field "email" only to show if the user is logged in. If the user is not logged in I want this field to be hidden in frontend. (I already have a variable for logged in users) What is the best way to do this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.