HomeDrupal Guides

Manually execute a rule set across large set of data = Drupal 7 + Rules + Views Bulk Operations


I have a content type with roughly 50k nodes and I have a view that displays some summarize data of the nodes. I decided I wanted to group the view items by a category that wasn't available or envisioned during the inception period of the data and site. I could go to my content type and add a new field, dump the data, fix it by using feeds tamper or something, and reimport it. OR, much simpler, use Rule Sets and Views Bulk Operations to get the job done.


Clients (users) cannot see comments (updates) to tickets in Drupal 7's support ticket module

Once you get everything setup and your permissions right, users are still not able to see comments or updates that have been posted to the ticket.
The solution I found on Drupal's forums. I am merely posting here for my own sanity because I know I will be looking for this later and not be able to find the thread. 
Link to solution thread. Number 11's solution works!
Line 2354 of the support.module file (found in sites/all/modules/support) has this:
            global $user;
            $ticket_alias = $query->leftJoin('support_ticket', 'st', 'st.nid = ' . $nalias . '.nid');
                // Must be on the allowed clients list

My vain attempt to document organic groups and how I am currently implementing it. (D7 + OG)

I spent about a week pursuing various modules and combinations of solutions to find a way to basically filter the content in a view based on the currently logged in user's role. So, if I have a role called lab admins, anyone in that role needs to be able to see a certain set of data. This data cannot be see by lets say office admin role. Office admin role has an entirely different set of data. Many people think this is doable and it is but only for the author of the content. In my situation, I have 15 different labs and growing and each lab can only see their sets of data. For each lab, I need to be able to add users to their admin role. So lab1 admin might be just Bob, but lab2 needs Bill and Joe, and lab3 needs to allow Bob from lab1 and Bill from lab2. The only way to tackle and solve this was Organic Groups.

Pubcookie ping pong effect (browser loop) issue.

This is a quick one, not a lot of information out there on it. If for some reason you find that your pubcookie setup isn't working because when you hit login and you login successfull your browser starts wigging out and looping back and forth between the login page and login successful page ... it is most likely caused by the wrong time set on your server. Pubcookie requires your server to be within 60 seconds of the pubcookie authentication server. Otherwise it gets stuck in a loop. To best handle this, setup and install NTP.
yum install ntp (this installs ntp if its not already)
chkconfig ntpd on (adds daemon to startup)
service ntpd start (this starts service)
if you need to modify the ntp server list, go to /etc/ntp.conf
Once your time is set, restart apache (service httpd restart) and it should work properly again.
REMEMBER, ntp will not jump your clock into sync as it could miss scheduled tasks. So it slowly dials you in.

Views Field Views in D7 - Passing arguments using contextual filters bug fix.


situation (hypothetically, excuse the periods):
view parent has a list of accounts and their balance:
account 1.......................$balance
account 2.......................$balance
etc ...

Pubcookie + Drupal 7 + fresh CentOS server was a nightmare. But its done and works great!


I am attaching my .htaccess file in hopes that it helps. Click here. Obviously the .htaccess file is in my root site directory.

At the university here, we use something called Netbadge to authenticate users for all websites university related. Basically, Netbadge = Pubcookie. The problem is, this is a royal pain to build out

Before I could begin, I needed an SSL encryption on my server and hostname. I will not go into detail on how to do that here mainly because everyone's setup differs GREATLY! 

Once complete, it is time to setup Pubcookie. At the university they offer a preconfigured installable file that will install Pubcookie for you. Awesome! Except that it only runs on 64bit servers and I just happen to be using a 32bit server. So I have to do it from scratch.

Drupal 7 + views PHP using global PHP fields

Drupal 7 using views PHP and Global: PHP fields.

For some reason, and I don’t know why, the available variables, shown in the field below value code and output code, in global php field return the NID, and not the actual value. I also do not understand the difference between the value code and the output code. They interpret the exact same code differently and I find it extremely annoying. So I default to using the output code only. This will be a headache if you have to reuse the value you output.

Why am I doing this? I need to run queries on the tables in the drupal database for financial analysis.

So if the available variables are not what you need then how do you find what you need? Its simple, add this code to the output code field:


Drupal 7's new database and how to use computed field for the basics!


Quick Explanation:

One of the major changes from Drupal 6 to Drupal 7 is the database and how it is structured. In Drupal 6, each content type was its own table. Not the case in Drupal 7. In Drupal 7, each field is its own table and the field’s content type is only a column in the field’s table. I found this while trying to write custom queries in Computed Field. I briefly struggled with how I was going to write relational queries if content types are no longer tables, and each field is its own table … until I discovered entity type and entity ID. I had read and heard about them but didn’t quite grasp the difference until now. Each node created in Drupal 7 has its own entity ID. That entity ID is consistent across all your tables (which are fields). Therefore, to compare things, simply set their entity_id equal to one another.


Computed Field Example:

Drupal 7 + commerce + commerce product option

Add product options BEFORE the user clicks add to cart. Normally this can be used to select the size and color of the product that you are selling. In my case, I am using it to collect some basic information from the client about the poster they would like printed. 

Modules Used:
Commerce (kickstart package)

In the guide before this, I created a printing queue and submission process for posters to be submitted. While I liked my build, it lacked dynamic pricing, and a good receipt printing process. So I decided to take the plunge into Drupal 7 and use Commerce as my platform to handle this. I would like to say I am extremely impressed with Commerce and Drupal 7 so far!

Poster Printing Queue

Poster Printing Solution in Drupal

Allow users to login and submit a request to print a poster. If there is no proof required the poster goes into awaiting print queue. If there is a proof, the poster is moved to awaiting proof approval queue and then moved to awaiting print queue once it’s approved. Once poster has been printed it is moved to a completed poster queue.

Modules Used:
Conditional Field
Button Field
Automatic Title Generator
File Upload Field