Drupal8 : I try to redirect a user to a page if he has already created a node in mytheme.theme, in order to prevent a user to create a node twice :
function mytheme_node_prepare($ node) { if ($ node->bundle() == "my_node") { if (!isset($ node->nid)) { $ existing_nid = db_query("SELECT nid FROM {node} WHERE (type = :type1) AND uid = :uid", array("type1" => "my_node", "uid" => $ node->uid))->fetchField(); if ($ existing_nid != FALSE) { return new TrustedRedirectResponse('/mypage'); } }
this doesn’t work,
thanks for your help
The post Chek if a user has alrady created a node and redirect him to a page appeared first on 100% Private Proxies - Fast, Anonymous, Quality, Unlimited USA Private Proxy!.