# Question
Title: Why Could My Payment Page Not Be Accepting Payment?
We have a webform set up to enable an individual to update an organisations details and then pay for the organisations annual membership. We are having an issue however where a user is reporting the following error.

> I've tried to make payment for the \[organisation\] membership, but it tells me after putting my payment details in that it needs an email address to complete the transaction. There's no-where on this page to put that in!! There was on the previous page, and that part was completed.

The webform is set out as a two pages; updating details and membership payment, so I have truncated the screenshots to remove the non-relevant organisation updates:

This is the top of the webform linking the user to the organisation, in this case the *Station Administrator* user does have a permissioned relationship over the *Station* organisation

This is the bottom of the webform with the payment page

I have the organisation contribute webform set up identically as an individual membership we also run, so I can not see that there are any issues there(?) and I have used the individual payment page (directly through the contribute link though, not a webform) so that side of it worked for me.

Set-up wise, we are using D7.36 Civi4.4.14 and Stripe as our payment processor.

I would appreciate any thoughts you have, because I have tried everything to get this working and it does not want to be co-operative.

**Edited 12 May 2015**

I have been persevering with this taking @Coleman 's thoughts forwards. We have since had another report of payment failing (my previous member chose to pay using another method) and this is what I can glean from the CiviCRM:

* When I masquerade as the user and go to the webform I can see the notice that their organisations membership has expired, so the relationships are being seen. I have also checked that the user is permissioned
* When I go to the CiviContribute page directly while in masquerade there is nothing obvious that the Contribute page is recognising the link between the user and the organisation
* When I go into our Stripe dashboard there is no record of any decline or failure; indeed the last successful transaction was my own which was around a month ago

I have also taken out the *on behalf of organisation* option that was in place as it was just loading a Reserved Profile that did not appear to be connecting to any existing information.

This is all getting very confusing now...

# Answer
> 1 votes
The final solution came from @Coleman and our developer resolved this by implementing a 1.9.1 branch of Stripe from GitHub alongside the dev Webform-civicrm ...

I would tick Colemans comments as the solution, but it won't let me.

# Answer
> 0 votes
For the problem with having the related org show up on the contribution page, if the relationship is not permissioned, and not of type "Employee of" then it will not work. There is currently work being done to fix this to work with other relationship types (although they still need to have the permission flag set in CiviCRM) See https://issues.civicrm.org/jira/browse/CRM-16490

# Answer
> 0 votes
An alternative to redirecting from a webform to a contribuion form would be to configure those settings directly in the webform. A webform can be set up to create and renew paid memberships if you configure both the "Contribution" and "Membership" sections of the webform on the CiviCRM tab.

For more information see the Memberships and Payments webform-civicrm instructions.

---
Tags: civicontribute, webform-civicrm
---


title: Submitting Cases on a Website

text:
# Question
Title: Submitting Cases on a Website
We installed CiviCRM 4.6.5 on our Joomla site recently and enabled CiviCase. What is the best method for allowing site visitors to submit a form that becomes a case? We can't seem to find the obvious answer, if there is one.

# Answer
> 6 votes
Drupal Webform-Integration offers a robust solution for this. Unfortunately there is no equivalent for Joomla.

# Answer
> 4 votes
Sans-webforms, the simplest solution might be to create a CiviCRM profile form, and then write a small amount of custom code in a hook which uses the api to open a new case.

# Answer
> 0 votes
We have done this extensively in a project with CiviCRM 4.4 and used Drupal Webform - CiviCRM integration module and loved it.

---
Tags: civicase
---


# Question
Title: In CiviHR, is it possible to display the open vacancies on the frontend?
Using CiviHR 1.4, is it possible to create some open vacancies and display them on the frontend, so that people interested in those positions can apply for them?

If it is possible, I couldn't figure out how to do it.

If it is not possible, do you know when this feature is planned for? I looked at this wiki page and I see that self-service is planned for version 1.5. However, from the descriptions there it wasn't really clear to me whether this would allow people to apply for open vacancies from the frontend.

# Answer
> 1 votes
Thank you for your interest in CiviHR.

Publication of jobs on the non-profit's website, and receiving applications from there will be part of CiviHR 1.6. It is scheduled for completion by the end of 2015 : http://wiki.civicrm.org/confluence/display/HR/CiviHR+-+Version+1.6+Basic

Hope this helps.

* Ruchi

---
Tags: civihr
---


# Question
Title: How do you visually update a select2 widget?
I'm trying to select the value of a select2 widget using js. I can change the value ok:

```
jQuery('#excludeGroups').val("846").trigger("change");

```

The problem I'm having is that this doesn't update the display. It *does* work in that when you submit the form it's the correct value - so it's working behind the scenes. But it doesn't actually change the display - the new value doesn't *appear* in the widget. The documentation suggests trigger("change") should do it. I'm not getting any console errors. Is there a trick?

# Answer
Figured this out. I needed to wrap my jQuery code in:

```
CRM.$(function($) {

});

```

The change trigger - and other select2 events - started working once I did this.
> 5 votes

---
Tags: select2
---


# Question
Title: How do I include the contact image in a profile?
I am trying to create a profile to display contacts who are in a specific group as an HTML listing which can then be output as a print directory.

The first field should be the contact image (although not all entries will have images). The only field I can find which seems relevant is Image-Url (Contact) - but that merely displays the URL as text. I tried adding formatting fields (Free HTML) before and after to wrap the output with , but that has made no difference.

I am linking to my output (it's on an intranet) as /drupal/?q=civicrm/profile?reset=1&gid=21&force=1&search=0

Most of the documentation on Profiles seems to be oriented to their use as forms, not as display formatting.

# Answer
If you are indeed using Drupal, a better option for displaying this information might be Drupal Views, which you can use to format and display most of the fields I suspect you would need for this kind of directory. (You could even use Views PDF to output it as a PDF document, if you really want to take control of formatting, text/image placement, and printability.) I'm not sure that profiles will get you where you need to go for displaying/outputting information.

Hope this helps, Lesley
> 2 votes

# Answer
I use the "Image URL" field on a profile on one of the sites I work on (although I change the label to simply "Image") and it shows up as an image with options to delete and reupload:

**EDIT:** I think I see what you are referring to -- not viewing a contact that already has an image, but uploading a new image. The image doesn't preview before saving, although it does show if you reload the contact in the profile after saving. So if that is the problem, I don't think I can help you! But if the point is just to get the image in there for future reference, it should be there (and display correctly) if you save the contact through this profile, and then view the contact again in the profile.

Preparing to upload (before saving):

After hitting save and loading the contact back into the profile:
> 1 votes

---
Tags: profile
---


# Question
Title: Generating extension menu when extension is installed
When my extension is installed i want the menu to be generated and added to the CiviCRM main menu as a new tab ie a main menu with subs under it so the user do not have to manualy do that, what is the best way of doing that? can that be done in my extension before given to be installed and tested? If possible, I need some pointers to that solution.

# Answer
It's strongly recommended you use the navigationMenu hook in your extension.php file.

```
function civisocial_civicrm_navigationMenu( &$params ) {
    $maxKey = ( max( array_keys($params) ) );
    $params[$maxKey+1] = array (
        'attributes' => array (
            'label'      => 'Civisocial',
            'name'       => 'Civisocial',
            'url'        => null,
            'permission' => null,
            'operator'   => null,
            'separator'  => null,
            'parentID'   => null,
            'navID'      => $maxKey+1,
            'active'     => 1
    ),
        'child' =>  array (
            '1' => array (
                'attributes' => array (
                    'label'      => 'Settings',
                    'name'       => 'Settings',
                    'url'        => "civicrm/admin/setting/preferences/civisocial"
                    'operator'   => null,
                    'separator'  => 1,
                    'parentID'   => $maxKey+1,
                    'navID'      => 1,
                    'active'     => 1
                ),
                'child' => null
            )
        )
    );
}

```

This will add a entry `Civisocial` in your navigation table along with a child called `Settings`.
> 2 votes

---
Tags: extension, gsoc, menu
---


# Question
Title: How do I modify the new 4.6 CiviMail form?
I am the author of a CiviCRM extension that needs to disable, depending on configuration, the URL tracking and open tracking checkboxes of the mailing form. In version 4.4 this was accomplished using hook\_civicrm\_buildForm (CRM\_Mailing\_Form\_Settings) and calling the freeze method on those elements.

This form hook is not getting called in version 4.6, so how would I go about doing this now?

Thanks for looking.

# Answer
> 3 votes
I ended up adding a small bit of javascript that waits for Angular to build the form, then it disables the checkboxes. Don't know if it's the right way, but it works.

```
CRM.$(function($) {

function disable_tracking() {
    var i = $('#tab-tracking').length;

    if (i > 0) {
        $('input[name="url_tracking"]').attr('disabled', true);
        $('input[name="open_tracking"]').attr('disabled', true);
    }
    else setTimeout(disable_tracking, 250);
}

if ( (typeof(CRM.crmMailing) == 'object') && (CRM.vars.sendgrid.track_optional == '0') )
    disable_tracking();

```

})

---
Tags: civimail, extension, hooks, developer
---


