rodz37 Posted December 3, 2009 Share Posted December 3, 2009 I have this code which now works in native mode on joomla 1.5 The purpose of this is to pull a user level from AEC and control Sobi2 entry form page when the owner is logged in. This only works for backend logged in users so they edit a form and fields are turned on or off based on their level. So i start by adding this code to the top of my form. <?php // AEC Hack - Setting for subscription fields on and off $db =& JFactory::getDBO(); $query = "SELECT `plan` FROM #__acctexp_subscr WHERE `userid` = {$mySobi->owner}"; $db->setQuery( $query ); $member = $db->loadResult(); $valid = ($member == "1" || $member == "2" || $member == "3" || $member == "4" || $member == "6" || $member == "7" ? 0 : 1); define( "valid_add_paid", $valid); ?> Then i add this code to turn on and off a field based on the user level <?php if ($valid == 0) {echo $fields['field_phone']['field']; } else { echo "You must be a paid member to add your Phone Number.";}?> I need to mod this code to work for site visitors so it does the same but for site visitors viewing a details page (frontend) it turns fields on and off based on the level of the sobi2 owner which is controlled by AEC. I need to base the viewed content on the creators AEC level. The question is how to control the Display template based on AEC levels AND how to make Entries created at one AEC level available to others who could be at various levels. So i want to control this field public front end <a href="<?php echo $fieldsObjects['field_website']->data; ?>" rel="nofollow"> <?php if ($fieldsObjects['field_website']->data) { ?><img alt="Business Website" border="0" src="http://www.mywebsite.com/images/homepage.png" /> <?php } ?> Rod Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.