Hi -
I’m trying to limit members to making one gallery entry per day (using the Solspace Gallery Extended Module). Here’s my (il)logic: -
Get the current logged-in member: -
<?php
global $SESS;
$user_id = $SESS->userdata['member_id'];
?>Get the most recent gallery entry from that member: -
{exp:query sql="SELECT * FROM exp_gallery_entries WHERE author_id = '<?php echo $user_id;?>' ORDER BY entry_date DESC LIMIT 1"}Compare the entry date of the most recent gallery entry plus a day to the current time: -
<?php if ('{entry_date format="%U"}+86400' > time ()) { echo "This entry is less than one day old, you can't post another" ; } ?>
{/exp:query}Problem is, it’s not working. I’m guessing this is because I’ve got PHP on input to get the current logged-in member, and the date comparison code needs to be on output. But how to set this up in terms of PHP input/output and embeds is blowing my already frazzled pre-Christmas brain…
...anybody want to be the star on top of my tree?