Recent Posts

Pages: [1] 2 3 ... 10
Hi there,

We've written some very similar code - for allied organizations of yours, in fact.  I haven't used that NYC API before though.

What you'll want to do is write an extension.  Check out this page:

Use the civicrm_post hook ( and hook either addresses or contact records being saved (depends on your workflow).  Use API calls to get the fields you need and pass them to php_curl.  Parse the results that come back (you can probably get away with a search function instead of a full-blown XML interpreter) and use an API call to save the building number to a custom field.

This is probably a bit overwhelming if you haven't done it before - but once you've done it, you can knock out something like this in an hour or two.  If you'd like to come to Brooklyn one day next week, you're welcome to set up a laptop next to me and hack at this and ask me questions when you get stuck.

Ah ha - you have to select "Participants (Event Name)" when you created the custom fields. If it's a set of custom fields you've already created, you can't edit it to change from "Participants" to that one.
Hi, I'd like to know generally what path to go on.  I suspect it involves editing some templates or tokens, but not quite sure. Some of you with more programming experience must have a suggestion; I am still learning PHP.

We do tenant organizing. When viewing a Contact Dashboard, I would like to see information about their building. This is greatly facilitated if we translate their address into block/lot numbers as listed in a Building Database I will upload.  Here is an example of a workflow:

Say John Doe lives at 102 Norfolk St.
Pass the relevant houseNumber and street in "102 Norfolk St" to a NYC API (I would ideally want to take the parsed Street Number and Street Name from Civi's automatic parse fields)

the Request that would be passed to the API is this (this is XML, it can also do JSON format):

Code: [Select]
curl -v  -X GET ""
Its Response includes this:

Code: [Select]

Then I want it to return the bbl value to Civi. (in this case, 1003530049)  That will be the External Identifier for Building that John Doe lives in (I am uploading the Building Database as a list of a new kind of sub-contact, Buildings.)  Ideally this returned value would be displayed as a Contact Reference on John Doe's dashboard, upon clicking would lead to the Building's contact dashboard.

Anyone have any suggestions for what direction I should go in to start this project?
I'm using the nginx webserver with CiviCRM, with the perusio/drupal-with-nginx configuration. Overall it's great, but it's required some slight tweaking, as I've documented on this other post.

Now I'm running into a new issue. The system workflow message email that gets sent out for the "Contributions - Recurring Start and End Notification" action (and presumably other system workflow messages) contain URLs that unnecessarily begin with index.php?q=. So for example, one donor received an email containing the following (redacted) URL:
Due to my nginx config, this URL gave the donor a 404 error.

So I'd rather the URL be:
(only change is removing index.php?q= )

I'm using the default message template and the code that produced this URL is:
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}

Ideally I'd like to get CiviCRM to produce the clean URL. Any thoughts on how to do that??

But since I'd really like to fix this problem, I'd also be open to changing my nginx config. Does anyone know how to alter the nginx config to allow access to index.php?

Thanks Jon for taking the time to say so :D
CiviCRM is only as good as we all make it, happy to do my part to keep it polished.
Using Core CiviCRM Functions / Re: Contact address not saved
« Last post by Dave Greenberg on Today at 12:42:37 pm »
Agreed (re: no error message). Would be great if you could debug a bit and figure out a fix to ensure an error is thrown.

Separately - we have had very few (if any) orgs successfully apply for and use the USPS mechanism for address verification (and it may make sense to deprecate or remove it at some point). I saw a demo at the DC User Summit of a CiviCRM => SmartyStreets extension, which does real time address verification and correction (inside the edit forms). I'm not sure if it's ready for production - although I think AGH Strategies (the developer) has clients using it. You might want to check it out:

This isn't the first time or even third time I've seen you respond to a forum post by implementing the fix in code, and I really appreciate it every time I see it.  Thank you!

When I tested out some custom fields I found that:
Here's an issue for it:

I totally forgot about this issue, as I've been putting out other fires on other websites I maintain.   Then after v4.5 was installed, the CRON job for the scheduled jobs quit, and this brought this back to the forefront.   Once I got the CRON jobs running again on Joomla, I looked at each job log and remembered this DB error.

SO ... here's the error backtrace block found in the CiviCRM logs:

Code: [Select]
$backTrace = #0 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(866): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#2 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB.php(975): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...")
#4 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...")
#5 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...", "DB_Error", TRUE)
#6 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...")
#9 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...")
#10 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...")
#11 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...")
#12 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(1116): CRM_Core_DAO->query("SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...", TRUE)
#13 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/ActionSchedule.php(1276): CRM_Core_DAO::executeQuery("SELECT e.contact_id as contact_id, as entity_id, 'civicrm_participant' a...", (Array:1))
#14 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/ActionSchedule.php(1372): CRM_Core_BAO_ActionSchedule::buildRecipientContacts(3, "20141024112202", (Array:2))
#15 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/api/v3/Job.php(188): CRM_Core_BAO_ActionSchedule::processQueue(NULL, (Array:2))
#16 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(86): civicrm_api3_job_send_reminder((Array:1))
#17 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/Civi/API/Kernel.php(95): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
#18 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/api/api.php(25): Civi\API\Kernel->run("Job", "send_reminder", (Array:1), NULL)
#19 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/JobManager.php(145): civicrm_api("Job", "send_reminder", (Array:1))
#20 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/JobManager.php(94): CRM_Core_JobManager->executeJob(Object(CRM_Core_ScheduledJob))
#21 /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/bin/cron.php(42): CRM_Core_JobManager->execute()

Hope this helps to identify the statement causing this error.

Sorry I haven't been able to get back to this for most of the month - other priorities, then some R&R time.

Finally found the issue in the PHP logs, turns out the fault is in the /administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php file at line 541.    Here's the code in question:

Code: [Select]

        //include additional files required by Joomla 3.2.1+
        if ( version_compare(JVERSION, '3.2.1', 'ge') ) {
            require $joomlaBase . '/libraries/cms/application/helper.php';
           require $joomlaBase . '/libraries/cms/application/cms.php';
           require $joomlaBase . '/libraries/cms/application/administrator.php';

Here's the PHP error log entries:
Code: [Select]
PHP Fatal error:  require(): Cannot redeclare class japplicationhelper in /home/nwtaadmin/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php on line 543
I then commented out that line, and got this:

Code: [Select]
PHP Fatal error:  Cannot redeclare class JApplicationCms in /home/nwtaadmin/public_html/libraries/cms/application/cms.php on line 20
Which I noticed was the next declaration in that block of code in the Joomla.php file.    After I commented out the entire block, the CRON job worked perfectly.

Evidently the USERID & PASSWORD validation functions are being called earlier in the process, and may no longer be needed here.     

I've not seen an issue trying to access the CiviCRM member lists from the front end, but I'm in the middle of testing that now.

This will need to be passed on to those in the developer group who oversee the Joomla integration.
Pages: [1] 2 3 ... 10