Developers and coders
Display a custom message with the Node_limitnumber module.
I wanted to restrict the the number of posts a Certain Role could create. So I installed the "node_limitnumber" module.
It worked out great, except I was wanting a bit more functionality when it came to the execution of the code.
As the module is now, if a user try's to create more than their allowed the, module re-directs them to the add content page and following error message is displayed...
"You can't create more content of type !type, sorry."
Effective... But I decided to add some "snippets" to the node_limitnumber.module file for configuring conditional messages. This was my first real php programming venture.
Before.. (starting at line 152 of node_limitnumber.module,v 1.6.2.1 2009/09/22)
$result = db_query( $q, $node->type, $user->uid);
$num = db_affected_rows();
if ($num >= $limit) {// We have the data, now we check the limit
$nodetypename = node_get_types('name', $node);
drupal_set_message(t("You can't create more content of type !type, sorry.", array('!type' => $nodetypename)), 'error');
drupal_goto('node/add');
}
}
}
}And After...
$result = db_query( $q, $node->type, $user->uid);
$num = db_affected_rows();
if ($num >= $limit) {// We have the data, now we check the limit
Ubuntu 9.10 (Karmic Koala)
There is a Drupal package in Ubuntu, so Drupal install on Ubuntu is just this line
sudo apt-get install drupal6
Then - at the time of writing this post - some more steps are necessary to get Drupal running:
- enable the rewrite module and restart Apache:
- change the rewrite base in /etc/drupal/6/htaccess
- optional: increase PHP memory:
- open your browser and start the install process of Drupal:
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart from this one:
# RewriteBase /drupal
to this:
RewriteBase /drupal6
sudo sed -i 's/# RewriteBase \/drupal/ RewriteBase \/drupal6/' /etc/drupal/6/htaccess
sudo sed -i 's/memory_limit = 16M/memory_limit = 64M/' /etc/php5/apache2/php.ini
Node Reference Create
Overview
Node Reference Create is an enhancement to the nodereference autocomplete widget that allows users to reference non-existent nodes.
When no matching node is selected, the new nodes are automatically created allowing for a seamless and intuitive user experience that is similar to free tagging.
Usage
Field configuration
Once the module is activated, a new widget will appear in the manage fields page. Select the nodereference field, and then choose 'nodereference autocomplete with create' from the widgets list.
Known bugs and incompatibilities
- There is no way to select which node type will be automatically created if more than one are selected. see http://drupal.org/node/584316
- Nodes are created on node preview (see Avoiding duplicate entries when form is submitted twice for a solution.
Check the issue queue for more information:
http://drupal.org/project/issues/noderefcreate
Drupal for Facebook on D5
This is where pages specific to the Drupal 5.x version go to die.
Stop using Drupal 5.x. Upgrade to the latest version of Drupal for Facebook. It may not be perfect, but it's much better!
Application Setup
Setup the Facebook Application - Part 1, on Facebook.com
The following steps assume you have a Facebook account.
• Go to http://www.facebook.com/developers/createapp.php.
• If asked to login, use your Facebook login. If you haven’t created an application before, you will be asked to grant Facebook Application access to your Facebook account. You have to allow this in order for this process to work.
• Facebook will ask you for the Application Name that you want to use. This is a short human-readable name. It will be viewable to those who are allowed to visit your Facebook account so make it simple and clear.
• Agree to the terms and click Save Changes. Note: The next page that appears will contain three pieces of information that you will need for your Drupal FB Application: API Key, Application Secret, and Application ID. You will copy and paste this information into the applicable fields when creating your Drupal FB Application.
Canvas Page-specific Setup
Not necessary for Facebook Connect-only applications.
• Click on canvas in the left menu of your Facebook application screen. At the top of the screen that appears next, fill in the URL field. Keep the URL simple and descriptive. Formatting restrictions are provided on the screen. Please read them.
Setup the Application - Part 2, on Drupal
Prerequisites
In order to install and configure Drupal for Facebook, you need to do a couple things first.
Facebook Account
You are going to need a Facebook account. If you don’t have one, go ahead and create one now.
Devel Module
This module is not required on your production site but will be helpful on your development site. The FB module comes with the DFF (Drupal for Facebook) Devel module and provides blocks and messages that help when developing and debugging Apps. If you intend on using the DFF Devel module, download the devel module and enable it. (You wont get very far without this).
PHP JSON
Facebook requires your PHP installation to have JSON extensions to be installed. As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default.
To check which version of PHP you are using for your D6 site go to admin > reports > status reports. If you have something less than 5.2, your PHP installation might have JSON extensions already installed. Please check with your hosting service provider. Information about JSON extensions is located at http://us.php.net/manual/en/json.requirements.php. Your hosting service might need this link. If you don’t have this installed, you will not be able to push content from your site to Facebook.
