How to remove code for "Welcome to your new Drupal website!"
Chi Loop - August 18, 2007 - 14:01
I searched the forum and didn't find a direct answer for this.
I would like to remove the welcome message without promoting anything to the home page. I wouldn't like to install views or use front_page or any other module. I would just like to know where can i comment out or remove the code (probably if condition) that causes drupal to display this message.
Thanks

Create any type of content,
Create any type of content, then go to Administer > Site configuration > Site information, and set the front page to "node/1".
defaulted..
That content is hardcoded in node.module when there's no any promoted node. IF you don't want to promote, than you will have to edit the node.module file.
Thanks. It works. Details on function node_page_default()
Thanks Ilo. It worked!
For the rest who might ever face this problem with what part is to be edited, open node.module and search for the function node_page_default().
I replaced:
/**
* Menu callback; Generate a listing of promoted nodes.
*/
function node_page_default() {
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
if (db_num_rows($result)) {
$feed_url = url('rss.xml', NULL, NULL, TRUE);
drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') .' '. t('RSS'));
$output = '';
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
}
else {
// Check for existence of admin account.
$admin = db_result(db_query('SELECT uid FROM {users} WHERE uid = 1'));
$default_message = t('<h1 class="title">Welcome to your new Drupal website!</h1><p>Please follow these steps to set up and start using your website:</p>');
$default_message .= '<ol>';
if (!$admin) {
$default_message .= '<li>'. t('<strong>Create your administrator account</strong> To begin, <a href="@register">create the first account</a>. This account will have full administration rights and will allow you to configure your website.', array('@register' => url('user/register'))) .'</li>';
}
$default_message .= '<li>'. t('<strong>Configure your website</strong> Once logged in, visit the <a href="@admin">administration section</a>, where you can <a href="@config">customize and configure</a> all aspects of your website.', array('@admin' => url('admin'), '@config' => url('admin/settings'))) .'</li>';
$default_message .= '<li>'. t('<strong>Enable additional functionality</strong> Next, visit the <a href="@modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="@download_modules">Drupal modules download section</a>.', array('@modules' => url('admin/build/modules'), '@download_modules' => 'http://drupal.org/project/modules')) .'</li>';
$default_message .= '<li>'. t('<strong>Customize your website design</strong> To change the "look and feel" of your website, visit the <a href="@themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="@download_themes">Drupal themes download section</a>.', array('@themes' => url('admin/build/themes'), '@download_themes' => 'http://drupal.org/project/themes')) .'</li>';
$default_message .= '<li>'. t('<strong>Start posting content</strong> Finally, you can <a href="@content">create content</a> for your website. This message will disappear once you have promoted a post to the front page.', array('@content' => url('node/add'))) .'</li>';
$default_message .= '</ol>';
$default_message .= '<p>'. t('For more information, please refer to the <a href="@help">help section</a>, or the <a href="@handbook">online Drupal handbooks</a>. You may also post at the <a href="@forum">Drupal forum</a>, or view the wide range of <a href="@support">other support options</a> available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) .'</p>';
$output = '<div id="first-time">'. $default_message .'</div>';
}
drupal_set_title('');
return $output;
}
with
/**
* Menu callback; Generate a listing of promoted nodes.
*/
function node_page_default() {
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
if (db_num_rows($result)) {
$feed_url = url('rss.xml', NULL, NULL, TRUE);
drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') .' '. t('RSS'));
$output = '';
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
}
else {
// Check for existence of admin account.
$admin = db_result(db_query('SELECT uid FROM {users} WHERE uid = 1'));
/**
* $default_message = t('<h1 class="title">Welcome to your new Drupal website!</h1><p>Please follow these steps to set up and start using your website:</p>');
$default_message .= '<ol>';
if (!$admin) {
$default_message .= '<li>'. t('<strong>Create your administrator account</strong> To begin, <a href="@register">create the first account</a>. This account will have full administration rights and will allow you to configure your website.', array('@register' => url('user/register'))) .'</li>';
}
$default_message .= '<li>'. t('<strong>Configure your website</strong> Once logged in, visit the <a href="@admin">administration section</a>, where you can <a href="@config">customize and configure</a> all aspects of your website.', array('@admin' => url('admin'), '@config' => url('admin/settings'))) .'</li>';
$default_message .= '<li>'. t('<strong>Enable additional functionality</strong> Next, visit the <a href="@modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="@download_modules">Drupal modules download section</a>.', array('@modules' => url('admin/build/modules'), '@download_modules' => 'http://drupal.org/project/modules')) .'</li>';
$default_message .= '<li>'. t('<strong>Customize your website design</strong> To change the "look and feel" of your website, visit the <a href="@themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="@download_themes">Drupal themes download section</a>.', array('@themes' => url('admin/build/themes'), '@download_themes' => 'http://drupal.org/project/themes')) .'</li>';
$default_message .= '<li>'. t('<strong>Start posting content</strong> Finally, you can <a href="@content">create content</a> for your website. This message will disappear once you have promoted a post to the front page.', array('@content' => url('node/add'))) .'</li>';
$default_message .= '</ol>';
$default_message .= '<p>'. t('For more information, please refer to the <a href="@help">help section</a>, or the <a href="@handbook">online Drupal handbooks</a>. You may also post at the <a href="@forum">Drupal forum</a>, or view the wide range of <a href="@support">other support options</a> available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) .'</p>';
*/
$output = '<div id="first-time">'. $default_message .'</div>';
}
drupal_set_title('');
return $output;
}
Maybe there is a better way to comment this code out or something, if so, do reply telling how to do so for the benefit of all. This worked for me. Cheers (and thanks Ilo)
for setups where..
you can't modify the code, and don't want to promote a node to the front page, there's also another option when the locale module is enabled. You may translate the text of this page to empty strings, so when it gets rendered you can show a blank page when a user reaches the default page.
don't need to go comment out all this, just set this
in "node.module" line 1751
"$output = ' ';
$num_rows = false < == change this to "true"
the default message will be gone for good but again, everytime you upgrade your core you need to edit this portion.
cheers,
s
It works.
Hello,
Changing the value from false to true works for me. However, this modification should be rolled-back whenever I am doing an in-place upgrade.
Thank you.
---
I'm a code junkie security enthusiast
- http://pronco.manalaa.net
Got module errors...
Hi, Chi Loop
I tried this, and ended up with:
Parse error: syntax error, unexpected T_CASE in /var/www/domains/medianewday.com/docs/modules/node/node.module on line 78
Fatal error: Call to undefined function node_get_types() in /var/www/domains/medianewday.com/docs/includes/theme.inc on line 923
where could I've gone wrong?
cheers
easy.
What you are doing wrong is hacking core.
Don't do that unless you are a PHP expert.
And a PHP expert would know that you don't hack core.
The suggested change here is BAD and also quite probably out-of-date with the current version of Drupal.
.dan.
Don't modify core files for
Don't modify core files for something so trivial, every time you upgrade you will have to make the change again. The more you hack core files the harder it will be to upgrade and apply patches.
If you don't want to have a front page list of nodes, then change the front page to "node/1" (or any node you like) instead of "node". This will make your front page use an existing node you've created instead of showing a list of nodes (or the welcome text).
If you do want to promote nodes to the front page then the welcome text will be replaced as soon as you promote your first node.
...
The contrib module front page can also help with this.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
Thanks. Makes sense
I didn't think of that Rowanw. It makes absolute sense. I'm going to uncomment the changes in node.module and change the front page to node/x as you say and also check out the front_page module.
Hmm...
Then why do I have a site where one role is getting the "Welcome to your new Drupal site!" even when there are 3 nodes promoted and showing first? This does not happen on the user/1 account, or other roles, just the role for the board of directors.
One strange thing I see is that I have the post settings set to display up to 10 nodes on the front page. There are only 3 promoted at the moment. The default "Welcome" page is showing as page 2. Could this be a pager_query or db_rewrite_sql bug?
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
possibly?
if the users still getting the default text don't have access clearance to the promoted nodes that could be why. i think. maybe.
Indeed
I got around this by deleting the entries in node_access and adding them to the "all" realm. The problem went away after that. However, if anyone ever comes back in and rebuilds permissions, it will have to be done again.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
As today, I'm still
As today, I'm still experiencing this problem (Drupal 5.2).
I've been using the CCK and Views modules to setup my site. Three blocks appear on the frontpage but the welcome message is still there.
Things I've done:
- Checked whether anonymous users have permissions to access content.
- Cleaned up the node_access table (as described at http://drupal.org/node/64114).
But none of these things work.
Some side questions:
- Why should I promote a node to the frontpage if all my content is organised in blocks?
Thanks for any help.
=-=
seems to me, that instead of orgainizing your content in sidebar blocks, you should use the panels.module so that you can add blocks to the content area ?
a bit of a trick would be to create a node, with a 1x1 pixel image on the node, and setting this node to be the home page in administer -> site information, doing so will put a node on the front page that is essentially blank and as such will allow you to run your blocks in side bars without promoting anything to the front page.
See above
That's a good tip, VM.
If you read my post above, you'll see that, in my case, there are three nodes promoted and I still get the welcome page for one role. Any ideas?
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
=-=
My first guess would be the node access table being out of whack. Though I know you are drupalized enough to have checked that, so mentioning it seems fruitless. I"ve never seen a situation in my own installs where the problem was for a "role" other then anon. Will keep your problem rolling around my mind for a bit and see if I can think of something while waiting for todays NFL games to begin.
E-A-G-L-E-S .... EAGLES!
Yes, I checked it
Yes, I checked it and it looks okay to me. I have been to chicken, though, to rebuild permissions. I guess I need to get over that.
The Sitedoc access check says everything is reasonable, but I have to believe that it is something like you say.
This is certainly a first for me. I've never seen this happen for any roles once I built a front page. But it's also the first time I've used Taxonomy Access Control too.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
=-=
And I assume you have combed over the TAC settings ?
Yes
Yes, I have, although I can't see any reason why they would cause this. I've also gone through the node module code and can't see how this could even happen.
I did just now rebuild permissions and it makes no difference.
It's almost acting like the node module is getting called twice; the first time correctly building the front page, then the second time creating the Welcome page. But that doesn't make sense either. And yes, I did stick some debugging code into the node module but it hasn't shed any real light on the problem.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
Same Here
I have the same problem Nancy. This never happened before. This is also the first time I used the Taxonomy Access module. Something must have happened when the install modified the database. If you come up with some kind of answer, please let us know.
I'm not running the Taxonomy
I'm not running the Taxonomy Access module and I'm also having this problem. So I think you can't blame this module.
Yesterday, I did a fresh Drupal 5.2 install and installed the following modules:
- CCK
- Link
- Pathauto
- Token
- Views
- Imagefield
- Feedburner
- Flickr
- Google Analytics
- Keys_api
But I'm sure Feedburner, Flickr, Google Analytics and Keys_api have nothing to do with it because I had the problem before installing these modules.
Hmm...
The site I'm having this on is a fairly simple one. The only common module I can see is Views.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
It's just because there are
It's just because there are no nodes promoted to the frontpage.
Once you promote a node, it's solved. You could create a simple content type (with only a title, which is required) and insert one piece of content which you promote. Then with CSS or a custom template you could hide this node. Ugly solution, but it works.
I'm still waiting for a better solution...
Not for me
All of my sites have something promoted to the front page. This one having the problem has three nodes promoted. They show as one would expect, but then it shows the pager, and the welcome page is page 2.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
Already Promoted
I already promoted three stories to the front page and users with authenticated or anonymous roles still see the default welcome page. Administrative roles have no problem seeing the promoted content in the front page. The problem is somehow related to users within certain roles only, even when they have access to content.
Still no answer to this
Still no answer to this issue... And it seems many people deal with it...
To be honest I'm a bit disappointed in the Drupal support on this forum. I know I can't blame anyone, but I wonder why it's so hard to get quick and appropriate answers to your questions.
=-=
@ bc173: With regards to your idea of a better solution ? have you tried the frontpage.module? There is a specific reason that the drupal welcome message is in place. Especially for new users. Because it isn't a page, it can't just be shut off. You must work around it using one of the methods outlined in the handbook ( http://drupal.org/node/140751 ) and in this thread. You've even coughed up one of your own. Though, I don't see why you would need a custom content type, you could simply add a node as the default front page in administer -> site settings -> default front page. then use css to hide the node title. This is a known method and it works quite well without alot of fuss and one css declaration addition.
Keep in mind too: The forums are volunteer, you have alternative ways to gain answers, including but not limited to hiring a consultant and jumping into the IRC support channel. Being "disappointed" in people who are trying to help simply because they haven't provided an answer "you like" doesn't necessarily mean you didn't get an answer.
Well...
VM, I think you know I know about these solutions. I've never had this problem before, but I am now. This is the first site I've done that uses TAC and the problem is only showing up for one role, even though the front page is open to everyone, including anonymous users. I don't see anything in the TAC settings that looks unusual. The fact that it is being put on a second page even though the first page is not totally full baffles me.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
=-=
I know. I wasn't addressing your situtation. Try as I may, I can't reproduce your situation either, Though I have not gone as far as to install TAC on any sites to try and reproduce. By chance have you tried to reproduce on a test installation replicating the site you are having a problem with?
This thread seems to have gone in two totally seperate directions with two different issues from what I can tell. Those who just don't want the Drupal welcome page, or want to avoid it without promoting nodes to the front page and those who are getting the welcome page when they shouldn't be as you are.
:-)
No, since I don't own the site, it is difficult for me to get a backup to load into a test site. And it's too big to try to cut and paste. If I get a few spare minutes, I may try to reproduce just the front page and TAC settings.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
=-=
: ) I meant just a test site, not a complete duplicate just another site (test) with TAC. Could be something elusive with that module.
Another thing that has just crossed my mind, the role that is problematic, what if you edited/altered the name of that role? problem still there?
Not yet
No, I haven't tried changing the name. I'll try to do that today. Maybe I can set up a test site with just the front page.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
wow..
-----
To be honest I'm a bit disappointed in the Drupal support on this forum. I know I can't blame anyone, but I wonder why it's so hard to get quick and appropriate answers to your questions.
------
I'm impressed with this kind of answer. After several replies telling about how to remove the front page information, you still claim there's no help in the forums..
Let's start again, if you want.. Here's my help, start a new fresh drupal setup, untill you recongnize wich of the modules is breaking the permissions, and then maybe we can add a workaround, but I guess it's impossible from your post situation with several modules and I guess some configuration settings yo give a solution, neither more help than what was done. Even if we decided to try to reproduce to really understand where the problem is, we still don't know what your configuration is, so we can reach another errors instead of helping you.
Anyway, the main purpose of the initial page, the front page, is to show a welcome message for a blank content view. If you have set your content in blocks or categories, what do you expect to appear in a front page? and how do you expect drupal deals with that? You are telling not to promote a node as they are categorized, then.. what must be shown in the front page of your site?
I wonder why some people forgets to thank the others effort, You have turned crazy to MisUnderstood but haven't said any word about spending his time with you. I could be a bit dissapointed also with some people comming to drupal and requesting help withouth first doing a search in the site, but I would never say a word about it :)
(Better if I stop before looking like a trol.. :D )
See my solution above
UPDATE node_access SET gid=0, realm='all' WHERE nid IN (3, 4, 5) AND gid=1;DELETE FROM node_access WHERE nid IN (3, 4, 5) AND gid>1;
Nodes 3, 4, and 5 are my promoted nodes.
@bc173: A big part of this is because of the wide variety of ways in which a site may be implemented with Drupal. I'm fairly certain this is a case of shooting myself in the foot (with TAC), but I have no idea where the trigger is.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
Theme page-front.tpl.php
Just create a custom front page for your theme. Create file 'page-front.tpl.php' in your theme directory with the code to generate your desired output. Easiest way is to copy 'page.tpl.php' and remove code that generates the welcome text.
If you are using the
If you are using the PHPTemplate engine.
subscribing
subscribing
Creating page-front.tpl.php
Creating page-front.tpl.php alone did not remove the welcome message, I had to remove:
<div id="content-area"><?php print $content; ?>
</div>
...and just use my own regions. Not sure how else to do it, I couldn't figure out where the welcome message was coming from, it's not in page-front.tpl.php.
Laura
[[http://twitter.com/robeson|Twitter]] - [[http://www.linkedin.com/in/robeson|LinkedIn]]
Node
It usually comes from node.module.
NancyDru
I did this and it seems to
I did this and it seems to work, Drupal 5.2, PHP5
create a node with php code
<?phpheader("Location: ?q=node/1");
?>
Make it so that it is promoted to the front page, so when Drupal calls that it redirects to another page without the visitor even noticing.
careful
Drupal has a replacement for teh header function because it's possible to confuse Drupal with that.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
my private hack 4 this W.
I have had the same problem with this additional "Welcome" data.
It occured only with user defined roles.
In page: Administer > Site information [admin/settings/site-information]
I have changed: "Default front page:"
from: "node"
to: "frontpage"
This View can be found in: Administer > Views [admin/build/views]
(...if you are using Views, but propably you do...)
Hope this helps.
veriKami
(dziewczynka w organizacji)
Great fix!!
Thanks for posting this.
So simple yet so powerful.
The only requirement is that you have to have the Views module which I do and it was so easy.
Thanks again.
Hi,I had the same problem.
Hi,
I had the same problem. I found a better way to do without change code. Here is how I did
I create a story (you might want to try page that's fine) and check it to appear on the frontpage. Now the welcome page is gone but only thing I stucked on the frontpage is the story/page. Hope you understand what I said.
bye bye
yaskme
if you know you're not going
if you know you're not going to use promoted content on your frontpage (b/c you're using only views, or whatever reason), go to page.tpl.php and replace
<?phpprint $content;
?>
with
<?phpif(!$is_front) print $content;
?>
community manager @ postcrossing.com