Curata and Drupal Integration

So you want to integrate Curata with your Drupal site? Here’s how:

  1. Install BlogAPI, and Services modules
  2. Enable the above modules, and also “MetaWeblog Provider” and “Old Blogger Provider” for Blog API, and the Services, “Services XMLRPC Server”.
  3. Under Home » Administration » Structure » Services create a new endpoint of type XMLRPC, both name and endpoint URL should be “curata”.
  4. Under the resources tab of your newly created service, check all boxes under “blogger” and “metaWeblog” sections.
  5. At this point you might want to create a new content type for articles published from Curata, it should only contain title, body, image* fields. Having fields other than these, which are required fields, is a problem because will be left blank and therefore prevent Curata from being able to publish. I created a content type called “Curata Article” and referenced it in the step below.
  6. Next you need to create a Role within Drupal, the only permissions it requires are “Manage content with BlogAPI”, “Administer content”, “Curata Article: Create new content”, “Curata Article: Edit any content”, “Curata Article: Delete any content”. Now create a user with this role assigned.
  7. In Home » Administration » Configuration » Web services  » BlogAPI, set the default provider to “Blogger” and select the content type you will allow Curata to publish to, probably the “Curata Article” content type you created in step 5.
  8. Now you’re ready to hook up Curata. Login and go to CCS. Under the share menu, click on CMS then “Add CMS channel”.
  9. Enter your Drupal website URL, the “discover” feature will fail because, unlike WordPress, XMLRPC is not advertised to the world.
  10. Enter your endpoint URL, should be https://www.example.com/curata and provide the credentials for the user account you created in step 6.
  11. Click the authenticate button and Curata will connect and get a list of Content Types it can publish to, as defined in step 7.
  12. The rest of the Curata settings are down to your personal preference. Save all changes and then share some of your approved content from within CCS, ensure it appears in Drupal and you’re all set.

* I have not been able to get Curata to publish images directing into Drupal. To get around this you can edit your “Post Body” field in the Article Display settings within Curata. Here is my post body template:

 

Running Acquia DevDesktop under a different user account

So I recently found, due to corporate IT policy, my local admin/elevated privileges had been removed, and therefore I was unable to run Acquia Dev Desktop.

After having corporate IT support enter their administrative credentials, i found my local Drupal site was displaying the “Install Drupal” screen, rather than my local website. This screen is usually displayed when the local database is empty, but after checking my PHPMyAdmin, i could see this was not the case.

Maybe the new username account used to launch Dev Desktop didnt have permission to access the database, or could even see it? Correct, here’s my solution:

I copied this file:

C:\Users\My_Username\.acquia\DevDesktop\DrupalSettings\loc_[sitename]_dd.inc

…to the folder for the new user who has permission to launch DevDesktop:

C:\Users\New_User\.acquia\DevDesktop\DrupalSettings\loc_[sitename]_dd.inc

(The above folder was previously empty)

And, BOOM, now the local Drupal site runs successfully.

 

Drupal and CKEditor, setting default values in the image properties dialog

Copy this file to the root of your theme directory:

/sites/all/modules/ckeditor/ckeditor.config.js

Edit the file and add the following code which will give a default value to HSpace, VSpace and ensure Bootstrap’s “img-responsive” class will be added to all images:

Lastly, edit your CKEditor profiles and set “Load ckeditor.config.js from theme path” to “Yes”:

/admin/config/content/ckeditor/edit/Advanced

Done.

Acquia Dev Desktop – Sharing your local site

If you’re developing a Drupal site locally, using Acquia Dev Desktop 2, and you need to allow your co-workers to see it, you’ll need to make the following change to your vhosts.conf (located in devdesktop\apache\conf\vhosts.conf)

Replace “Require local” with “Require all granted”, then stop and restart Apache/MySQL from within Dev Desktop.

 

Using Drupal Rules Scheduler to Unpublish a Node

I use the Rules module together with Rules Scheduler (a Rules sub-module) to automatically unpublish content at a specified time, as explained in the steps below. These steps use content type = article, which has an expiry date field which is set by the user. When cron runs, the expiry date field is checked and the content is unpublished.

Step 1: Create a Rules “Component”

Here is the Rules Component to be created (in Rules export format):

 

Step 2: Create a “Rule” using the Rules Component

Here is the Rule to be created, in Rules export format:

 

Note that the above rule refers to the Rules Component from the previous step. It’s in Rules export format, just import it in your own environment via copy-paste (after you adapted article in it to fit the machine name of your content type).

Drupal remove white-space from HTML

Add this simple function into your theme’s template.php in order to strip out unnecessary whitespace and line breaks, saving a bit of file size where possible (I saved 17kb from my homepage). If a page contains a <pre> or <textarea> tag, it is left alone, as to not affect code blocks or text typed in a form.

 

Exclude Drupal system CSS for logged-out users

In your template.php, you can exclude Drupal’s system CSS files, or any CSS file that wasnt added by your theme (this includes CSS added by modules) using this PHP snippet:

 

Drupal homepage only CSS

So you want to have a base.css file on all pages, then a homepage.css file just for the homepage, and non-homepage.css for all other pages? Here’s how:

In your themes’ .info file, include the base.css file:

In your themes’ template.php file:

Note: In the code above I have chosen to inline the homepage only CSS.

 

Did you find this post useful?

Tip me some bitcoin: