2

I'm building a room letting website. Next to every advert is a send user private message button.

If the room is no longer available. I want to replace the button with the message "Sorry room no longer available" how can I do this please?

Many Thanks for your help Charles

0

You can use hook_form_alter. Find your form name and use the code below (form api doc).

function yourmodule_form_alter(&$form, &$form_state, $form_id) {
if($form_id=='your_form_id'){
 hide($form['#submit']);
$form['mymessage']= array(
   '#type' => 'markup',
   '#markup' => 'sorry , no one available in room',
   '#weight' => 0,
);
}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.