I have such problem. I have a list about courses that I'm signed up
If I'm signed up I get a value "jesteś już zapisany" I would like that if I'm not signed up I get a path to sign up button
In a table "registration" I have columns "user_uid" which I would like to compare with logged in user and entity_id which I would like to compare with $data->nid
<?php
global $user;
$uid=$user->uid;
$result = db_query('SELECT n.entity_id, n.user_uid
FROM {registration} n WHERE n.user_uid = :uid', array(':uid' => $uid));
foreach ($result as $record) {
if (($record->user_uid==$uid) AND ($record->entity_id==$data->nid) ){
echo "jesteś już zapisany";
}
elseif (($record->user_uid!=$uid))
{
$path=drupal_get_path_alias('node/'.$data->nid);
echo $path;
}
}
?>
Aucun commentaire:
Enregistrer un commentaire