Category: Uncategorized

This widget allows the Drupal Five Star module to accept inputs from multiple votes for various criteria and average it into one, It then displays the average of the multiple votes.

To create views sortable by the new widget (the average of five votes), hook_votingapi_results_alter() was used in a small custom module.

Below is a tutorial on how to implement the code.

Best practices using multiple votes criteria In node using FiveStar module in Drupal 6.

1. Enable Fivestar module, Voting API.
2. Go to edit content type and Enable Fivestar rating.
3. Add CCK field Type Fivestar Rating with “Fivestar rating” Select list widget.
4. Configure this CCK field: add Voting Axis: which is the multiple criteria separated by a comma. For example: first, second, third, fourth, fifth . Save field settings.
5. Create the template for node type. In this example it is node type is “teacher”. This will be node-teacher.tpl.php .

In the template paste this snippet:

$output = '';
$tags = array(
'first' = t('Communication'),
'second' = t(‘Availability'),
'third' = t(‘Skills'),
'fourth' = t(‘Efficiency'),
'fifth' = t(‘Personality'),
);
$i = 0;
foreach ($tags as $tag = $title) {
$votes = fivestar_get_votes('node', $node->nid, $tag);
if(!empty($votes['average']['value'])){
$i++;
}
$values = array(
'user' = isset($votes['user']['value']) ? $votes['user']['value'] : NULL,
'average' = isset($votes['average']['value']) ? $votes['average']['value'] : NULL,
'count' = isset($votes['count']['value']) ? $votes['count']['value'] : NULL,
);

Need to control which users can access a node/page of a particular content type on your Drupal site?

The Drupal Node API provides us a quick way to do this. It provides the hook_nodeapi function to react to the actions affecting all kinds of nodes. We can easily implement this hook in our module or theme. A prototype of this hook looks like this:

function myCustomModuleName_nodeapi (&$node, $op) {

/*Your code and conditions here*/

}

Here myCustomModuleName is the name of the module in which this hook is defined. The two parameters are $node, which represents the node on which the action is being performed and the other one $op,  is the kind of action which is being performed. The $op can have values like view, alter, delete, print and so on…

As an example, I was looking to design such a condition for my website:

  • If enrolled user creates content type for "recipe", restrict access to recipe except for node author and admin.

So, I needed to develop a mechanism through which for each node of type “recipe”:

  • Everyone can see nodes created by admin including Anonymous user.

Each view generates lots of styles for flexibility with the CSS. A simple solution is to just go into Firebug and search for styles created and find or create them in style.css. The style names correspond to the template file names so you know what .tpl file to look for the HTML output if needed. This example we will be looking at a view I created called ‘Gurus’, for the about page section of a social networking site for yoga teachers.

 

‘About’ templates for views.
1

6
Here we created the views page Activism. I want to create a view that displays 3 trunacated RSS feeds.

This view displays feeds or if there is no feed, the body of the content item. The content type “activistm? has “body field” and “text field” for the feed url.

In the template there is simple template logic to check, “if isset() feed link” if the feed link is set, than display the RSS feeds, otherwise display any text from the node body.

finalrest-800x450

Too many websites claim to be able to turn your website into a mobile app but not one of them deliver results as expected, the simple truth is you can’t automate the process, it will always leave something to be desired. Our software couple with custom implementation can turn your Drupal or WordPress website into a mobile feeling app. With native login functionality the user does not need to repeatedly login to the app giving the illusion of a 100% native mobile app from a website that lies behind a login.   After logging in once the user simply clicks the homescreen icon and will be taken to the authenticated/logged in website area. All viewed from within a native iOS or Android wrapper. Custom offline messages and native navigation can all be implemented out of the box with our software. The overall time to implement the basic service for your app is $3000, the source code is yours forever with no annual fees, and you publish directly from your developer account. This services service will get you better results than an automated do-it-yourself platform,and also authentication and login which platforms like Appresser can’t do. To convert a a website/webapp the one click homescreen icon app experience.  The API currently exists for Drupal 6 or Drupal 7 sites. App software is written in both native iOS (Objective C) and Android (Java) code.

Contact

office: (212)-658-1447 | cell: (914)-715-8862 | alex@freeenergymedia.com

Name
Email
Message

Message sent, Thanks!
Error! Please validate your fields.
2017 FEM NYC (formerly Free Energy Media)