forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: pols1337 on February 18, 2012, 10:02:11 pm

Title: Showing "anycontent.php" to Unregistered Members / Guests
Post by: pols1337 on February 18, 2012, 10:02:11 pm
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
Title: Re: Showing "anycontent.php" to Unregistered Members / Guests
Post by: Joe Carver on February 19, 2012, 11:54:21 am
Try this:

Code: [Select]
<?php
if (!USER_ID) {
  echo 
"YOUR MESSAGE";
}
?>




Title: Re: Showing "anycontent.php" to Unregistered Members / Guests
Post by: pols1337 on February 19, 2012, 10:46:41 pm
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  :-[
Title: Re: Showing "anycontent.php" to Unregistered Members / Guests
Post by: Αndré on February 24, 2012, 04:29:29 pm
Please post the code you added, respectively your whole file content.
Title: Re: Showing "anycontent.php" to Unregistered Members / Guests
Post by: pols1337 on March 11, 2012, 10:27:52 am
Hi Andre,

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

Code: [Select]
</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. 
Title: Re: Showing "anycontent.php" to Unregistered Members / Guests
Post by: Αndré on March 11, 2012, 11:24:29 am
As Joe already described, replace it with the following code:
Code: [Select]
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>';
}
Title: [Resolved] Showing "anycontent.php" to Unregistered Members / Guests
Post by: pols1337 on March 11, 2012, 06:18:36 pm
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:

Code: [Select]
<?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. 
Title: Re: Showing "anycontent.php" to Unregistered Members / Guests
Post by: Αndré on March 11, 2012, 07:24:32 pm
Don't forget to
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.