# Question
Title: Issue upgrading from 4.34 - Fatal Error (value: is not of the type integer
Have the following error trying to upgrade the DB, any help would be appreciated:

```
$ drush civicrm-upgrade-db
Exception: "A fatal error was triggered: One of parameters  (value: ) is not of the type Integer"
#0 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Utils\Type.php(362): CRM_Core_Error::fatal("One of parameters
(value: ) is not of the type Integer")
#1 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Core\DAO.php(1247): CRM_Utils_Type::validate(NULL, "Integer")
#2 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Core\DAO.php(1166): CRM_Core_DAO::composeQuery("UPDATE civicrm_
option_value\n        SET value = '{\"paper-size\":\"a4\",\"or...", (Array:1), TRUE)
#3 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Upgrade\Incremental\php\FourFour.php(176): CRM_Core_DAO::execut
eQuery("UPDATE civicrm_option_value\n        SET value = '{\"paper-size\":\"a4\",\"or...", (Array:1))
#4 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Upgrade\Form.php(683): CRM_Upgrade_Incremental_php_FourFour->up
grade_4_4_1("4.4.1", "4.3.4", "4.6.5")
#5 [internal function](): CRM_Upgrade_Form::doIncrementalUpgradeStep(Object(CRM_Queue_TaskContext), "4.4.1", "4.3.4", "4
.6.5", "C:\Users\Miles\AppData\Local\Temp\civA92E.tmp")
#6 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Queue\Task.php(88): call_user_func_array((Array:2), (Array:5))
#7 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Queue\Runner.php(213): CRM_Queue_Task->run(Object(CRM_Queue_Tas
kContext))
#8 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Queue\Runner.php(168): CRM_Queue_Runner->runNext()
#9 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Upgrade\Headless.php(67): CRM_Queue_Runner->runAll()
#10 C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\drupal\drush\civicrm.drush.inc(689): CRM_Upgrade_Headless->run()
#11 [internal function](): drush_civicrm_upgrade_db()
#12 C:\ProgramData\Drush\includes\command.inc(362): call_user_func_array("drush_civicrm_upgrade_db", (Array:0))
#13 C:\ProgramData\Drush\includes\command.inc(214): _drush_invoke_hooks((Array:29), (Array:0))
#14 [internal function](): drush_command()
#15 C:\ProgramData\Drush\includes\command.inc(182): call_user_func_array("drush_command", (Array:0))
#16 C:\ProgramData\Drush\drush.php(92): drush_dispatch((Array:29))
#17 C:\ProgramData\Drush\drush.php(61): _drush_bootstrap_and_dispatch()
#18 C:\ProgramData\Drush\drush.php(16): drush_main()
#19 {main}
WD php: Exception: A fatal error was triggered: One of parameters  (value: ) is not of the type Integer in       [error]

CRM_Core_Error::fatal() (line 328 of C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Core\Error.php).
Exception: A fatal error was triggered: One of parameters  (value: ) is not of the type Integer in CRM_Core_Error::fatal
() (line 328 of C:\xampp\htdocs\ma\html\sites\all\modules\civicrm\CRM\Core\Error.php).
Drush command terminated abnormally due to an unrecoverable error.                                               [error]

```

# Answer
> 1 votes
The code that is failing is trying to update a name\_badge format. It looks like 3 new types of labels were added at some point but one of them had an issue and this code is updating that one.

It looks for the id of name\_badge in the civicrm\_option\_group table. It uses that in this sql

```
 UPDATE civicrm_option_value
 SET value = '{$dimension}'
 WHERE option_group_id = %1 AND name = 'Fattorini Name Badge 100x65'

```

I'm guessing for some reason the array that feeds %1 is not an integer.

So what to do? You can, as link in the comment suggest, comment out the update. In this case in civicrm/CRM/Upgrade/Incremental/php/FourFour.php around line 176 comment out this code:

```
CRM_Core_DAO::executeQuery($query, array(1 => array($ogID, 'Integer')));

```

You might get the problem again with another upgrade.

You might check to see if the following sql comes back with anything

```
SELECT * FROM `civicrm_option_group` WHERE name = 'name_badge'

```

I think it will. If so, use the id in the following query.

```
SELECT name FROM civicrm_option_value WHERE option_group_id =

```

I think you should get back four rows

```
Avery 5395
A6 Badge Portrait 150x106
Fattorini Name Badge 100x65
Hanging Badge 3-3/4" x 4-3"/4

```

If you don't get anything back from the civicrm\_option\_group\` WHERE name = 'name\_badge' query check to see if the civicrm\_option\_value exists

```
SELECT option_group_id,
       name
FROM   civicrm_option_value
WHERE  name in ('Avery 5395',
                'A6 Badge Portrait 150x106',
                'Fattorini Name Badge 100x65',
                'Hanging Badge 3-3/4" x 4-3"/4')

```

I'm not sure how recommended this is but you can just add the missing name badge row to the civicrm\_option\_group table.

```
INSERT INTO `civicrm_option_group` (`name`, `title`, `is_reserved`, `is_active`, `is_locked`)
                        VALUES ('name_badge','Name Badge Format',true, true, false)

```

Now if you got any of the four option values back you'll need to change their option\_group\_id to match the id of the row you added with the insert.

---
Tags: upgrade
---


# Question
Title: Civicontribute: Missing payemnt options when required field missing or back button
I've hit some strange behavior on a contribution page. I consider payment usability a big issue.

Using a price set, have radio select for different donation amounts (need price set as different financial types). Also have an "Other" numeric field. Payment options has 2 choices: "pay by cc" or "pay by check".

This is a common use case. Unless you add an explicit "other" in the select list with a 0 value, the option list will show "none" as an option.

Setting a radio select field with numeric value \>0 works correctly. Setting a text / numeric input value \>0 works correctly.

Setting a radio with a select numeric = 0 AND a text numeric value \> 0 will not present the payment options but will increment the total.

Further problems when field does not validate on page or hitting back button - payment processor selection does not appear.

I see lot's of cc related issues but not this one please let me know if this is a known bug or a new one...

# Answer
> 1 votes
I didn't see a specific issue but this looks fixed in latest template file: http://bit.ly/1NecugN

---
Tags: contribution-page, 4.6.6
---


# Question
Title: Insert buttons in public registration forms
I am working on a module extension which allow users to Register via different social media/oauth accounts. These login buttons need to be added below all the forms which are anonymously available.

What is the best way I can achieve this?

* These buttons can be defined in a small smarty template file which can be inserted into the form.
* or can be created via JavaScript, which can be inserted into the page.

Please suggest what should be the right way to do it.

# Answer
You should use Smarty:

According to the CiviCRM Javascript Reference, public-facing pages should follow the principle of Progressive Enhancement.

"Front-facing pages like contribution pages and event signups should adhere to the standards of PE. All front-end pages should be fully functional with js disabled."
> 2 votes

---
Tags: extension, forms
---


# Question
Title: Quickly entering attendance with barcodes
I use CiviCRM for a non-profit organization that, among other things, organizes a yearly funweek for children. This year, we introduce event badges with a barcode. I was hoping to be able to use this to quickly register the actual attendance for each day.
The barcode value is entered into the External ID field of each child's contact record. On the event registration I have custom fields for each day of the week.
Our plan was to have one of the volunteers scan each barcode as the children enter the building, then I could easily add the event id, presence and an indicator of the day to this list as that would be the same for each line.
Unfortunately this doesn't seem to work, because it doesn't seem to be possible to update event registrations unless I know the event registration id. Knowing the External ID and Event ID is apparently not enough to make a match. I find this odd as I think it is illogical to have one person register twice for the same event.
Is there a way around it except by exporting all attendees and using the export as a lookup-table to add the event registration id to the import-file?

# Answer
> 2 votes
Maurice - we did something similar for a large event this year with multiple series of workshops running simultaneously.

Every participant was pre-registered in Civi. Each workshop was added as a separate Event in Civi. We printed barcodes of the participants' Internal Contact ID onto cheap Avery mailing labels - something like 3 inches by 2 inches - using the Event Badge template in Civi, and just pasted the labels on the back of the registration badge holder.

We then created a shared spreadsheet in Google Drive, with a worksheet for each workshop, and set up a volunteer at the entrance of each workshop with a wifi-connected laptop and a USB barcode scanner.

All the volunteer had to do was scan each bar code into the worksheet. It worked pretty well. One hitch was the size of the bar code produced from Civi is a little small, and we used cheap (we got them for about $10 each) old CueCat USB scanners I found through eBay. We then just imported the Participant IDs and updated the Event status for each workshop Participant as Attended.

Just in case, we had plain old paper sign in sheets for each workshop available and used those in some instances.

The biggest challenge of this technique is having enough volunteers, with available laptops, set up in advance with the USB scanner (and the correct driver software!) and decent wifi. Wifi isn't required but it was handy to have the scanned-in Internal Contact IDs for each Participant appear live in Google Drive while they were scanned in for the workshop.

# Answer
> 1 votes
Not addressing the main point but to help others who find this due to looking for 'barcode' there have been previous efforts in this regard, check

https://forum.civicrm.org/index.php?topic=23767.0

and

http://backofficethinking.com/blog/event-badges-infinity-and-beyond

# Answer
> 1 votes
Also, in the hope of helping others, since the question refers to 'quickly entering attendance' i thought it would be helpful to provide a link to this recipe which allows a Drupal user to tick people off as then enter, and then submit those updates via VBO to register them as 'attendees'.

# Answer
> 0 votes
You don't say if you already have a participant record for the kids so my answer may not be quite what you want, but we can get there I think.

Most basically you will need to have a little bit of custom code to look up the contact using your external id. (Next time consider using the contact id itself in the barcode). From that lookup you will have the contact id. With that and the event id which you say you know you should be able to use the api to look up the specific participant record you need.

Of course if you aren't preregistering, then you could just generate the registration right then.

---
Tags: civievent
---


# Question
Title: Why are Civi Events and Activities in Drupal Views Calendar showing incorrect times
Titles says it all. There are issues with how CiviCRM handles timezones which means they get displayed on calendars incorrectly.

# Answer
> 2 votes
According to Eileen "the meta fix for CiviCRM for timezone issues is to change the type of appropriate fields to mysql timestamps (which we actually do sometimes) but views calendar should just assume it's getting the data in whatever timezone it is in".

We found this post by SGladstone (thanks Sarah) which gave us a new direction to explore, and Chris has now done a PR for a fix based on that approach.

---
Tags: civievent, activities, drupal-views, calendar
---


# Question
Title: How to configure mail_report for every mailing?
I´m trying to configure the cron job mail\_report. I need an email to be sent to the address example@myaddress.com every time a mailing is sent. The screen to configure it is in the following image

What are the command parameters I need? I don´t see it clear in the "lear more" help..

Thanks a lot!

---

Hi davejenx, here´s another picture of what is happening now. I´ve put the id of the instance report (28 is the bouncing report). The log entry doesn´t seem to raise an error, but the screen gets blank on that url and does nothing :s

What I´m doing wrong?

Many thanks!

# Answer
> 3 votes
See Managing Scheduled Jobs, for mail\_report:

> Generates and sends a copy of the specified report instance to the email addresses configured in that instance's Report Settings.

So you specify the email address in the settings for the report instance, not in the settings for the scheduled job.

# Answer
> 0 votes
can you please tell me exactly where the settings of the report instance are? I can´t find them :s. I go to a sent mailing, click on report, and don´t find anything to configure..

Many thanks

---
Tags: civireport
---


# Question
Title: can't access to joomla administrator panel
after reinstalling civicrm on joomla, I can't access the administrator panel because "Fatal DB error, exiting, seems like your schema does not have civicrm\_setting table" - any idea? solutions? thank you...

# Answer
> 1 votes
SOLVED - I think this is not exactly the right way but I've deleted the civicrm folders in administrator -\> components, in components and in plugins -\> user (on the server) and the tables in the database... now I can access the administrator panel

---
Tags: joomla
---


# Question
Title: Mailing -> New mail results in blank page
**4.6.3 with Joomla 3.4.1 and PHP 5.4.4**, When clicking **Mailings -\> New Mailing**, I get a blank page with frozen CiciCRM menus and a single link back to the CiviCRM home page.

New mailing was working prior to upgrading both CiviCRM (from 4.1 ) and Joomla from 2.5. All other parts of CiviCRM are working.

I tried the Troubleshooting guide including disabling extensions but nothing works. Any ideas?

javaScript errors appear:

> Uncaught SyntaxError: Unexpected identifier ?option=com\_civicrm&task=civicrm/ajax/l10n-js/en\_US&r=TKdmc:5 Uncaught TypeError: Cannot set property 'userFramework' of undefined(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/l10n-js/en\_US&r=TKdmc:5(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/l10n-js/en\_US&r=TKdmc:76 crmApp.js?r=TKdmc:5 Uncaught TypeError: Cannot read property 'modules' of undefined(anonymous function) @ crmApp.js?r=TKdmc:5(anonymous function) @ crmApp.js?r=TKdmc:13 ?option=com\_civicrm&task=civicrm/ajax/menujs/2/en\_US/1/sG2nikkH:110 Uncaught TypeError: Cannot read property 'resourceBase' of undefined(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/menujs/2/en\_US/1/sG2nikkH:110(anonymous function) @ ?option=com\_civicrm&task=civicrm/ajax/menujs/2/en\_US/1/sG2nikkH:111 angular.js?r=TKdmc:63 Uncaught Error: \[$injector:modulerr\] Failed to instantiate module crmApp due to: Error: \[$injector:nomod\] Module 'crmApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.3.15/$injector/nomod?p0=crmApp at REGEX\_STRING\_REGEXP (

# Answer
RESOLVED: Answer is in Problem with CiviMail Menu on Joomla 3.4.1 - CiviCRM 4.6.2

Add to civicrm.settings.php define('CIVICRM\_CIVIMAIL\_UI\_LEGACY', 1);

That fixed it for now as this apparently won't be an option in 4.7
> 2 votes

# Answer
For those that are still encountering this, the problem seems to be the combination of CiviCRM 4.6 and Joomla 3.4.1. If you upgrade to Joomla 3.4.3 though the problem is resolved without having to add the line above to your settings file.
> 2 votes

---
Tags: civimail, joomla, 4.6.3
---


# Question
Title: Coding of civimail header body and footer - best practice
I've seen several questions about how to use civimail header/footer but can't find a best practice for coding.

I know email coding can be hairy especially since clients handle things differently and there is no "standard." I've done some basic homework. CSS styles are typically inline. There is usually the standard HTML document structure with DOCTYPE, head, and title tags. The styles are placed in the /head section. The "problem" is that (as I understand it) HTML requires only one /head /body tag. So if we want HTML in the Header / Body / Footer how should it be coded? Is there a post-process to strip or merge tags? Sorry if this is naive, this my first foray into email coding.

Note: I tried to put all the styles in the template header but they were ignored in the body (probably a scope issue.)

I see a related question: How can I use \<html\>, \<head\>, \<body\> tags in a mailing? however, I'm not using CKeditor and still have issues.

Do we need some sort of Wrapper Template defined?

# Answer
> 3 votes
I've been using something like this by adding HTML to the CiviMail Header and Footer options.

It works nicely, wraps around the content area so that no HTML has to go in that area if not wanted to do so. Works best with Single column newsletters, which I believe work best on mobile anyway.

# Answer
> 1 votes
I've created a header and footer that "wraps" the body HTML similar to what @Dana has done, but ours has a tag that includes a link to a CSS file. We then use an extension which converts all styling to inline CSS as the email sends. It's worked really well for us and has allowed for some decent flexibility in email layout and style.

https://github.com/eileenmcnaughton/nz.co.fuzion.cssinline

# Answer
> 0 votes
I doubt this is "best practice" but thanks for the hint from @Dana I used all css styles and meta in the tag and closed it.

I kept the open in the header. Made sure the template HTML does not have any or tag anywhere. Then added the closing and in the footer.

This is definitely hackish but seems to work. I don't know if the html parsing is supposed to do this but a nice feature might be to have an option for each of these (header/body/footer) to strip the head, html and body tags when creating a template. but love to hear a better way to do this!

---
Tags: civimail, email, message-templates
---


# Question
Title: scheduled mailings dont send - civicrm4.1
If we schedule a mailing, they only ever say running in the status column but never get sent. The only way they send is if we hit "execute now", so at least we know they are no email config/password issues.

I have little experience with Drupal, CiviCRM and Linux, so don't even know where to look for logs.

CiviCRM is running off Drupal on a Linux Ubuntu vm, I've found version number for CiviCRM is 4.1, Drupal is 7.34, php is 5.59 and MySQL 5.541.

I have checked under the scheduled jobs (administer \> system settings \>schedules jobs) and found

I don't know where to look for the cronjob and which user it uses though. I checked the drupal user permissions and all authenticated users can view etc anythng civimail related.

I have no civicrm experience (i didnt install this), no drupal and little linux, I would appreciate some help. I have tried following instructions on the civi site but they are not clear enough.

Thanks

# Answer
> 0 votes
Generally I have found that, if a mailing is stuck as "running", but does correctly run when "execute now" is clicked, that you have a permissions problem.

When you "execute now" the mailing is executed using the permissions of the currently logged in user.

The cron job however usually runs as a different user. This user needs minimally to have a few permissions set: view all contacts, access CiviCRM, access CiviMail.

I would first track down your cronjob to find out what user is referenced in it. Without more details on your hosting platform its a little difficult to help you with that. If you have SSH access, try issuing a command line: crontab -l. If your hosting provided gives you cpanel or similar, you may be able to view the cron jobs with that.

---
Tags: civimail, cron-job, scheduling
---


# Question
Title: Assign two different emails for two different groups (but only one contact)?
Is it possible for one contact to subscribe to two different groups with two different emails – or will CiviCRM always send email to the primary email address?

IOW, is this possible?:

```
Robert Smith has two emails and is subscribed to two groups:
1. Group A sends to robert.smith@work.com
2. Group B sends to bob@home.com

```

# Answer
> 4 votes
You can create a location type for each group - collect emails for that location using a profile.

Then when emailing click options (the spanner icon) for recipients to choose the location.

See answer + screenshot at Add non-Primary email address to Group by Fabian

---
Tags: civimail, email
---


# Question
Title: How to exclude multiple contact displays in Drupal view with contact-user relationship in CiviCRM multisite setting?
I need to create a Drupal view (CiviCRM contacts) displaying the staff of an organisation. The view has the relationship CiviCRM contact \<-\> Drupal user enabled. This seems to be required to be able to display the Drupal user images.

Now comes the tricky part: The Drupal site where the view is created is an offspring of a CiviCRM multi-site setup. This means staff members usually have a Drupal account for domain 1 (the central CiviCRM) and domain 2 (the multi-site offspring where the Drupal view lives). In the DB this means they have 2 records in `civicrm_uf_match`. Now if the relationship is enabled AND the user image field is included, the view displays those contacts twice. Removing the relationship results in losing the user images.

Any clues to a solution would be very welcome.

# Answer
I don't have time to dig out an example but you should find you can add a Views Filter and specify the civi Domain. May depend on whether your View is starting with the Drupal User or with the CiviCRM Contact.
> 2 votes

---
Tags: drupal-views, multisite
---


title: WordPress / CiviCRM permission?

text:
# Question
Title: WordPress / CiviCRM permission?
The is a screen for an individual contact to update their own information. We use Profiles and just added it to the WordPress page via shortcut.

As you can see in attached screenshot, some pieces of information available in the database are displayed in form fields to be edited but other are only for viewing. We however also would like the member to update their own addresses as well.

We are aware that this contact has 'use other contact's address' enabled, so it's pulling it from it's household address. This contact has permission to edit the Household's address. Is there a way to have that address made editable in this profile?

Is that possible?
How can this be accomplished? Any ideas would be greatly appreciated.

CiviCRM 4.6.6 / WordPress 4.2.4

Birgit

# Answer
> 3 votes
I had not seen this before, but on testing ( CiviCRM 4.6.6 and WP 4.2.4 using an admin with full permissions) I get the same behavior you do. In the back end (or in Drupal) we can click on a link to the Address record and if we have permission to edit, we can.

When you insert the shortcode in the page, you are editing the current user's profile/contact info. In the profile form there is no way that I can see to edit the 'master address'.

I took a look at using the Contact Dashboard as we've used this for a similar purpose between Orgs and Contacts, but the relationship that is created when sharing the address does not show here.

It does look to me like this is a limitation of editing the contact on the front end via shortcode as opposed to editing in the admin.

---
Tags: wordpress, profile, contact-view
---


# Question
Title: Profile add-to-group feature doesn't work with petitions
In both the Contact Profile and Activity Profile, I've set the "Add new contacts to a Group" drop down to the desired group, but when contacts sign the petition they are added only to the Petition Contacts group.

Is there a way to automatically assign petition signers to a specific group?

# Answer
This is probably a bug (or, perhaps more appropriately, an incomplete feature). There have been a number of features that apply everywhere but in petitions--it's newer than some other features, and it doesn't have as many users as contribution pages or event registrations.

To double-check, visit a demo site (found via https://civicrm.org/demo) and confirm that the same thing happens. Double-check (on your site and the demo) that you haven't checked the "Enable Double Opt-in for Profiles which use the 'Add to Group' setting" in Administer - CiviMail - CiviMail Component Settings, as that may indicate a problem with the opt-in emails going out (though you'd see problems with contributions and events too in that case).

Finally, assuming the problem's on the demo too, submit a bug report at issues.civicrm.org.
> 1 votes

---
Tags: profile, groups, civicampaign
---


# Question
Title: Potential fix to long term issue with IDS errors on Event Confirmation emails through ActivityProcessor
A long time ago, I raised an item in the old forum about an issue I was experiencing with Event Confirmation emails sent to the Email Activity Processor being rejected with this message:

```
Failed Processing: Registration Confirmation - [event name]. Reason: Illegal characters in input (potential scripting attack)

```

See my original posting here: https://forum.civicrm.org/index.php?topic=29606.0

I have finally diagnosed and fixed this problem.

The common SocialNetworks.tpl template is used to load a block of HTML to add social network buttons. This is used on web pages and in email confirmations. It contains a call to include a Google APIs script and it is this that is causing the IDS attack alert.

My simple resolution is to move this script inclusion from line 27 to line 45 so that it is inside an IF clause that only applies to web pages.

Sorry - this isn't really a question, so let me make it one. Do you agree with my diagnosis and should I apply a patch?

# Answer
Despite getting a Tumbleweed award for this, I have submitted a fix

See https://issues.civicrm.org/jira/browse/CRM-17030 and https://github.com/civicrm/civicrm-core/pull/6508
> 2 votes

---
Tags: civievent, templates
---


# Question
Title: Forwarding of CiviMail to addresses on same hosting service fails
I have email accounts at the hosting service that hosts my CiviMail 4.6.2 in WordPress 4.1.7. The accounts forward mail to other addresses. I.e. CiviCRM is on www.mydomain.com and the addresses are @mydomain.com, but the mail is forwarded elsewhere.

Non-CiviMail email from CiviCRM to these @mydomain.com addresses is received but CiviMail is reported as "success" but is never received, not seen as spam. CiviMail to other addresses (@elsewhere.com) is received. (In a CiviMail mailing that includes both @mydomain.com and @elsewhere.com the @elsewhere.com posts arrive and @mydomain.com posts don't.)

CiviMail to @mydomain.com used to work, apparently stopped several months ago.

What configuration should I be looking at in order to get this going again?

(Most, but not all, of the @mydomain.com addresses forward to Google Apps mail servers. However the non-receipt affects all @mydomain.com addresses, not just the ones handed on to ASPMX.L.GOOGLE.COM .)

# Answer
The hosting company mail server was objecting to VERP mailoxes like
`Return-Path: b.544.88425.a5cada51f4f1fa94@mydomain.com`
that are not prefixed with a real mailbox, treating them as unknown addresses and discarding the post. The discarding is noted in the logs, which are not available to me.

There is a setting CiviCRM \> Adminster \> CiviMail \> Mail Accounts
in which "Localpart" of the Bounce record needs to be a host mailbox followed by "+" e.g "reply-mail+". (There is also a setting "Return-Path" which seems to be ignored, at least if VERP is being used.) Localpart gets prefixed to the VERP addresses to make, e.g.
`Return-Path: <reply-mail+b.578.89179.a1e28883fd23b0e3@mydomain.com>`
and the addresses are no longer seen as unknown and the posts are sent on their way. Delivery was ultimately successful to Gmail apps mail (where it usually went to the Promotions tab) and to other services.

This post is pertinent.
> 3 votes

# Answer
I suppose you have done the obvious thing of making @mydomain.com an allowed sender on all you accounts?

I am only asking because starting a few months ago we have found that CiviMail emails that previously was being delivered successfully to @gmail.com or @hotmail.com accounts started to just 'vanish' (not received and not in spam). Specifically listing @ourdomain.com as acceptable in those accounts stopped the emails from 'vanishing".

I realise you are talking about @mydomain.com email addresses, but the timing and the fact that the emails 'vanish' made me think it was worth mentioning.
> 0 votes

---
Tags: civimail
---


title: Allowing contacts of contacts?

text:
# Question
Title: Allowing contacts of contacts?
**Background**

We're a membership association for music groups, and are in the process of building our new website, using Civi as both the CRM and for some of the functionality, events etc., of the website (along with Drupal).

**Challenge**

We would like to try to find a way (in the future) to offer group management tools (e.g. simple contact lists, civicontribute for fees and events etc.) to our members *themselves*.

I don't think that this is currently possible with Civi, as it would need two levels of data structure, i.e...

1. Our CiviCRM/website interface: organisations with contacts, payment processes and membership management etc.
2. Members' CiviCRM/website interface: THEIR own contacts database, THEIR own payment processes for THEIR own membership subscriptions etc.

..but I wondered if anyone has ever tried or thoguht about trying something similar?

Apologies if this is a stupid question, but I'm relatively new to Civi, so not sure what whizzy-amazing functionality might be possible.

# Answer
> 5 votes
Evan from IMBA here. Sorry for replying in a new answer, I don't have the required 50 points of reputation to comment in reply specifically to Lizz Trudeau's answer. I just watched the video Jason (my predecessor) gave at CiviCon 2012, and it gives a really solid overview of how we've tackled this and for the most part we're still set up this way. We've made improvements and enhancements along the way as new features become available in Civi, but the bones of what we're doing are the same. There are loads of things to consider when deciding on a tiered implementation, and a couple of good ideas have been thrown out already. Here's my take on what we've done vs. other solutions presented:

1. **CiviCRM Multi-Site:** for us at the time, we didn't have the need or capacity as an organization to support this structure. In our revenue share model, all membership funds are processed and collected by the parent organization and then dispersed quarterly to the chapters. We could certainly set up the payment processors, etc. for each chapter but restricting access to change settings like this would have been an issue. This remains a viable option for us in the future, as our chapters grow in function and capacity. Particularly if we enable a Drupal multi-site structure where IMBA offers chapter website hosting as subdomains of the main site. It's on the table for consideration in 2016.
2. **Relationship Permissions as ACLs** has my attention. Our method of using a multi-select custom data field to track multiple contact-to-chapter relationships works pretty well, but can be a little cumbersome and finicky when importing large lists into Civi and a few other tasks. Using relationships as ACLs could be a better way of handling this, but might also trade one set of challenges for another. I think if we were starting from the ground up, this would be a solution we would strongly consider, right now making the change seems rather daunting. We would still need to use custom data fields to track the revenue share component of contributions, to the best of my knowledge.
3. **Using Custom Data Fields to Create Groups and ACLs** has worked pretty well for us over the years, has been scalable through multiple Civi updates starting with 3.x all the way to 4.6. We've built some custom code to support it here and there such as increasing efficiency in the back office during data entry, but as Jason said in the video it's largely out of the box functionality. What it doesn't give our chapter admins permission to do is use their own payment processors, access to CiviEvent, etc. There are some pain points but largely it works well. In some ways it's a similar approach to the Relationships, and I think each would have their own challenges and strengths. Co-branding with our chapters is super important, and using the custom fields allows us to pull that data in searches, reports, and other lists which are then sent to vendors for doing membership fulfillment, renewal messaging, and even some region- or chapter-based variable content in our quarterly print magazine for instance. We're also making some changes to these custom fields to (hopefully) enable us to place custom tokens into email messaging as well.

Challenges we face:

1. **Better signup UI:** Right now we still have just one user workflow on the /join page, and I'd like to revamp this so we send renewing members directly to a contribution page for their specific chapter, rather than sending them through the "join" workflow which requires them to select their local chapter each time. This should be possible using the custom data fields as tokens and contact hashes. We now have over 180 chapters, and having a giant dropdown select is not a good UI solution. We've got some ideas in the works with Fuzion that will address the signup process and provide a better experience for visitors, but still capture revenue share data as needed.
2. **Living with your neighbor's dirty laundry:** this remains a bit of an issue with certain features of Civi not easily quarantined via ACLs. That all users can see the entire "From" email address list is one of these things, although minor. A larger one is that our chapters would like us to support Event Registration for their local events, but enabling those users access to CiviEvent grants them access to all other events in the system, not just their own. This may have changed since last I looked, but it has been a sticking point of opening up this feature to our chapters.
3. **Growing our chapter's contact lists:** Each "CHAPTER All" ACL group is a smart group based on that chapter's name being in the multi-select custom field. Each chapter's territory is defined by postal code. When a chapter is integrated, we import their list of contacts and also search out any existing contacts in their zip code territory, and add this chapter to that custom field for all these contacts. So the only time we place existing contacts in a chapter's partition (share back contacts from the main IMBA DB) is when the chapter is integrated. As new contacts come to the main IMBA database, they're not being actively shared back the appropriate chapter's partition. This was a conscience decision made years ago, but one that has recently changed. We have an extension that updates a contact's region based on zip code, it will be more challenging to update the chapter affiliation of a contact as each contact can be visible to multiple chapters. *(NOTE: a contact can be associated with a chapter outside of their zip code by opting in, attending a fundraiser and signing up for email newsletters is an example of this)*
4. **Accommodating members who wish to join multiple chapters:** Pretty self-explanatory here. Some of our members want to belong to more than one chapter. Summer home, favorite vacation spots, etc. Our preference would be to NOT implement 180+ membership types, so we're still brainstorming ideas for a solution. And the reality is, right now this challenge lies in sorting out the business rules and requirements, not in database or CRM limitations.

That's just an overview from our perspective, I'm sure I could ramble on and on about everything we've done that's worked and hasn't but I really should get back to testing some new functionality. Feel free to ping me with questions, I hope I helped.

# Answer
> 4 votes
Two ideas come to mind:

1. If you're more of a federated organization where it would be natural for your members' contacts to be in your database, you could set up a multisite installation.
2. You could offer an easy way for them to launch their own CiviCRM. You might manage them using Aegir, or if that's more responsibility than you want, you could even just build an extension that makes some common configuration changes that your members would want. (My company did this for the National Democratic Institute to provide easy-to-start CiviCRM sites for political parties in emerging democracies.)

# Answer
> 3 votes
It will depend on how much of the setting up you (a superadmin) will take care of, eg will you add 'their' payment processors and perhaps set up their Membership pages, to avoid the risk of 'them' doing that step themselves and setting an incorrect payment processor on their membership page etc.

Multisite does add the ability/complexity so that each sub-org (domain) has its 'own' membership pages and payment processors, which is good. But that also may mean higher level training of sub-org Admins than is ideal.

There is another approach which can get you a long way towards this without multisite. Eg, using the "Relationship Permissions as ACLs" extension together with Webform you can easily cook up a system so that your sub-organisations can sign up people who then are added to their 'container'. And hence your sub-org admins can access CiviCRM and be restricted (in most situations) to only accessing their contacts.

This ACL approach allows for multiple 'cascading' levels.

# Answer
> 1 votes
I recall https://www.imba.com/ having this setup as a chapter program. I saw information about this a while back at http://vimeo.com/channels/civiconsf2012/40545511

# Answer
> 1 votes
Future First has a portal where their members can log in, view, edit, email, and search by their contacts.

Most of this can be achieved by cleverly configuring Drupal. Happy to supply more details on request - message me!

# Answer
> 0 votes
Depending on how much functionality you want to offer your members, you may be able to construct your own Views and Webforms to serve their needs.

---
Tags: civicontribute, drupal, civimember, acl
---


# Question
Title: Where should I put static files in my extension that are just used in certain few pages?
I need to use few static files(images, css) in one of my template. Currently I am using a CDN link to the same, but in practice storing the same within the extension will ensure the availability even if the links stop working.

Where should I put such files in my extension, should putting them in the template folder itself is the right practice?

# Answer
> 3 votes
Typically your extension directory would contain subdirectories named `css` and `js` and resources of those types would go in there.

To load them on-demand, use CRM\_Core\_Resources.

---
Tags: gsoc
---


# Question
Title: How Can I Incorporate Profiles in CiviEvent Backend?
I am trying to work out how to update custom profile information from the civievent back-end, however I can not get a profile to appear for updating.

Scenario: We are running an event where delegates can either sign-up via our website, or via a paper form. We need to collect specific information for the event such as access and diet requirements. An organiser will be responsible for inputting details from any paper forms received.

---

I have a profile set up with the additional information which works as expected when used for an online booking and exports without an issue. I have enabled for this profile:

* Used for Standalone Form or Directory, CiviEvent\_Additional, Search Views
* Type Associate, Contact, ParticipantEventName::

So, I would have expected this to allow me to input this information either:

* when I go to civicrm/participant/add?reset=1&action=add&context=standalone&eid=XX but it does not appear there
* or when I search for participants, highlight them and try to *Update via Batch Profile* but it does not appear there either

*Of Note: the profile used in the same event used for CiviEvent does not appear either*

I did think that I might have to import the data via a CSV, but there must be an easier way that I am missing.

# Answer
> 1 votes
this isn't a direct answer to the Q but may be what you want. At the top of Events registration page you should be able to see eg Welcome Joe Doe. (Not Joe Doe, or want to register a different person?) (eg at demo site)

If you click on that option you should then get to a url with cid=0 such as http://d46.demo.civicrm.org/civicrm/event/register?cid=0&reset=1&id=3 and this should allow a back-end user to register someone using the same Profiles etc that anyone would use via the front end.

Is that what you need?

---
Tags: civievent, profile
---


# Question
Title: What is recommended using Drupal web services or CiviCRM APIs
What is recommended to collect data from CiviCRM to external Drupal application and why? Drupal web services or CiviCRM API

# Answer
I think that you should call the CiviCRM API directly. This allows you direct access to the CiviCRM system.

If you use Drupal Web Services you still would need to wrap the services around CiviCRM API calls (or direct calls if needed).

So Drupal Web Services just adds additional complexity to something that the CiviCRM API does an excellent job of all ready. Just use the CiviCRM API services.
> 7 votes

---
Tags: drupal, cms-integration
---


# Question
Title: Search for people who have NOT registered for an event
I am trying to search for any person within a specified group in Civi that has NOT registered for a specific event. The intention is to then send them all an e-mail to ask why they have not yet registered, encourage registration, etc.

I'm stumped as to how to search for people who have not registered for an event.

Thanks

# Answer
> 4 votes
First, create a group of people who have registered. Next, go to **Search menu \> Custom Searches**, and select Include/Exclude by Group/Tag. Include the group of people who should have registered, exclude those who have already registered, and there's your list.

I believe you can also do a similar include/exclude search using Search Builder in Civi 4.6, but this was broken in earlier versions so I haven't tried.

---
Tags: civievent, search
---


title: how to create mail address labels

text:
# Question
Title: how to create mail address labels
How do you generate a list of (snail) mail address labels (for envelopes)? I see how to generate an email list, but not a mailing address list turned into labels.

thanks!

# Answer
After searching you can choose the action "Mailing Labels" that does this. This creates a pdf file you can print. And in the menu under Communication \>\> Label Formats you can define the label formats you want to use.
> 6 votes

# Answer
you should find an option under Actions from a search result that says "Mailing Labels". Is that all you need?
> 1 votes

---
Tags: address-labels
---


title: How to rebuild civicrm admin menu?

text:
# Question
Title: How to rebuild civicrm admin menu?
I just upgraded civicrm from version `4.5.8` to `4.6.6`, and I found that the menu is looking different. I tried clearing cache, also tried manual deletion of template files under `files/civicrm/templates_c/`.

# Answer
Found out that the query for creating `Support menu` \[parent item\] didn't get executed. Had to run the sql query manually. This fixed the menu issue.

`vim civicrm/sql/civicrm_navigation.mysql +605`

```
INSERT INTO civicrm_navigation
    ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
    ( @domainID, NULL, 'Support', 'Support', NULL, '',  NULL, '1', NULL, 110);

```
> 1 votes

---
Tags: drupal, upgrade, menu, global-menu
---


# Question
Title: Restore default "mailing footer" in civicrm WordPress 4.2.4
Is it possible to restore the default header and footer?

CiviCRM » Administer CiviCRM Headers, Footers, and Automated Messages

I edited the header and footer and now when I try to send a group email, I get this:

This message is missing a required token - {domain.address}: Domain address - displays your organization's postal address. This message is missing a required token - {action.optOutUrl or action.unsubscribeUrl}: 'Unsubscribe via web page' - creates a link for recipients to unsubscribe from the specific mailing list used to send this message. Alternatively, you can include the 'Unsubscribe via email' token or one of the Opt-out tokens.

# Answer
You don't have to reset the default to fix this problem.

In your CiviCRM mass mailing, you need to have the following piece of code (tokens) :

* `{domain.address}` which will display the full address of your organization as defined in the menu Administer -\> Communications -\> Organization Address and Contact Info (`https://yourwebsite.org/civicrm/admin/domain?action=update&reset=1`)
* `{action.optOutUrl}` or `{action.unsubscribeUrl}` to allow the contact to unsuscribe to the mailing

Both tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act.

You could put the tokens either in the footer / header but you don't have to. You could also add them in your email content.

Also, while not recommended, you could deactivate those verification by checking option `Disable check for mandatory tokens` in menu Administer -\> CiviMail -\> CiviMail Component Settings (`https://yourwebsite.org/civicrm/admin/setting/preferences/mailing?reset=1`)
> 2 votes

# Answer
I don't think there is a 'restore' but if what you want is what comes out of the box then you can go look at what is on the Demo site as I suspect these very rarely get edited eg http://d46.demo.civicrm.org/civicrm/admin/component?action=update&id=2
> 0 votes

---
Tags: wordpress, header-footer
---


# Question
Title: Contribution forms with numerical quantities is not taxed properly
We've got a 14.975% tax rate in the province of Quebec in Canada.

the taxes are rounded to the 2nd decimal so we lose information.

The taxes should be calculated on the subtotal instead of the unit price.

Thanks for helping!

The calculation is now (100\*(1+0.15)) but should be (100\*1)\*1.14975

# Answer
This patch has solved my problem:

https://github.com/civicrm/civicrm-core/pull/6520/files

PriceField tax\_amount should not be rounded
> 1 votes

---
Tags: civicontribute, taxes
---


# Question
Title: how to configure civimail when using Google mail?
My mails are not being sent, even when I choose to send immediately.

My domain uses Gmail servers to handle our email accounts.

I'm assuming my settings at /civicrm/admin/mailSettings?action=update&id=1&reset=1 are not correct but I can't find any good tutorials. The documentation is not helpful to me.

# Answer
> 6 votes
It's possible to use Google Apps or GMail SMTP directly, but you will have to deal both with limitations of remote SMTP and with any resource limits enforced on your account (esp if using an @gmail.com or similar address).

If you have control of your server, I recommend using Postfix as a local MTA and configuring it to smarthost via Google Apps.

* You'll see much better performance from CiviCRM if it can hand mails off rapidly to a local MTA, and
* Postfix is far better at conversing with Google SMTP than CiviCRM.

See How do I configure SMTP with STARTTLS? (related question/answer) for why that is.

### How to do this via Postfix relay instead

(This requires control of your hosting environment.)

In `/etc/postfix/main.cf`, configure

```
relayhost = [smtp.gmail.com]:587
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

```

In `/etc/postfix/sasl_passwd`, enter

```
[smtp.gmail.com]:587  yourusername@example.org:password

```

Run `sudo postmap /etc/postfix/sasl_passwd`

Run `sudo service postfix reload`

Now use local mail delivery, and watch `/var/log/mail.log` to ensure it gets handed off to Google's servers for delivery.

---
Tags: civimail
---


# Question
Title: How can I add an additional email id for "work" through API?
I need to add an email id to a CiviCRM contact through the API. Existing email ids of the contact should be kept unchanged and the new email added as type "Work" (the contact doesn't have any "Work" emails yet, if that should make it easier).

I tried to find a suitable API call through the API Explorer (civicrm/api/explorer) but the autocomplete didn't offer an Email field anywhere.

I also found an old forum post using some `civicrm_location_update($params)`. But this left me confused and I can't find anything like it in the API Explorer.

# Answer
> 4 votes
Here is an example for creating a new email on an existing contact. Note that the default "Work" is location\_type\_id 2:

```
  $params = array(
    'contact_id' => 99,
    'location_type_id' => 2,
    'email' => 'myemail@work.com'

  try{
    $result = civicrm_api3('Email', 'create', $params);
  }
  catch (CiviCRM_API3_Exception $e) {
    // Handle error here.
    $errorMessage = $e->getMessage();
    $errorCode = $e->getErrorCode();
    $errorData = $e->getExtraParams();
    return array(
      'error' => $errorMessage,
      'error_code' => $errorCode,
      'error_data' => $errorData,
    );
  }

```

---
Tags: api
---


# Question
Title: Why are taxes calculated incorrectly when "other amounts" enabled on contribution page?
CiviCRM 4.6.5, Wordpress 4.2.3

When I create a contribution page, I choose the financial type on which there is my taxes financial account linked.

The amount that the user can pay is decided by the user. So there is only "Allow other amounts enabled".

The tax financial account have a 14.975% rate.

When I put my page online and I try to make a contribution, I get a tax amount of 0.15% instead of 14.975%.

When I make a contribution manually with the same financial type, the taxes are calculated the right way.

If I put a precise amount with "Allow other amounts" disabled, the taxes are also calculated the right way.

Thanks for helping!

Whatever amount I put, the "Total tax amount" is equal to the Tax rate.

# Answer
> 0 votes
The real issue is still unresolved, please help!

https://issues.civicrm.org/jira/browse/CRM-17034

# Answer
> 3 votes
This patch solved my issue by using a real priceset:

https://github.com/civicrm/civicrm-core/pull/6520/files

Details here:

Contribution forms with numerical quantities is not taxed properly

Thanks!

---
Tags: taxes
---


title: Using hooks -- simple please

text:
# Question
Title: Using hooks -- simple please
I am excited to be working with civicrm, but I am quite frustrated at this point and so I hope someone can help me.

I can see how valuable hooks are, and it seems like they are actually very basic to implement, but I need a small amount of pre-knowledge to use them. I have read every link I could find about hooks to change forms and yet I find myself lost.

I did find one example that fit my needs exactly, and would be a great learning experience ... but the description leaves out a lot of necessary information for someone as new as me.

Can someone walk me though implementing this? It comes from How can I set “Assigned To” for an Activity to default

The extension mentioned in the comment above is:

`function myextension_civicrm_buildForm($formName, &$form) {
 if ($formName == 'CRM_Activity_Form_Activity' && $form->action == CRM_Core_Action::ADD) {
 $form->setDefaults(array('assignee_contact_id' => $form->_currentUserId));
 }
}`

* How do I find the 'create activity' form this relates to?

> I got that answer myself -- **CRM** _ **Activity** _ **Form** _ **Activity** means the php file is in
>
> /var/www/drupal/sites/all/modules/civicrm/**CRM**/**Activity**/**Form** and then **activity.php**

* Do I copy the form to my /var/www/drupal/sites/all/modules/civicrm\_extensions directory?
* Do I put that function inside the form I copied?
* Do I create that as a file?
* If a file, what do I name it?
* Where do I put the extension once I create it?

You are all very helpful and I appreciate it. Thank you in advance for any help you can give me on this problem I face.

Just a note about searching for answers: About a month or two ago I found a web page that explained some of this to me but for the life of me I fail to find that page today. I did find a lot of links that looked like they could help but a whole mess of them led to (Page Not Found) on http://wiki.civicrm.org/confluence/display/CRMDOC/. Seems a lot of pages were deleted or renamed.

Thanks again.

# Answer
> 5 votes
To use a hook, you can:

* Write a CiviCRM extension. This is the preferred method.
* Write a Drupal module.
* Write a Joomla or Wordpress plugin.

The easiest way to write a CiviCRM extension is to install civix and run `civix generate:module org.myorg.myextension`. Then you can edit myextension.php and paste in that code.

However, as that page says - this presumes that you have a basic knowledge of PHP, Unix, and object-oriented programming. If that's not a skill you're going to learn today, and you want to cheat a little - take an existing extension and hack it! Download an existing function, preferably one that does very little, and modify it to your needs. I just uploaded an extension to Github that fits this need exactly here.

# Answer
> 2 votes
There is also a pretty basic example here: https://github.com/CiviCooP/no.maf.oppgavexml This extension creates 2 files, introduces a page and a form. Might be able to give you some more understanding. But the real recommendation would be to take part in a CiviCRM developer training or CiviCRM sprint? Depending on where you are in the world you might be interested in a developer training in London that is coming up?

---
Tags: extension, activities, hooks
---


# Question
Title: How to use existing scheduled email function programmatically in extensions?
I need to send payment page links to user on schedule basis, is there any way to use existing scheduled email functionality trough custom extension?

# Answer
> 1 votes
you need to create an API in order to use schedule jobs

look for table called civicrm\_job and make an similar entry for the newly created API and this will create an entry in schedule jobs

you can create an Extension first and then API in the Extension find the below link http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension

if you need more help please let me know

---
Tags: civimail, email, gsoc, mailing
---


# Question
Title: Migrating to Pantheon: How to make CiviMail editor insert images with non-relative refs?
When our site migrated to Pantheon, all the images in a mailing became broken when the mailing was received.

I saw this (https://stackoverflow.com/questions/27569280/civicrm-civimail-images-are-relative-urls) but the question is only partially answered.

I can't see any settings in the menu for the editor. How do I make the WYSIWYG editor for mailings provide absolute URL refs? Otherwise the images look fine in the preview but are all broken when the mailing is sent.

To clarify, the refs are coming out as "/sites/default/files/civicrm/image.jpg" instead of "http://mysite.com/sites/default/files/civicrm/image.jpg" and that is why they are broken.

Any help would be appreciated. Thanks!

# Answer
When CiviCRM is on Pantheon, it needs a special set of config in the civicrm.settings.php which defines various variables to make CiviCRM work in cloud hosting.

I had to add this variable to that list:

```
$civicrm_setting['URL Preferences']['imageUploadURL'] = 'http://www.mysite.com/sites/default/files/civicrm/persist/contribute/';

```

Then I had to make sure that the "system settings"-\>"Directories" was pointing to the same folder. Then it worked!
> 3 votes

# Answer
Have you tried to override the CKEditor config file? You could set `baseHref` to `http://mysite.com` (config reference). I think this will do what you need.
> 2 votes

# Answer
Please make sure all the images are accessible over the web on its own and then send the email
> 0 votes

---
Tags: civimail, wysiwyg
---


title: Tokens in greetings not replaced

text:
# Question
Title: Tokens in greetings not replaced
I implemented miscellaneous custom tokens and have been using them successfully in mailings and pdf generation.

But in context of greetings I came across some weird misbehaviour. I tested by changing email greeting and running api job.update\_greeting w/ force=1.

1. When extending the token array's "contact" key with a custom token, the {contact.tokenname} markup get's interpreted but not replaced. Result is '{contact.tokenname}'.
2. When using custom key the markup {keyname.tokenname} is not recognized and even doesn't get into the hook function's token parameter. Result is '' and Smarty reports »unrecognized tag«.

Both tokens run fine in pdf generation.

I'm running latest Drupal 7 and CiviCRM.

Any ideas?

Thanks in advance

# Answer
> 2 votes
I filed an issue and kind of half-fixed it so that `{customkey.tokenname}` shaped tokens should work. If my approach is valid this may also fix Error for token.php related to greeting tokens

My issue: https://issues.civicrm.org/jira/browse/CRM-17038

# Answer
> 3 votes
It sounds like the hook isn't being called (or not called correctly) when processing the update\_greeting job. I think that qualifies as a bug and you could file it in issues.civicrm.org. But due to the high volume of issues, a core team member may not be available to jump on it anytime soon. I'd suggest you keep on with your debugging and compare the code that runs during that scheduled job to the code that correctly uses the hook and see how they differ. If you are able to come up with a patch that even partially addresses the problem it would help the issue get a lot more attention (issues with patches get bumped up in priority).

---
Tags: tokens
---


# Question
Title: How to check WHO creates a certain contact
I can´t see anywhere who is the creator of a particular contact in CRM. I can see the last update of that contact but not what user created which contact.

How can I do this?

Thank you!

# Answer
You can find this information in the **Change Log** for the contact.

It will be the earliest entry in the change log.
> 7 votes

---
Tags: contacts, logs
---


# Question
Title: How to create public and front end form through extension?
I need to create a public and front-end form through an extension which is native extension that need to compatible with all CMSs like civicrm.com/civicrm/form civicrm.com/form.

# Answer
Creating a form in an extension is mostly a matter of typing `civix generate:form`. It is documented here.
> 3 votes

---
Tags: extension, webform-civicrm, forms, gsoc
---


title: Attaching file to activity

text:
# Question
Title: Attaching file to activity
I'm having a problem attaching files to activities. I've done the basic checks (write permission to directories, Drupal permissions) . I notice that the file gets placed in the Custom Files folder "\[site root\]\sites\default\files\civicrm\custom"

However, the process doesn't seem to finish, and the system hangs with the egg timer showing and ultimately i have to escape out of adding the activity, for the system to 'un-freeze'.

I'm feel it's just a small tweak somewhere but i'm getting stupped what the exact issue is, and my searches are not pulling up anything related to this.

Any help would be much appreciated.

UPDATE: when i right click new activity and attach the file i get the following error

> Sorry but we are not able to provide this at the moment. Could not move custom file to custom upload directory Uncaught CRM\_Core\_Exception: \[0: Transaction integrity error: Expected to find active frame thrown in –

UPDATE 2: it looks like there is a 500 error;

> Failed to load resource: the server responded with a status of 500 (Internal Server Error).

this is followed by another errror;

> Failed to clear temp storage: It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources. SecurityError –

UPDATE #3 It looks like the ultimate cause of this problem is the issue with relative angular paths in windows CRM-16499. I'm going to upgrade to 4.6.4 from 4.6.2 as this issues is fixed in the 4.6.4 version.

If it works i'll add an answer

# Answer
This should be resolved as of 4.6.4 (issue CRM-16499).
> 1 votes

---
Tags: activities
---


# Question
Title: Connecting existing contribution to pledge WITHOUT Development
When someone makes a pledge, they may use a different contribution page to fullfil that pledge.

I see an API question about assigning an existing contribution to a pledge here: Connecting existing contribution to pledge.

**Is it necessary to create an extension to assign an existing contribution to fulfill a pledge**? Perhaps this is a feature request to add an "assign to pledge" section on the contribution edit form.

# Answer
Yes, this currently requires writing an extension (or submitting the code as a patch to be included in the core).
> 1 votes

---
Tags: contributions, pledges, civipledge
---


# Question
Title: Why am I getting no data when using PHP API on wordpress page?
CiviCRM 4.6.6 Wordpress 4.2.4

The code in my wordpress page:

```
[insert_php]
// Perform bootstrap
civicrm_initialize();

$result = civicrm_api3('Event', 'get', array(
  'sequential' => 1,
  'return' => "title,summary,custom_31",
  'event_type_id' => "",
));

print_r($result);
[/insert_php]

```

the ouput on my page:

```
Array
(
[is_error] => 0
[version] => 3
[count] => 0
[values] => Array
(
)

)

```

There should be data.

What am I doing wrong?

Thanks.

# Answer
Just messed up with my code:

```
[insert_php]
// Perform bootstrap
civicrm_initialize();

$result = civicrm_api3('Event', 'get', array(
  'sequential' => 1,
  'return' => "title,summary,custom_31"
));

print_r($result);
[/insert_php]

```
> 1 votes

---
Tags: civievent, api
---


# Question
Title: Contact Report Filter: How to include Street Address?
I'm trying to create a contact report (summary) and Street Address is not among the filters. Is there a way to include it?

# Answer
What version of Civi are you on? Look for Constituent Summary in Reports. And install Eileen's Extended Report extension here and take a look at the Constituent Report (Summary).
> 1 votes

---
Tags: civireport
---


title: Emailing : no open rate available

text:
# Question
Title: Emailing : no open rate available
I have a problem with one of my emailing campaign. The volume of tracked opening is equal to zero. But I see 203 clicks for this campaign, so I know the emailing was opened. I checked the parameters, the tracking for opening was on.

What can generate this problem ? Do we have a possibility to retrive the data ?

Thanks a lot :) Aude

# Answer
Note that for all the popular web email clients (gmail, ymail) and probably desktop clients too, image loading is disabled by default and the user explicitly has to enable image loading for an email address or globally.

At the best the open rate should be treated just as an approximation. The wikipedia article has a good summary of this:

http://en.wikipedia.org/wiki/Open\_rate
> 2 votes

# Answer
Do you still have a copy of the mailing in your mailbox as you received it? Could you view the html of the mailing to see if there is any img tag added? The way civimail works it to add a 1x1 transparent pixel, that is loaded from your civicrm website. Everytime someone loads that pixel, it means they are reading your mailing

If your mailing didn't have that image, that might be a reason.
> 1 votes

# Answer
We were getting this problem as well.

The tracking image is embedded in the html of the emails sent by CiviCRM but opens are not being recorded. (it isn't an image blocking problem)

```
<img src="http://www.examplesite.org/sites/www.examplesite.org/modules/contrib/civicrm/extern/open.php?q=138122" width="1" height="1" alt="" border="0">

```

To test you can go directly to the url like this for your own site and see what happens and that will hopefully point you towards the solution.

It could be permissions on that folder/file or could be your firewall blocking the word "open" or "open.php" or your civicrm settings file may not be being found by the open.php script. Or something else.

In our case it turns out that our firewall was blocking requests to "open.php?q="
> 1 votes

---
Tags: civimail
---


title: Are private contribution pages a thing?

text:
# Question
Title: Are private contribution pages a thing?
We want to restrict our member signup page ( a contribution page ) to people who have registered to our Drupal site. Also, we'd want to have public contribution pages not associated with membership be accessible without login.

In Drupal, I could make the permissions for "CiviContribute: make online contributions" be not accessible for unauthenticated users, but then I wouldn't be able to have the public contribution pages accessible.

Is there such thing as a private contribution page? Or is there some other way of achieving our goal that I don't know about?

Thanks!

# Answer
A short bit of custom code could take care of this (using the `hook_civicrm_preProcess` hook I think). It would need to check if the current page is your "sign-up" contribution page, and if it is, make sure that the user is currently logged in. If not, it would redirect to wherever you need.

Not positive this code is perfect, but it should get you pretty darn close...

```
function hook_civicrm_preProcess($formName, &$form) {

  $form_id = 7;   // set this to the specific form_id you wish to limit access to
  $redirect_path = 'home';  // set this to the url to redirect to if not logged in

  if ($formName == "CRM_Contribute_Form_Contribution_Main" && $form->_id == $form_id) {
    if (!user_is_logged_in()) {
      drupal_goto($redirect_path);
    }
  }

}

```
> 7 votes

# Answer
I've got a custom extension that's designed to designate specific contribution pages as 'admin only', here: https://github.com/adixon/ca.civicrm.contributextra

The actual permissions to access 'admin only' contribution pages is just set to being logged in (I just wanted to hide them from anonymous access), so it'll do what you want. It'll also generate an admin link from contact summary pages' contribution tab to the designated admin-only contribution pages.
> 6 votes

# Answer
Please edit your question to expand on exactly why your goal is "to restrict our member signup page ... to people who have registered to our Drupal site"?

Is there something "extra special" about the people who have registered on your Drupal site such that they have to be pre-approved before they can register?

Is there any reason why people who haven't registered should not be able to **view** the membership page?

You may be able to accomplish what you need without resorting to code by making "Drupal account creation" compulsory on your signup page (done in "advanced settings" on the profile settings page) and requiring administrator approval for creating a Drupal user account.(Select "Visitors, but administrator approval is required" for **Registration and cancellation** on yoursite/admin/config/people/accounts.)

That way you could vet the "applicants" for membership before their Drupal account is created and refund the membership fees for those who are not acceptable for what ever reason.
> 1 votes

# Answer
I might have misunderstood your question, but I think you are looking for something like the node access module, which it will allow you to restrict access to a page (ie membership page) based on user roles, ie authenticated users.

I'm not a Drupal user so please correct me if there are better solutions.
> -1 votes

---
Tags: civicontribute, drupal
---


# Question
Title: Is it possible to customize the automatic date ranges in Advanced Search?
I was trying to help a group make a simple smart group of all memberships set to expire within the next 2 months and the dropdown for "End date" in the **Membership** section of **Advanced Search** only had "prior", "past", and "previous" options. Then, before posting here, I realized they were running on 4.5.x so I tested on 4.6.6 and saw that there were some noted improvements to this list (including some future dates):

We may be able to get by with these new options (thank you, whomever made them!) but I was curious if there was an easy way to hook into that date widget somehow in a module or extension and define a new option (e.g. "Upcoming 60 days"), or if that is a much bigger issue and best not to mess with. Does anyone know?

# Answer
> 3 votes
I'm not sure where to start as I can't answer the main question apart from quoting a colleague Jon Goldberg 29/Mar/15 5:19 AM

> for now, you can use the PHP overrides folder to maintain your own local copy of this file when 4.6 comes out. I do this frequently for issues like this where I expect the problem to go away in the next version. I may do a diff if there's a security release of 4.6 that comes out that might change that file, but otherwise I leave things be.

This may or may not appropriate for your circumstances.

Personally, I would be reluctant to use "Upcoming Month" for anything as it gives inconsistent results because of the different numbers of days in the calendar months. So "Upcoming month" run on any day in February is effectively "Upcoming 28 days" (or "29" if it is a leap year), but will be "Upcoming 30 days" or "Upcoming 31 days" if run in other calendar months.

There is an issue CRM-16954 and associated PR which will, amongst other things, change "Upcoming month" to "Next 30 days" for 4.7. I will canvas the idea of including "Next 60 days" in that PR, although there is a reluctance to add yet more relative date filters to an already very long list.

Finally to outline what will be possible in the near future. The aims of CRM-16195 is to allow people to define their own relative date filters through the UI. We had hoped to have this ready for 4.7, but it is being pushed out to 4.8. Quite a bit of work has already gone into this courtesy of Jon Goldberg.

---
Tags: search, dates
---


# Question
Title: Paypal button not linking while using Paypal pro
We are running CiviCRM version 4.6.3 under Wordpress. We use Paypal Pro for payments. We created an Event registration and the registration page shows a Paypal button and the text:

"If you have a PayPal account, you can click the PayPal button to continue. "

but the Paypal button does not link to Paypal, but simply acts like the "Continue" button, giving an error that the credit card info has not been filled out.

This only happens with Event registration. With contributions, the same button goes to Paypal as it should.

Can anyone help us fix this?

# Answer
> 3 votes
I found the problem. I had "BIlling address required" turned on and that forced CiviEvent to demand more info and not let the user go to Paypal. I turned that off and it works.

---
Tags: paypal
---


title: Contact.url token is not a hyperlink

text:
# Question
Title: Contact.url token is not a hyperlink
When I send a bulk mailing I use the {contact.url} token, when the email comes through though the url is not a hyperlink.

Is there a way to amend this?

# Answer
> 1 votes
Fixed it by adding the token into a hyperlink

Edit: \< a href="{contact.url}"\>{contact.url}\< /a \>

Surprisingly worked

---
Tags: civimail, tokens, mailing
---


title: Scheduled mailings don't get sent

text:
# Question
Title: Scheduled mailings don't get sent
If we schedule a mailing, they only ever say running in the status column but never get sent. The only way they send is if we hit "execute now", so at least we know they are no email config/password issues.

I have little experience with Drupal, CiviCRM and Linux, so don't even know where to look for logs.

CiviCRM is running off Drupal on a Linux Ubuntu vm, I've found version number for CiviCRM is 4.1, Drupal is 7.34, php is 5.59 and MySQL 5.541.

How can I get the mailing delivered automatically?

EDIT: I have checked under the scheduled jobs (administer \> system settings \>schedules jobs) and found this.

If i click on log for the above, i get a blank web page. The test mailing i scheduled is still sat there saying "running".

I looked at the civicrm instructions before I posted on here, but to be honest they mean nothing to me, i didnt setup civi, never used drupal so I am really trying to sort this problem.

I have run crontab -l and everything is commented out.

Please can someone help

# Answer
> 4 votes
It sounds like you may not have a server cron job set up to trigger the Civi cron job. Are your other Scheduled Jobs executing?

The documentation to reference is here: http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs

# Answer
> 3 votes
It sounds like you don't yet have the cron job set up, or there is a problem with it. The Scheduled jobs section of the user guide walks you through creating the job. Things may be slightly different from the docs if you're still on CiviCRM version 4.1 (which is reeeally old) but this will get you started.

# Answer
> 3 votes
Since you say that the status is running, it sounds like the job gets started okay, meaning the cron is probably running okay.

Your ability to successfully manually execute the job points to me that you probably have permission issues. When you manually execute the job, it runs with the permissions that you're logged-in account has.

Cron however is usually setup with a different account with its own permissions configuration. If you look at the cron job setup you can determine the user account being used... using that, look up it's civi permissions and make sure that the appropriate permissions are given. (Minimally these include: view all contacts, access CiviCRM, access CiviMail)

# Answer
> 0 votes
I notice your php is a version (5.5) that wasn't used during the civicrm 4.1 development. So perhaps the system job code isn't compatible with 5.5 (which would also be consistent with your white screen when trying to look at your system job log).

If this is the issue, there should be something in your files/civicrm/ConfigAndLog directory that confirms the problem.

There's a good chance you could work around the problem with an adjustment to your php.ini file that sets more of the backward compatibility-type flags.

---
Tags: scheduling, mailing
---


# Question
Title: Member since date is being updated on import but we dont want it to!
using CiviCRM 4.4.14. We're trying to update memberships with an import using data from a direct debit processor. In field mapping we're matching the pay out date to 'Membership start date', but some how this is also updating 'Member Since Date' too, despite not mapping this bit.

We really don't want this to happen as we loose how many years someone has been a member and the membership status then sets it's self to 'New'.

It was suggested that we use the start date of the payment plan as the 'Member Since' date, but this would loose any info about memberships that started using a different payment method (i.e. all of them!)

Any help greatly appreciated! Nicola

# Answer
Confirmed this is happening on Drupal 6 and CiviCRM 4.4.14. In file: drupal\sites\all\modules\civicrm\CRM\Member\Import\Parser\Membership.php

line number 268 reads:-  `//assign join date equal to start date if join date is not provided
 if (!CRM_Utils_Array::value('join_date', $params) &&
 CRM_Utils_Array::value('membership_start_date', $params)
 ) {
 $params['join_date'] = $params['membership_start_date'];
 }`

You could try commenting out this line if it's not possible to calculate the join\_date from your data.
> 1 votes

# Answer
**OR**, You may need to select "Import new memberships" rather than "update existing memberships".

This is what tells Civi to update the join\_date (it's the start\_date of the first membership, I believe).

This means you don't need to include a membership ID, so could cause other problems for you.
> 1 votes

---
Tags: civimember, import
---


# Question
Title: How to correct domain in URLs after a change?
I installed CiviCRM 4.4 (LTS) on `foo.example.com` and then needed to move it to `bar.example.com`. I have updated the **Resource URLs** page with the new domain. However certain links, for example the links to "View and edit custom fields" on the custom data page at `/civicrm/admin/custom/group` still all point to the old domain.

I've tried `drush cc all; drush -u 1 civicrm-update-cfg` but the links are still the old ones.

Have I missed something? Thanks.

# Answer
I would double check the `civicrm.settings.php` file to make sure the paths and URL are updated in there. For example:

```
define( 'CIVICRM_UF_BASEURL'      , 'http://foo.example.com/' );

```

While you are in there make sure the server paths look right:

```
$civicrm_root = '/home/path_to_html/sites/all/modules/civicrm';
define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/home/path_to_html/sites/default/files/civicrm/templates_c/' );

```
> 4 votes

---
Tags: drupal, lts, migration
---


# Question
Title: Log filled with CRM_Utils_System::permissionDenied
My CiviCRM-logs are filling up with entries like this:

```
Aug 20 22:03:29  [info] $Fatal Error Details = Array
(
  [message] => Du har inte tillrÃ¤cklig behÃ¶righet fÃ¶r att se denna sida.
  [code] =>
)

Aug 20 22:03:29  [info] $backTrace = #0 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(364): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php(455): CRM_Core_Error::fatal("Du har inte tillrÃ¤cklig behÃ¶righet fÃ¶r att se denna sida.")
#2 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Utils/System.php(277): CRM_Utils_System_Joomla->permissionDenied()
#3 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(232): CRM_Utils_System::permissionDenied()
#4 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
#5 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#6 /var/www/events/components/com_civicrm/civicrm.php(86): CRM_Core_Invoke::invoke((Array:3))
#7 /var/www/events/components/com_civicrm/civicrm.php(11): civicrm_invoke()
#8 /var/www/events/libraries/cms/component/helper.php(392): require_once("/var/www/events/components/com_civicrm/civicrm.php")
#9 /var/www/events/libraries/cms/component/helper.php(372): JComponentHelper::executeComponent("/var/www/events/components/com_civicrm/civicrm.php")
#10 /var/www/events/libraries/cms/application/site.php(191): JComponentHelper::renderComponent("com_civicrm")
#11 /var/www/events/libraries/cms/application/site.php(230): JApplicationSite->dispatch()
#12 /var/www/events/libraries/cms/application/cms.php(252): JApplicationSite->doExecute()
#13 /var/www/events/index.php(45): JApplicationCms->execute()
#14 {main}

```

Time interval between entries range from a minute to a couple of hours, but many entries during a day.

Does anyone have any idea why this might be? Or where to start hunting it down.

# Answer
> 2 votes
It appears that the error simply is reporting that someone is trying to access a CiviCRM page and they do not have sufficient permission to access it.

This is either due to an authorized person trying to access the page, but not having sufficient permission set, or to some unauthorized person (robot?) attempting to access the page.

I would probably try to contrast the error messages with the web server access log to try to identify what page is being attempted to be accessed, and its IP address. If it's a robot you may be able to detect that as well. (It could simply be a search engine robot that knows of the page and is regularly attempting to access it without the proper credentials.)

---
Tags: permissions, logs
---


# Question
Title: How to alter and manipulate the behavior and action of button through extension?
I want to alter and manipulate the behavior and action of continue button on new contribution page through extension, I want to do some additional tasks with that button through my extension like sending email etc.

What is the best way to accomplish this task?

# Answer
> 3 votes
you can use hook\_civicrm\_postProcess or hook\_civicrm\_post

which ever you need based on your requirement below is the link for more reference http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference

---
Tags: api, extension, hooks, contribution-page, gsoc
---


# Question
Title: Why does this custom file field uploaded on profile not download from the emailed link?
I created a **custom profile** (to use as a form on my website) with a custom **file field**...When the user fills out the form, they upload a file, and the form is sent to the admin email address. When I open the email and download the attached file, I am unable to open it; the file becomes corrupt. However, if I use FTP and navigate to ".../files/civicrm/custom" and download the file from there, the file opens and is not corrupt.

The website is using wordpress.

Any help is much appreciated. Thanks in advance.

# Answer
Please make sure you are closing the file properly before attaching to the email - any file which is open and been attached to email will have this issue
> -1 votes

---
Tags: wordpress, profile, custom-fields, email, forms
---


# Question
Title: What is the review process for automatic distribution of Extensions?
Some extensions are eligible for being distributed automatically, which means that you can add them via the CiviCRM UI.

This page lists the criteria that needs to be meet for automated distribution and we have an extension ready for review.

Will I need to ask a CiviCRM site administrator to do the (manual) review? Or will they automatically be noticed?

# Answer
> 5 votes
They'll automatically be noticed - I personally use http://civicrm.org/extensions/rss to keep track. If we're being honest though, the extension review team isn't always the quickest to tackle something! If you have something waiting in the queue, let me know and I'll make some time for it.

# Answer
> 0 votes
I'll be able to review it this weekend. On behalf of the community - thank you for a cool sounding extension!

---
Tags: extension
---


title: Inserting a calculated value

text:
# Question
Title: Inserting a calculated value
Currently I am working on a civicrm-wordpress plugin. I have two custom fields displayed for a contact: \- Date of consent \- Age at recruit

When the user enters the date of consent I would like to calculate the Age at recruit (using the contact's date of birth and the date of consent field). How can I target a custom field and update it with a value when the user clicks on Save?

What I have done so far: \- Created and enabled a plugin with the following content:

```
add_action('civicrm_preProcess', 'set_ageatrecruitment', 92,2);
function set_ageatrecruitment($formName, &$form){

        global $recruitmentDate;
        global $contactData;
        global $ageAtRecruit;
        $contact_id=$_GET['cid'];
        $contactDOB = $contactData[values][$contact_id][birth_date];

            if($recruitmentDate !='' && $contactDOB !='' ) {
                $ageAtRecruitment = getAgeAtRecruitment($contactDOB,$recruitmentDate);

            if ($ageAtRecruit != $ageAtRecruitment){
                updateCustomField($contact_id, "OC-Integrator", "Age at Recruitment", $ageAtRecruitment);}
            }

}

//updates the field, returns number of fields updated
function updateCustomField($uid,$group_name,$field_name,$value, $overwriteblank=FALSE){

    //Don't overwrite existing data if our data value is empty/blank
    //We consider anything that is just whitespace to be "blank"
    if ( ( !isset($value) || strlen(trim($value))==0 ) && !$overwriteblank) return 0;

    $results=civicrm_api("CustomValue","create", array (version => '3','sequential' =>'1', 'entity_id' =>$uid, "custom_" .$group_name . ":" . $field_name => $value));

    return 1;

}

```

There is another hook called before this which will give value to the global variables.

# Answer
Here's how I would go about this:

1. Configure a field on the contact. Select "set via PHP" or whatever the option's exact name is.
2. Generate an extension using Civix. Remember portability - your extension can generate the field in (1), meaning that if you decided to share the extension or use it on multiple projects that.
3. Use the hook as Ramesh said to fill the values in the field.

It sounds like a neat extension. If you want to commission CiviFirst for this I'd be more than happy to help!

JohnFF
> 1 votes

# Answer
you need to create an Extension and use hook\_civicrm\_custom http://wiki.civicrm.org/confluence/display/CRMDOC43/hook\_civicrm\_custom

Please let me know if you need more help -
> 0 votes

---
Tags: php
---


# Question
Title: Best way to create a new DB table in an extension with logging
In an extension, what is the best way to create a DB table that has a matching logging table? Do we just have to literally create a matching new table with triggers?

There must be a better way?

# Answer
> 1 votes
I happen to be doing this in an extension at the moment... I had the table created normally and stuck

```
  // Make sure the log table is created if required
  $schema = new CRM_Logging_Schema();
  $schema->fixSchemaDifferences();

```

at the end of the civicrm\_enable hook. Unless I take care of this, if I install the extension with logging already enabled and try to create one of my new entity with drush right away, I get an error about the log table not existing.

# Answer
> 3 votes
Per Lobo's comment - the logging triggers & tables are automatically created. But, from experience sometimes you have to turn logging off & on to get the tables created. The triggers seem to create & cause lots of errors which stop when you turn logging off & on.

Obviously the function called by turning logging on is more thorough than the enable extension function

# Answer
> 1 votes
All tables that start with "civicrm\_" are logged. tables with \_temp and \_cache in their names are skipped (and a few other tables).

You can check the code at CRM/Logging/Schema.php

Might be good to consider using hook(s) in multiple places so extensions can add to the list of tables to be logged and excluded

---
Tags: database
---


# Question
Title: Our dashboard reports are inaccurate - caching issue?
We have a number of dashlets set up for various users to monitor what's going in in CiviCRM. Sometimes data is missing though. We run the report the dashlet is based on, and the data does show up there. Afterwards, it shows up on the dashboard too. Smells like a caching issue to me.

What is the best way to deal with this? Is CiviCRM caching strictly controlled by the CMS (Drupal in our case)? I have just set a maximum value for cache life; it was "none" before.

# Answer
> 5 votes
This one also throws me occasionally. You should reduce the **dashboard cache timeout** setting to '0' in /civicrm/admin/setting/misc?reset=1

Then it will load the reports dynamically each time you access the dashboard.

# Answer
> 2 votes
Yes, dashlets are cached. However you shouldn't need to re-run individual reports to update the dashlets. Instead, use the link at the top-right of the dashboard page called "Refresh Dashboard Data".

---
Tags: dashboard, cache, dashlet
---