Drupal 7 custom module does not enable - drupal

I am trying to create a custom module (as a content/node type) but it's malfunctioning.
Upon creating the desired .module and .info files, I go into Adminstrator/modules and enable the module. Upon enabling this module, all I see is the adminstrator view expand itself
Compare this with the regular administrator page that renders itself while carrying out administrative tasks:
It is expected to appear in the new Content types button but it does not, and when I look back into the Modules menu, the node is not enabled, even though I enabled it and saved configuration.
There are no error reports either and I am using the official Drupal documentation to create a module as a node_example...the code for the same can be obtained at this link:
http://drupalcontrib.org/api/drupal/contributions--examples--node_example--node_example.module/7
Anybody with any inputs on what's going wrong here? Most importantly this seems to be an error present in the official documentations for creating a module as a node type!

Related

Error in Exposed Filter with AJAX in Drupal View

I'm receiving an error when i try to filter a Drupal view using a regular exposed filter with AJAX(autosubmit).
An error occured while attempting to process /views/ajax:
Object [object Window] has no method 'indexOf'
This is what i've done:
Clear all the cache, run cron and update.php
Views, ctools and drupal core were out-of-date, so i update them and run update.php
Check that the view had Ajax enabled.
Test if using Better Exposed Filters worked, din't work.
Install JQuery Update module and enable it, din't work either.
Create another exposed filters(by date, type, title) same error.
Something important to mention is that the filters works in the View Preview.
The view is very simple, the only thing it does is show a list of events (event content type) and i want to filter the content by the restaurant (wich is a select list of the content type) and that error is been shown.
This is the spects:
Drupal Core: 7.19
Views Module: 7.x-3.5
PHP Version: 5.3.18
Apache2.2.22
MySQL 5.1.66
Using Acquia Dev Desktop stack on Windows.
Thanks in advance
This is the result code when i export the view:
File Code, Click Here
Try to enable clean URLS. This worked with me.

How do I implement a dynamic role in Plone 3?

