Last updated October 18, 2011. Created by John Morahan on January 22, 2006.
Edited by MGParisi, ronald_istos, Dublin Drupaller. Log in to edit this page.
PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.
Description
This php snippet illustrates how to use custom User Profile checkbox Fields.
Dependencies: profile.module
Usage
- For use in your user profile page override
- Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
- In the example snippet we used a custom checkbox for "Click if you're a MAC user" and called the form name
profile_mac - Tested and works with Drupal 4.5 and 4.6
- Change the div class names or the prefix text to suit.
<div class="fields">
<?php if ($account->profile_mac == '1') {print "I use a mac" ;}; ?>
<?php if ($account->profile_mac == '0') {print "I do not use a mac" ;}; ?>
</div>