Currently registered users in osclass are identified as either a “user” or a “company” as Association Type. I want to restrict the “Publish” button to only those who are identified as “company”.
The code in user-profile.php is this:
<div class="control-group">
<label class="control-label" for="user_type"><?php _e('Association Type', 'sigma'); ?></label>
<div class="controls">
<?php UserForm::is_company_select(osc_user()); ?>
</div>
</div>
I think the restricted code belongs in the item-post.php file as a qualifier before any other information is entered in this code snippet:
?>
<?php osc_current_web_theme_path('header.php') ; ?>
<?php
if (sigma_default_location_show_as() == 'dropdown') {
ItemForm::location_javascript();
} else {
ItemForm::location_javascript_new();
}
if(osc_images_enabled_at_items()) {
ItemForm::photos_javascript();
}
?>
<div class="form-container form-horizontal">
<div class="resp-wrapper">
<div class="header">
<h1><?php _e('Publish a Listing', 'sigma'); ?></h1>
</div>
<ul id="error_list"></ul>
<form name="item" action="<?php echo osc_base_url(true);?>" method="post" enctype="multipart/form-data" id="item-post">
<fieldset>
<input type="hidden" name="action" value="<?php echo $action; ?>" />
<input type="hidden" name="page" value="item" />
<?php if($edit){ ?>
<input type="hidden" name="id" value="<?php echo osc_item_id();?>" />
<input type="hidden" name="secret" value="<?php echo osc_item_secret();?>" />
<?php } ?>
<?php osc_run_hook('item_publish_top'); ?>
If user is identified as "user" as the Associaton Type then the Publish Listing error flag would be set and the error message will be shown to the user. If the user is identified as a "company" then the item-post.php form would be displayed.
It seems like its a simple if/then code snippet that needs to be added but I am not sure where. Any help is appreciated.