I want to allow access to certain content to certain users for a limited time,
using a 'Dynamic Role' in Plone 3 ( http://collective-docs.readthedocs.org/en/latest/security/dynamic_roles.html ).
To this end I've created an add-on with a copy paste of example code - except that for now getDummyRolesOnContext() always returns my role.
But Plone never calls, or instanciates my DummyLocalRoleAdapter, and obviously my users never get the role assigned.
Here's what I know so far:
My dynamic role is defined in a rolemap.xml and get's created upon add-on installation.
My add-on is being imported - an exception on it's first line prevents Zope from starting
None of DummyLocalRoleAdapter are being called - I've spiked all of them with warnings and exceptions.
The adapter does get registered.
How do I continue debugging this - what's the magic part I'm missing?
Thanks!
My guess is that you need to somehow activate borg.localprole PAS plug-in in acl_users:
https://github.com/plone/borg.localrole/blob/master/borg/localrole/utils.py
There might have been borg.localrole add-on installer entry in the past, but now there doesn't seem to be one. My guess is that you need to call the actions from borg.localrole add-on setup code manually in your own add-on.
acl_users when borg.localroles is correctly installed:

how do I update a plone custom policy (e.g. mysite.policy) add-on

When I first created my Plone (4.1) site, I made a mysite.policy add-on to include some custom users and a custom workflow.
I need to make some corrections to both the workflow and the permissions. I updated the src to include these changes, but updating the package in through the Plone add-on manager (uninstall - install) does not work. As soon as I uninstall the status of all my entries switches to "local policy", so I cannot get the fine-grained status setttings back when I reinstall.
Also, the user permissions do not seem to change. Possibly because they were already created at set-up of the site. But I cannot figure out how to code a change to permissions versus a setup of permissions in the rolemap.xml. I assumed that whatever is in that xml is what rules my plone world, but that does not seem to be working.
So far I cannot find anything about this in the manuals and books I have at hand. Any hints how to solve this? Perhaps the only way to go about this is a series of manual changes through ZMI, but it is so much less elegant to do it that wat.
There's plenty of options. I'll try to describe a couple of them.
If your changes include only changes in Generic Setup profile of your site policy (./src/my/site/policy/profile/default/-files) and you don't want to automate the upgrade, you could simply update the profile-files and re-run those specific import steps for your policy:
Open ZMI (site/manage) for your site and look for portal_setup.
Select Import-tab when on portal_setup.
Select the profile of your site policy from Select Profile or Snapshot-list (the title of your profile is defined by the registerProfile-directive in configure.zcml or profiles.zcml of your policy product).
Click to select import steps for Role / Permission Map and Workflow Tool.
From the bottom of the page, deselect Include dependencies.
Click Import selected steps-button.
Go to portal_workflow-tool on ZMI and Update security settings, if your workflow update should modify permission in existing workflow states.
These steps should re-import only the selected import steps of you site policy product's Generic Setup -profile. Re-importing individual steps this way should be quite safe, but be careful: accidental clicks at portal_setup screens may have unpredictable consequences.
These steps can also be automated by defining something called Generic Setup Upgrade Step.
I hope that the default Generic Setup -profile of your site policy product includes metadata.xml with line <version>1</version>.
Update that line to <version>2</version>.
Open the zcml-file with registerProfile-directive and, after it, add
<genericsetup:upgradeDepends
source="1" destination="2" sortkey="1"
title="Upgrade my.site.policy (1 to 2)"
description="Upgrades my.site.policy's default profile from version version 1 to 2."
profile="my.site.policy:default"
import_steps="rolemap workflow"
run_deps="false"
/>
These steps should register such an upgrade step from the profile version 1 to 2, which re-imports steps rolemap and workflow (rolemap.xml and workflows.xml). You should be able to run the upgrade step from the Plone Site Setup's Add-ons-screen, where there should now be an upgrade button after your installed policy product.
As mentioned by #toutpt, the Collective Developer Manual has more examples on upgrade steps. If you have ever wondered, why it's recommended to use integers in metadata.xml, usually independently from the product's release version number', this is the reason :).
Any changes that need upgrade must be shown by increment the number in profile/default/metadata.xml (keep integer). Next you have to write an upgrade step. It will add an upgrade button in the addons control panel.
Please follow this tutorial to learn how to create an upgrade step: http://collective-docs.readthedocs.org/en/latest/components/genericsetup.html?highlight=upgradestep#upgrade-steps

FBConnect using Drupal 7

I start to use FBConnect module to my Drupal site.
FBConnect readme says
Create a new facebook application: http://www.facebook.com/developers/createapp.php
Enter the Site URL on Web Site settings tab (e.g. copy value from admin/settings/fbconnect field “Connect url”).
Configure the module through admin interface (admin/settings/fbconnect) using the information provided by Facebook
(Application ID, Application Secret).
Even i try to type this as URL in browser:
http://ph7.localhost:8082/admin/settings/fbconnect
Noting happens.
Sadly, i found this in Module section :
Requires: Fbconnect (disabled), Libraries (missing).
I am pretty sure i have copy file to sites\all\modules\fbconnect and also
create a directory "libraries" which yield :sites\all\libraries\facebook-php-sdk
Question: 1.where is admin/settings/fbconnect ?
2.how to install fbconnect module for drupal 7
You might need to re-check/verify each and every point here
In order for the user's browser to correctly recognize XFBML tags, you need to specify that the page is in XHTML.
Edit the "page.tpl.php" file of your current theme. edit the tag and add the facebook xmlns for rendering XFBML.
In case you need FB Connect module only for registration and login, I suggest to try FBOauth module.
It does not require any library and has a stable version in D7.
The message that it requires "Libraries" pertains to the Libraries API module (short name: libraries), which provides some code that many other modules depend on. It doesn't do anything on its own, but the hooks/functions in that module are used by so many other modules that it's something like the 20th most installed Drupal module, so you'll likely end up finding it's required for other modules you want to activate.
I suspect that you saw this message that a module "Requires: Fbconnect (disabled), Libraries (missing)" in one of the sub-modules of Fbconnect, which provides additional Facebook-related features (e.g. the Facebook Friends Invite sub-module of Fbconnect). The main Fbconnect module is in the "Authentication" section of your admin/modules/list page. You need to install and activate the Libraries API module, then turn on the Fbconnect main module, then you can turn on the other Facebook connect sub-modules, if you like.
Hope that helps. :-)

adding a block corresponding a downloaded module

I have just downloaded and installed the 'facebook status' module and 'user feedback' module both of which provide a block for display as follows:
1)facebook status module provides a block for display of facebook status messages
2)user feedback module provides a block for feedback (of the site) from users.
But when I listed the 'Blocks' under the 'Site Building' Tab I was not able to see the block corresponding to any one of the two, not even in the 'disabled blocks' section.
Is there some way to access these blocks. I don't think there is a bug in both of thses modules as I have seen others use it(but not how). Please help.
The module was installed but it was not working properly due to lack of space available in the database. I uninstalled some less important modules, which cleared some space of the mysql database and got it working again.

Resources