Hello,
I'm using signup and webform in conjunction and would like to hide the webform unless the user is signed up for the node but I couldn't find any variables that would let me know if the user is signed up.
Here's what I have so far in my node.tpl.php
<?php global $user; if ($node->signup == 1) { ?><?php if($node->signup_status == 1) {
print "<style> #webform-client-form-$nid{ display: none; }</style>";}
else{ print "";}
?><?php }?>
The above almost works but when the signup_status == 0 then everyone can see the webform, I need help with the else condition. I think I need a condition that will do something like this <?php if (($comment->uid==$user->uid) || ($user->uid == $node->uid)) : ?><?php print "<h1>Yes</h1>"; ?><?php endif; ?>. I used this for comments so that owners of the content could see all the comments and only users could see their own comments. If there was a way to do this for signups I would be all set.
Thank you for building this great module.
Comments
Comment #1
stborchertHi.
$node->signup_statusis an indicator for signups closed/open. E.g. a value of "1" implies signups are possible on this node, a value of "0" implies that signups are closed.If you want to determine the signup status for a user you need a more complex construct:
Add this function into the file template.php.
Now you can check if the user is signed up easily.
Btw.: it would be better to add a class to
<div id="node">instead of inserting a<style>in your node.tpl.php:In your style.css you can now insert
hth,
Stefan
Comment #2
Grimlock commentedStefan! You are the greatest, thanks for your help. I just learned a lot from the code you so generously created for me.
Lee
Comment #3
stborchertmarking this as fixed
Comment #4
shanefjordan commentedBy using the display:none property, the content is still listed in the code, it is just not displayed by the browser. So, when using this make sure it really is not something a particular user should see. For instance, you would not want to use this same logic for the comments that you are referring to. If you did use this, then users would be able to view the source and see all of the comments.
- Shane
Comment #5
Grimlock commentedAh yes thank you for shedding light on this subject Shane, this is a condition that I also was worried about as well. However my troubles are gone thanks to the helpful function Stefan provided. I award users points based on their webform submission and use a cool if condition to make sure they are signed up for the node before any points are given out.
Comment #6
stborchertProbably its best to write a Mini Modul that takes this function and removes the webform with
hook_form_alter().Stefan
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.