Showing "anycontent.php" to Unregistered Members / Guests Showing "anycontent.php" to Unregistered Members / Guests
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Showing "anycontent.php" to Unregistered Members / Guests

Started by pols1337, February 18, 2012, 10:02:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pols1337

Hi,

I'd like to use "anycontent.php" to show a message only to unregistered members / guests.  Can you suggest a coding for it? 

I've read http://forum.coppermine-gallery.net/index.php/topic,45673.msg217268.html#msg217268 but not sure if it applies, since I'm bridging from SMF2.0

Joel / pols1337

Joe Carver

Try this:

<?php
if (!USER_ID) {
  echo 
"YOUR MESSAGE";
}
?>






pols1337

A more advanced question on how to replace YOUR MESSAGE ...

I'd like to say something like:

Welcome to Gallery!

(paragraph 1)Thank you for visiting.
(paragraph 2)You will need to log-in to send ecards, rate, comment, and download. 



I tried to simply copy and paste my HTML code inside the echo function ... that didn't go over so well  :-[

Αndré

Please post the code you added, respectively your whole file content.

pols1337

Hi Andre,

I would like the following message to only be shown to guests / unregistered visitors (copied from my anycontent.php):

</br>
<center>
<table id="Welcome to UOM Main Gallery" width="90%" border = "0">
<tr>
<td>
<p><center><h3>Welcome to the Main Gallery</h3></center></p>
<p>The UOM Main Gallery contains adult material.  You must read and agree to the <a href="http://universeofmen.com/index.php?action=kb;area=article;cont=71">Adult Warning</a> and <a href="http://universeofmen.com/index.php?action=kb;area=article;cont=70">User Agreement</a> before entering.  <br><br>The UOM Main Gallery is the flagship gallery of <a href="http://universeofmen.com/index.php">UniverseOfMen (UOM)</a>, a free gay website dedicated to showing the very best gay and homoerotic content from around the male universe. You may <a href="http://universeofmen.com/index.php?action=register">Register</a> for free to add comments, rate pictures, search albums, send ecards, and download.</p>
</td>
</tr>
</table>
</center>
</br>


Screenshot is attached. 

Αndré

As Joe already described, replace it with the following code:
if (!USER_ID) {
  echo '</br>
<center>
<table id="Welcome to UOM Main Gallery" width="90%" border = "0">
<tr>
<td>
<p><center><h3>Welcome to the Main Gallery</h3></center></p>
<p>The UOM Main Gallery contains adult material.  You must read and agree to the <a href="http://universeofmen.com/index.php?action=kb;area=article;cont=71">Adult Warning</a> and <a href="http://universeofmen.com/index.php?action=kb;area=article;cont=70">User Agreement</a> before entering.  <br><br>The UOM Main Gallery is the flagship gallery of <a href="http://universeofmen.com/index.php">UniverseOfMen (UOM)</a>, a free gay website dedicated to showing the very best gay and homoerotic content from around the male universe. You may <a href="http://universeofmen.com/index.php?action=register">Register</a> for free to add comments, rate pictures, search albums, send ecards, and download.</p>
</td>
</tr>
</table>
</center>
</br>';
}

pols1337

Resolved -- thanks.

For those of you who might be searching in the future, there are some tweaks to both Andre's and Joe's suggestions:

<?php
if (!USER_ID) {
  echo 
'YOUR MESSAGE';
}
?>


1.  Use single quotations instead of double
2.  Make sure you include the <?php> stuff
3.  If you use the single quotations, don't use apostrophes ' in your HTML or description or you'll get a parse error. 

Αndré

Don't forget to
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.