Every drupal developer knows about drush and drush commands. If mistakenly you installed some broken drupal theme and you are not able to access site then you need change the drupal theme using drush command.
disable drupal theme using drush, Every drupal developer knows about drush and drush commands. If mistakenly you installed some broken drupal theme
disable drupal theme using drush
#drush vset theme_default seven
Using above command you can set the seven theme as default drupal theme. It will disable the your activated old theme.
Every Drupal developer knows about drush. If you did not installed drush then use the following article for installing drush. Here in this article I am going explain you about install drupal empty project in only two steps.
For setup the empty drupal project setup use following command
#drush site-install standard –account-name=admin –account-pass=admin –db-url=mysql://mydbusername:’pass@123’@localhost/mydbname
You are about to create a sites/default/files directory and create a sites/default/settings.php file and DROP all tables in your ‘marketplace’ database. Do you want to continue? (y/n): y
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1
Starting Drupal installation. This takes a few seconds … [ok]
Installation complete. User name: admin User password: admin
One of our client want functionality to change username in edit profile which is easy. We are using pathauto module for pretty URL in Drupal7.
I faced two issues when changing username. which are explained here..
First Issue
We are using username paths (/users/[username]). After changing a username the url alias doesn’t change and the user edit page doesn’t have an option to change it manually.
Second Issue
We are using username before nodes urls. for after changing username Node uel alias does not change automatically.
Solution (for first issue):
For fist issue I used rules modeuls and created following rule:
Solution (for Second issue):
For second issue, I written custom code as follows:
I used user_update hook for solving this issue.
You just need to put following code in your custom module. It will find all nodes of editing user (logged in user) and update url alias.
/*
* On user update call this method for updating the node url in url_alias
*/
function MYMODULE_user_update(&$edit, $account, $category) {
//getting all nodes
$nodes = get_user_node_by_type('custom_node_type',$account->uid);
//loop for all nodes of logged in User
if(!empty($nodes)) {
foreach ($nodes as $key => $node) {
//load path auto module
if(module_load_include('inc','pathauto','pathauto') !== FALSE) {
if (function_exists('pathauto_cleanstring')) {
//generates clear url title from node title
$currnt_page_title_alias = pathauto_cleanstring($node->title); // define in pathauto.inc file.
//generate new url for selected node
$new_url=$account->name.'/'.$currnt_page_title_alias;
// echo 'node/'.$node->nid;die;
$query = db_query("select u.pid from {url_alias} AS u WHERE u.source = 'node/$node->nid'");
$result = $query->fetchAll();
//If url alias found for node than update the alias
if(!empty($result)) {
db_query("UPDATE {url_alias} AS u SET u.alias = '$new_url' WHERE u.source = 'node/$node->nid'");
}
}
}
}
}
}
/*
* Return User nodes based on UID and node type
*/
function get_user_node_by_type($node_type, $uid){
$nodes = array();
$nids = db_query('SELECT nid FROM {node} WHERE uid = :uid AND type = :type', array(':uid' => $uid, ':type' => $node_type))->fetchCol();
if (!empty($nids)) {
$nodes = node_load_multiple($nids);
}
return $nodes;
}
Above code will solve my problem. When I edit my username, It collects all nodes which are created by that user and update the url_alias of nodes.
Drush is great native application for development of drupal project. I really like to use this tool in every project. There are some good steps to install drush on Linux or windows environment. I recently installed drush on my centos machine. Here are those steps:
Commands has been highlighted in blue color.
[root@ap107 purab]# wget http://files.drush.org/drush.phar
–2016-04-21 11:50:43– http://files.drush.org/drush.phar
Resolving files.drush.org… 54.231.81.40
Connecting to files.drush.org|54.231.81.40|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 5264426 (5.0M) [application/octet-stream]
Saving to: “drush.phar”
100%[===========================================================================================================================================================>] 5,264,426 221K/s in 65s
[root@ap107 purab]# php drush.phar core-status
PHP configuration : /etc/php.ini
PHP OS : Linux
Drush script : /home/purab/drush.phar
Drush version : 8.0.5
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
[root@ap107 purab]# chmod +x drush.phar
[root@ap107 purab]# mv /usr/local/bin/drush /usr/bin/drush
[root@ap107 purab]# drush init
Copied example Drush configuration file to /root/.drush/drushrc.php [ok]
Copied example Drush bash configuration file to /root/.drush/drush.bashrc [ok]
Copied Drush completion file to /root/.drush/drush.complete.sh [ok]
Copied example Drush prompt file to /root/.drush/drush.prompt.sh [ok]
# Include Drush bash customizations.
if [ -f “/root/.drush/drush.bashrc” ] ; then
source /root/.drush/drush.bashrc
fi
# Include Drush completion.
if [ -f “/root/.drush/drush.complete.sh” ] ; then
source /root/.drush/drush.complete.sh
fi
# Include Drush prompt customizations.
if [ -f “/root/.drush/drush.prompt.sh” ] ; then
source /root/.drush/drush.prompt.sh
fi
Append the above code to /root/.bashrc? (y/n): y
Updated bash configuration file /root/.bashrc [ok]
Start a new shell in order to experience the improvements (e.g. `bash`). [ok]
[root@ap107 purab]# drush
Some time I found some issues with Drupal site. When we make changes in javascript or in PHP code we need to clear the cache from Drupal site. One time I got really weird issue. I am not able to access my druapl admin also.
delete drupal cache manually through mysql
Then I found only one option which is I need to clear the cache from Drupal. Using Drupal admin panel we can easily delete the drupal cache but how can I delete the drupal cache manually. We can delete the Drupal cache through mysql also.
For that you need to use following mysql commands in phpmyadmin or through mysql command line.
[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
[mysql]
DELETE FROM cache;
DELETE FROM cache_filters;
DELETE FROM cache_menu;
DELETE FROM cache_page;
DELETE FROM watchdog;
[/mysql]
[/viral-lock]
above mysql commands will clear all the cache from drupal. If you want more drupal tutorials than visit here
Drupal is most popular CMS in the world for creating the web application. For custom purpose we need to create the drupal modules. We need the custom tables for creating the drupal.
create install script for drupal module and create tables
In this article I will tell how you can create the sample drupal module with custom two table. When you activate the drupal module then tables which are defined in the module will be get installed. When you unactive the drupal module tables will get deleted from database.
For creating the drupal module three files are necessary and that as follow:
1. yourmodule.info (you can use your module name
2. yourmodule.install
3. yourmodule.module
First .info file is important and in that file we will put module related information. mymodule.info file has following content.
; $Id$
name = My module
description = This module is to test the install feature
core = 6.x
For creating custom tables you can use following code in mymodule.install file.
.Module file is most important. In this file you can put the code which for you written the module. Now in this file Now I am giving you the sample menu code. mymodule.module file has following content.
If your website created in drupal cms the you click on forgot password link. you got the email from your website to reset the password.
When I used drupal functionality I got weird issue with durpal cms. I got the email from website but when I tried to login with url. We solved forgot password is not working with drupal issue.
Solved forgot password is not working with drupal
the email notification doesn’t work for me at all. I did google around for this issue but did not get any solution for this issue.
Then I tired to solve this issue my own and I found the hack to solve this issue.
Go to your drupal installation and open “user.pages.inc” file from following location
File : modules/user/user.pages.inc
Find function called “user_pass_reset()” in file. You need to modify that function.
Put the following line :
$action = ‘login’;
before if ($action == ‘login’) line. This code will solve the forgot password and authentication with url issue.
When we want to choose any CMS, First two biggest cms we get in mind. That is Joomla and druapl. Both are very best CMS. I personally love both. That is all depending on you what expertise you have and what is your client is demanding.
joomla vs drupal
Here in this article I will help you If you are not choosen any CMS and you are confused about Joomla and Drupal. They both offers similar kind of features in their CMS in different order. If user or client side if we talk then joomla’ admin panel gives you very nice and user-friendly user interface in admin side. Drupal has admin panel with good admin panel but that is complex as compare to joomla.
Here I will first talk about Drupal. Following is a list of drupal features which I like
1. So much flexible for configuration
2. Great Seo features
3. Drupal need some time of R&D for his features and modules
4. great theme system. Any XHTML or CSS template can be easily converted to Drupal.
5. User groups & user permissions, OpenId compliant in Version 6
6. Drupal is having lots of free addons and modules
7. Community with great support and API
8. Performance and scalability wise good.
9. No Default WYSIWYG editor for editing content- Need to free module
Conclusion: I recommend choose Drupal as CMS. Drupal is litter hard then joomla for work on and user interface side. But performance and if you see future side drupal is good.
SEO is major factor in these days for your any website for ecommerce and marketing or anything. In that scenario choose Drupal. Because Drupal is providing best options and features with SEO.
What You are thinking about Joomla and Drupal, please share with me.
Which CMS is most popular and most user-friendly in the world. WordPress vs Joomla vs Drupal all are best cms. you need to decide what type of site you want. This is most common question among the developers and clients.
So many times this question is questioned the answered But still I am going answer this question with my opinions.
WordPress vs Joomla vs Drupal
Biggest growth of jobs is WordPress. I am wordpress developer and I can feel this trend today.
We can this graph that displays the growth of wordpress. Seeing this graph We can say that in 2009 and 2010 wordpress is really rocking.
I worked on all the cms like wordpress, drupal, joomla and many more. But in this year I worked on wordpress for quite some extra time.
When we choose CMS we consider following points.
1. Which CMS will provide you Best Seo options
Ans: When we see and check the all CMS then I can easily say that wordpress has ability to provide you best seo option. After that I will must say Drupal is best option to go with. This will also provide you best seo option.
2. Which CMS is easy to make custom theme from custom design PSD
Ans: I can say with wordpress and drupal both creating a theme is very easy. any web developer who have very basic knowledge of PHP they can develop custom theme very easily.
3. Which CMS is easy for developer to make custom plugins, modules and components easily
Ans: If you started learning API’s of both the CMS. All are good and easy and all provided good amount of help on internet. But I can rate myself as follows:
a. WordPress
b. Drupal
c. Joomla
Anyways that is depending on your knowledge and understanding. All you need to spend some time to understand the API’s of all CMS.
4. Which CMS admin is most user-friendly and easy to use for non-technical people
Ans: For this point I must say wordpress is the best tool. Drupal has admin panel but little complex to understand and same with joomla.
5. Which CMS is most good for E-commerce site, Blog, Small site, News sites and company website.
Ans: I recommend again wordpress here. you can set up wordpress very easily and quickly with minium effort. For big websites like magazine and news sites wordpress is the great tool.
Next point is, for ecommerce and blogging wordpress is the great tool. If you are aware with wordpress then go with drupal.
Conclusion: If you want to develop very complex website with multiple features like ad management, forums, client support, video gallery, media gallery then go with Drupal.
So many very big websites are built-in Drupal and WordPress. Choosing the CMS is all depending on your client requirement.
Many developer who are experienced in development. But with another CMS development. we look for Best IDE for WordPress, Drupal Plugin and Theme development. But still that comes to another cms or project development. We are always search for good IDE which are free and open source that is the first requirement.
Best IDE for WordPress, Drupal Plugin and Theme development
Our basic need are as follows in any IDE, the IDE need to support following things:
CSS
XHTML/HTML
JavaScript
PHP
MySQL
I created a list of IDE which I used daily to do a development. Here I need to clarify IDE is language specific. I work in PHP, Ruby on Rails, Adobe Air, Flex, Javascript, CSS.
I recommend following IDEs which I really found useful for all the developer who are working in wordpress, joomla, drupal development.
Description: Eclipse is best IDE for all language development. Eclipse IdE is basically Java development but still that provides PHP, ROR and other language support. I like this IDE for java development but I did not recommend for PHP or Ruby on Rails.
Description: This IDE has also all language support. I specially like this IDE from Ruby on Rails development. I Used this IDE for Ruby on Rails development as well as some times for PHP development. Among the Ruby on Rails developer this IDE is so popular.
Description : This IDE is also support for all languages. This IDE is really good support for PHP. I really love this IDE for PHP development. Simple and fast and still nice features about PHP. This IDE is really popular among the PHP developers.
Description : This IDE is mainly made for Ruby on Rails development. This is also popular among Ruby developers. This IDE has features like eclipse. I like this IDE for Adobe Air and flex development. This IDE has also PHP support.
Description: This IDE is plain simple text editor. Shows you simple color highlight features. I specially recommend this IDE for PHP development and new PHP developer always start with this IDE so they will get filmier with PHP functions and methods because this IDE is does not provide any help. I love the use this IDE in daily use for any language development.
If you want to add any more IDEs. You can comments on this article.