Question

Hello I am new in cakephp 1.3 and i have problem in if condition.I really need help. I want to post a message for specific user.Only user can open the message according to their course. The admin can view it all but when i log-in as user it doesn't show any message.

Here are my code:

<?php if ($current_user['id'] == $message['Course']['id']): ?>
    <td>
        <?php echo $this->Html->link($message['Course']['course'], array('controller' => 'courses', 'action' => 'view', $message['Course']['id'])); ?>
    </td>
    <td>
        <?php echo $message['Batch']['batch']; ?>
    </td> 
    <td><?php echo $message['Message']['title']; ?>&nbsp;</td>
    <td><?php echo $message['Message']['message']; ?>&nbsp;</td>
    <td><?php echo $message['Message']['created']; ?>&nbsp;</td>
<?php endif; ?>

No correct solution

OTHER TIPS

If you have the user_id column in your courses table, then try to use the following and share the result:

<?php if ($current_user['id'] == $message['Course']['user_id']): ?>
<td>
    <?php echo $this->Html->link($message['Course']['course'], array('controller' => 'courses', 'action' => 'view', $message['Course']['id'])); ?>
</td>
<td>
    <?php echo $message['Batch']['batch']; ?>
</td> 
<td><?php echo $message['Message']['title']; ?>&nbsp;</td>
<td><?php echo $message['Message']['message']; ?>&nbsp;</td>
<td><?php echo $message['Message']['created']; ?>&nbsp;</td>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top