Jump to content

PHP Hack - Joomla / AEC / Sobi2


rodz37

Recommended Posts

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.