# Question
Title: For some reason, cron doesn't work. On CMS joomla
For some reason, cron doesn't work. On CMS joomla The system thinks that it works, and shows in the status that everything is fine, but mailings are not sent at the same time. Cron settings on the screen. Tell me what could be the matter? Cron doesn't work joomla

# Answer
This may be the Joomla-specific bug documented in dev/joomla#6, where cron runs successfully but the mailing scheduler fails due to a permission failure.
> 2 votes

# Answer
Mine is working in joomla/civicrm, here is what I use for the cron job: wget -O - -q -t 1 'https://"my domain name"/administrator/components/com\_civicrm/civicrm/bin/cron.php?name="my cron user name goes here"&pass="my cron user password goes here"&key="my key goes here"'

The " are there to help identify where you will fill in your specific info.

Make sure your joomla user, that you are using for cron has superuser rights in joomla.
> 1 votes

---
Tags: joomla, cron
---


# Question
Title: Issue importing multiple contributions for same contact
I am trying to import multiple contributions for a contact. I am using the following fields for the import: contact ID, total amount, date received, and financial type.

Civi will only import the first row, and after that it says the contact ID is not valid. I don't understand, I know I have to use the same contact ID for each row because all contributions are from the same contact.

Can anyone help me?

# Answer
> 1 votes
I suspect it’s an issue with your CSV file/format. Resave the file as CSV and try again.

---
Tags: contributions, import
---


# Question
Title: Confirmation receipt sent from strange sender address
If I send a confirmation receipt (checked 'Send Confirmation and Receipt?' during renewal of a membership), the sender address is wrong if the preferred is chosen. In stead of displaying the address given, it scrambles the address to '*id of the address in civicrm\_mail table*'@'*server host name*', e.g. 2@s2.domain.tld.

When I choose another address, the sender address is fine.

# Answer
It looks like you've discovered a bug! I'm sorry this happened to you, but identifying this helps to make the software better.

I confirmed this bug, and also confirmed that it's not limited to the `mail()` setting. I've opened an issue on the CiviCRM issue tracker.

UPDATE: I decided to dig into this a little bit to see if the fix was easy, and it wasn't too bad. It's available for review now. If you could apply the fix and let folks know on Github how it works for you, that would be great! If you're not sure how to apply the fix, get in touch with me on https://chat.civicrm.org, my name there is @junglebird.
> 2 votes

---
Tags: civimember, email, receipts
---


title: ACL permissions Activities

text:
# Question
Title: ACL permissions Activities
I'm trying to make a permission, to limit view some activities types (A user with a specific role can't view a some activities types)

I was checking the hook permissions but i don't find the way(version civicrm 4.4).

Any idea to focus this issue?

# Answer
> 4 votes
You can install the Activity Type ACL extension to do this.

# Answer
> 1 votes
There was a proposal for ACLs for Activities and Cases and an ACL Hook for Cases has been implemented but not yet for activities. See What is the status of the make it happen for permissions on activities and cases?.

# Answer
> 0 votes
Not really an answer to your question - but I'd suggest upgrading from 4.4 before putting effort into developing something to do that.

---
Tags: activities, acl
---


# Question
Title: Fatal Error when accessing Civi in WP Install
My Civi seems to be broken, and I'm really unsure why! This is the error I receive when trying to open the base CiviCRM homepage.

```
Fatal error: Uncaught CRM_Core_Exception: [0: Invalid cache key: Not a string thrown in /home2/snachodo/public_html/boyscoutstech/wp-content/plugins/civicrm/civicrm/CRM/Utils/Cache.php on line 221

```

Can anyone point to a resource to resolve the error?

A further complication that I didn't realize until this week is that I am unable to create new blog posts or pages in WordPress. I receive the same error as above. However, WordPress works when I deactivate CiviCRM as a plugin.

Log message below:

```
[22-Dec-2018 00:25:12 UTC] PHP Fatal error:  Interface 'Psr\SimpleCache\CacheInterface' not found in /home2/snachodo/public_html/boyscoutstech/wp-content/plugins/civicrm/civicrm/CRM/Utils/Cache/Interface.php on line 40
[22-Dec-2018 00:47:24 UTC] PHP Fatal error:  Interface 'Psr\SimpleCache\CacheInterface' not found in /home2/snachodo/public_html/boyscoutstech/wp-content/plugins/civicrm/civicrm/CRM/Utils/Cache/Interface.php on line 40
[22-Dec-2018 22:29:32 America/Denver] PHP Warning:  Declaration of CRM_Mailchimp_Permission::check($permissions) should be compatible with CRM_Core_Permission::check($permissions, $contactId = NULL) in /home2/snachodo/public_html/boyscoutstech/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mailchimp/CRM/Mailchimp/Permission.php on line 40
[22-Dec-2018 22:29:38 America/Denver] PHP Warning:  Declaration of CRM_Mailchimp_Permission::check($permissions) should be compatible with CRM_Core_Permission::check($permissions, $contactId = NULL) in /home2/snachodo/public_html/boyscoutstech/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mailchimp/CRM/Mailchimp/Permission.php on line 40
[22-Dec-2018 23:15:00 America/Denver] PHP Warning:  Declaration of CRM_Mailchimp_Permission::check($permissions) should be compatible with CRM_Core_Permission::check($permissions, $contactId = NULL) in /home2/snachodo/public_html/boyscoutstech/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mailchimp/CRM/Mailchimp/Permission.php on line 40
[03-Jan-2019 09:02:18 America/Denver] PHP Warning:  Declaration of CRM_Mailchimp_Permission::check($permissions) should be compatible with CRM_Core_Permission::check($permissions, $contactId = NULL) in /home2/snachodo/public_html/boyscoutstech/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mailchimp/CRM/Mailchimp/Permission.php on line 40

```

# Answer
> 3 votes
Unfortunately, the log message suggests you've hit a limit of your hosting provider.

> User snachodo\_657 already has more than 'max\_user\_connections'

This could have various causes. If your hosting plan only allows a certain number of DB connections simultaneously and your site creates more than that, you'd see this.

I don't think it's a common issue for CiviCRM so it may be that the hosting provider has a low number of permitted DB connections, OR that your site is busier than most sites on your hosting provider.

It's worth noting that CiviCRM's DB connection methodology does not re-use Wordpress's DB connection, so for any visitor on a CiviCRM page, your site will consume two DB connections at once.

In the first case, I'd contact your hosting provider and enquire about the limit. It might be a config tweak they can make, or they may offer you a plan with more DB connections.

If that doesn't work out, you could ask an expert to investigate why your site is making too many connections, or look into hosting providers who provide support for CiviCRM sites.

Hope that's some help!

---
Tags: wordpress, cache
---


# Question
Title: CiviVolunteer - Where to put translations file on WordPress
after some work on Transifex, we need to install civiVolunteer italian translation on WordPress. Where is the right place to put the .mo file?

# Answer
Based on this https://github.com/cividesk/com.cividesk.l10n.update/blob/master/l10nupdate.php#L131 it looks like it needs to be within the extension folder in folders 10n//LC\_Messages/volunteer.mo This line details the download path for the mo https://github.com/cividesk/com.cividesk.l10n.update/blob/master/l10nupdate.php#L130 the mo is the binary version of the .po files i believe
> 3 votes

---
Tags: wordpress, installation, civivolunteer, localisation, i18n
---


# Question
Title: CiviContribute - convert amounts into words
Is there a plugin that would populate a field with a word amount of a contribution total? Using such a token can make a letter more personalized. Similar to the SpellNumber formula in Excel. I.e. $240.00 = two hundred and forty dollars.

# Answer
No there is no such plugin that I am aware of.
> 1 votes

---
Tags: civicontribute, contributions, tokens
---


title: CiviVolunteer: need link for Joomla

text:
# Question
Title: CiviVolunteer: need link for Joomla
I am using CiviVolunteer with Joomla and I am trying to enable the volunteer Opportunity Listing. I tried the following link the http://address-to-your-site/civicrm/vol/#/volunteer/opportunities link with my domain and I am not able to see it. I have angular profiles enabled, and I granted access to AJAX API and CiviVolunteer: register to volunteer to anonymous users, but I am still not able to see this list publicly. I have found the link for wordpress, but there is no documentation for Joomla. Can anyone help?

# Answer
I don’t have a Joomla instance with CiviVolunteer but try this -

/index.php?option=com\_civicrm&task=civicrm/vol/#/volunteer/opportunities
> 0 votes

---
Tags: joomla, civivolunteer
---


title: A bit of automation?

text:
# Question
Title: A bit of automation?
I'd like to automate couple of settings in my contact list and I was wondering can these be done without writing special extensions or Drupal modules:

1. Couple of people qualify to be a Head Coach of the Club, so when the time comes one of them will be selected via Relationships. Can I remove an existing relationship from other person when new person gets selected? So there's only 1 head coach in each club?
2. There's 2 types of players - Junior and Senior (I have this as a custom select field) - when a player turns 18 or when I create a new one via Webform, the type is automatically selected for the right age?

I tried Drupal Rules, Civirules but I didn't find an easy way to do it so no manual work is necessary...

# Answer
> 2 votes
1/ You can do this in a Drupal Webform so that the original coach has their relationship expired

2/ we did some work for another age-based organisation to ensure that only the valid membership type was available based on the Date of Birth. It isn't something that I could just 'share' but if it helps you and you have a bit of budget we could probably extract what you need fairly quickly.

# Answer
> 1 votes
Without writing code (an extension or CiviRules conditions), I think your only bet is to use smart groups for Junior/Senior players. I don't think there's any way to remove the head coach relationship automatically without code.

---
Tags: drupal-rules
---


title: Sync between different Civicrm dbs

text:
# Question
Title: Sync between different Civicrm dbs
We are looking for a way for multiple branches of our organization to maintain separate CiviCRM installs while syncing a particular group of contacts with each other. WE thought of using Mailchimp to hold the master list and have each install sync with that. BUt the current extension only seems to handle fname,lname and email fields.

Long ago some posted this: https://forum.civicrm.org/index.php%3Ftopic=3070.0.html which describes a similar need.

Is there any code already developed for this?

# Answer
> 1 votes
I don't believe there is any shared code for this currently. We are working with a client in Aus to build such a system for them which would involve sharing (pushing/pulling) data from the 'parent' crm to various 'child' crm databases.

If you need a solution then we may be able to extract the work we have done that relates to just the features you need but would clearly need to charge and would provide an estimate if you were interested. You can contact me via https://www.fuzion.co.nz/helping-those-who-do-good-do-better or https://chat.civicrm.org/civicrm/messages/@petednz-fuzion

---
Tags: contacts, extension
---


# Question
Title: CiviEvent events partitioned by domain in WordPress multisite
I'm testing event management with CiviEvent in a CiviCRM/WordPress subdomain multisite installation (WordPress 4.9.8; CiviCRM 5.4.0). Is there any built-in support for segregating events by the CiviCRM domain ID (which maps to a WordPress site/subdomain)?

If not, can you suggest a practical way of partitioning or filtering events by WordPress site/subdomain? Ideally, I'd like local WordPress site administrators to only be able to view and manage events for their own WP site/subdomain in CiviEvent.

Most events will be public, but it would be great to have a solution where non-public events can also be partitioned by Civi domain ID.

# Answer
> 2 votes
I wanted to post a belated update here, in case it helps someone else or could trigger additional discussion or action. Per Jon G, I emailed CiviDesk and got a prompt response:

> We have developed multisite support for events in CiviCRM, and it has been in production for several years now with one of our largest customers. The code is public, but not documented or guaranteed and delivered as-is, without any support from us.... It is available in https://github.com/cividesk/civicrm-core/tree/4.7.31-cividesk-arcs, it contains a lot of patches in addition to just the multisite changes. We will be migrating this customer to CiviCRM 5.7 ESR in H1 2019, and port all to this newer version then.

CiviDesk further clarified that the customization does *not* currently include 'packaging' for this feature (i.e. setup screens, documentation, test suite, ...). It cannot become part of the official CiviCRM release without these. If there were interest and funding (via a "*Make it happen*" project or similar), they could move forward on this.

I had hoped to dig into the code to explore further, but haven't yet because of limited time and other priorities. For the short term, we're using a WordPress-only multisite compatible events management solution. For the longer term, a solution integrated with CiviCRM would be preferable. With guidance from more experienced Civi developers, I'd be willing to pitch in.

# Answer
> 1 votes
You could try adding a Custom Field to the events, and then use CiviCRM ACLs to restrict folk based on the value of that Custom Field. If that isn't viable then setting up civicrm to proper multisite might be a viable but complex route

---
Tags: wordpress, civievent, multisite, domain
---


# Question
Title: How to Add Menu Item to Parent Using Civix
I'm trying to add a menu item for my extension to the existing "Memberships" menu. The documentation suggests the following:

> Use the Civix implementation
>
> Civix comes with helper functions \_EXTENSION\_NAME\_civix\_insert\_navigation\_menu and \_EXTENSION\_NAME\_civix\_navigation\_menu that simplify the process of inserting menu items. Consider using these functions rather than using the examples below or writing your own implementation of this hook.

What it doesn't do is give you any clue how to do this. I found an example here: https://github.com/totten/civix/blob/master/UPGRADE.md.

Regardless, there is no info on how to actually add a menu item to an existing menu using this method.

**Could someone please enlighten me on how to use the civix method to add a menu item as a child to an existing menu?**

# Answer
Example:

```
/**
 * Implements hook_civicrm_navigationMenu().
 *
 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu/
 */
function dmfactuurlink_civicrm_navigationMenu(&$menu) {

  _dmfactuurlink_civix_insert_navigation_menu($menu, 'Administer', array(
    'label' => E::ts('Domus Medica Factuur Link Instellingen'),
    'name' => 'dmafctuurlink_setting',
    'url' => 'civicrm/dmfactuurlink/form/setting',
    'permission' => 'administer CiviCRM',
    'attributes' => [],
    'operator' => 'OR',
    'separator' => 0,
  ));
  _dmfactuurlink_civix_navigationMenu($menu);
}

```
> 3 votes

# Answer
I just figured it out. The following line:

```
_serving_civix_insert_navigation_menu($menu, NULL, array(

```

should have the name of the parent menu passed as:

```
_serving_civix_insert_navigation_menu($menu, 'Memberships', array(

```

That will place the menu item within the existing "Memberships" menu.

Anyone know how to change the position of the menu item?
> 1 votes

---
Tags: extension, menu, civix
---


# Question
Title: CiviVolunteer:running on Joomla screen blank, only see header "CiviVolunteer"
I have a civi 5.8.2 install running on Joomla 3.9.1 (unilingual), I have installed CiviVolunteer and I am trying to enable the volunteer Opportunity Listing. I have installed: Angular Profiles (org.civicrm.angularprofiles) version 4.7.31-1.1.2 CiviVolunteer (org.civicrm.volunteer) version 4.7.31-2.3.1 The link I used is: http://address-to-your-site/index.php?option=com\_civicrm&task=civicrm/vol/#/volunteer/opportunities I view a page titled "CiviVolunteer". I see below the title my CiviCRM system status (I am logged in as superuser into the front end). Has anyone got it working? I would love to have the interface as seen for drupal users, the sample site looks awesome.

Here's the info from Dev Tools, "Console": JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/jquery/dist/jquery.min.js?r=0tqbB”. index.php:161:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/jquery-ui/jquery-ui.min.js?r=0tqbB”. index.php:163:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/lodash-compat/lodash.min.js?r=0tqbB”. index.php:165:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.mousewheel.min.js?r=0tqbB”. index.php:167:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/select2/select2.min.js?r=0tqbB”. index.php:169:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.form.min.js?r=0tqbB”. index.php:171:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.timeentry.min.js?r=0tqbB”. index.php:173:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.blockUI.min.js?r=0tqbB”. index.php:175:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/datatables/media/js/jquery.dataTables.min.js?r=0tqbB”. index.php:177:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/jquery-validation/dist/jquery.validate.min.js?r=0tqbB”. index.php:179:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.ui.datepicker.validation.min.js?r=0tqbB”. index.php:181:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/Common.js?r=0tqbB”. index.php:183:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/crm.datepicker.js?r=0tqbB”. index.php:185:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/crm.ajax.js?r=0tqbB”. index.php:187:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/wysiwyg/crm.wysiwyg.js?r=0tqbB”. index.php:189:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.tableHeader.js?r=0tqbB”. index.php:191:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.menu.min.js?r=0tqbB”. index.php:193:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/crm.optionEdit.js?r=0tqbB”. index.php:195:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/crm.joomla.js?r=0tqbB”. index.php:197:1

TypeError: $.datepicker is undefined\[Learn More\] index.php:8:3

TypeError: CRM.wysiwyg is undefined\[Learn More\] crm.tinymce.js:21:3

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/packages/jquery/plugins/jquery.notify.min.js?r=0tqbB”. index.php:205:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/bower\_components/angular/angular.min.js?r=0tqbB”. index.php:207:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/crm.angular.js?r=0tqbB”. index.php:209:1

ReferenceError: angular is not defined\[Learn More\] angular-modules.1382ac9fdf35e52380a62a87a198cccb.js:23:1

Loading failed for the with source “https://address-to-your-site/components/com\_civicrm/civicrm/js/noconflict.js?r=0tqbB”. index.php:213:1

# Answer
Try changing 'CiviCRM Resource URL' from `[civicrm.root]` to `administrator/components/com_civicrm/civicrm/`. Your console is showing that the URLs are missing `administrator` so I think you are affected by this issue: https://lab.civicrm.org/dev/joomla/issues/5
> 3 votes

---
Tags: joomla, civivolunteer
---


# Question
Title: Test Payments showing Incomplete Transaction (CiviCRM 5.8.2)
While building out a transition plan from Drupal to Wordpress, after getting CiviCRM setup on Wordpress, I tried making a test contribution. However, all attempts resulted in `Pending (Incomplete Transaction)` despite showing as successful in the sandbox.

As part of troubleshooting, I tried making a test contribution on the production site (which is the one currently running Drupal) since I had previously made successful test contributions. However, this too lead to the contributions being marked as `Pending (Incomplete Transaction)`.

One thing to note is that "Real" contributions have still been coming in fine on the production site.

I'm aware that there was an issue previously per this StackExchange post, however it appears that should have been fixed in `4.7.30`, whereas I'm running `5.8.2` (both on the production and dev sites for obvious reasons).

No errors seem to be showing relating to this in any of the `error_log` files on the production or dev site.

Any further troubleshooting advice would be greatly appreciated.

# Additional Information

I'm using Paypal Standard.

# Answer
> 2 votes
Alright, now that I've solved the problem, let me reiterate over the issues, and how they were solved.

# Problem 1: Wordpress Dev Site Test Contributions Marked Pending

Test contributions were being marked as `Pending (Incomplete Transaction)`. As was identified via logs, and confirmed by looking at the IPN history for the sandbox, the notification URL was referencing the Wordpress backend.

As a result, I needed to figure out how to change this. As the docs state:

> Enter your CiviCRM site home page (e.g. http://www.example.com) as the Notification URL. This is a placeholder. CiviContribute will pass the exact IPN 'listener' URL to PayPal automatically during each transaction.

## Solution

The solution required setting the `$frontend` argument to `TRUE` for the call to `CRM_Utils_System::url` as seen in `CRM/Core/Payment.php` (code reference).

So instead of

```
  protected function getNotifyUrl() {
    $url = CRM_Utils_System::url(
      'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
      array(),
      TRUE,
      NULL,
      FALSE
    );
    return (stristr($url, '.')) ? $url : '';
  }

```

it's now

```
  protected function getNotifyUrl() {
    $url = CRM_Utils_System::url(
      'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
      array(),
      TRUE,
      NULL,
      FALSE,
      TRUE  // This is the argument that needs to be added
    );
    return (stristr($url, '.')) ? $url : '';
  }

```

For those interested, here's a link to the method definition.

Why I haven't seen this pop up elsewhere, I am not sure. It may be prudent to do a check, and if Wordpress or Joomla are being used, to set that argument.

After making that change though, notifications started flowing.

# Problem 2: Drupal Prod Site Test Contributions Marked Pending as Well

As mentioned in the initial post, test contributions also appeared to not be getting IPN notifications, where they used to previously.

## Solution

This was actually fixed while I was working on the fix for the Wordpress problem.

As it turns out, when I was initially testing with Wordpress, the relatively short order hits against the admin area by the IPN notifications caused modsec to blackball the IP that Paypal's Sandbox sends the notifications from.

Once I removed the IP from the deny list, the notifications resumed flowing, and the test contributions resumed processing correctly.

# Answer
> 2 votes
Since you are using paypal standard then I believe it requires to setup IPN call back url for CiviCRM to get response from Paypal and process the contribution status.

Here is the document how to configure IPN(Instant Payment Notification) at Paypal.

HTH

Pradeep

# Answer
> 2 votes
Based on your comment on Pradeep's answer, the issue now is the URL you're using. You can actually submit the IPN to any WordPress page that doesn't require a login. So assuming your front page doesn't require one, you can use: `https://[domain]?page=CiviCRM&q=civicrm/payment/ipn/1`. Of course, ensure that your payment processor id is `1` or change the last digit accordingly.

Also, note that you can resend IPNs for up to 30 days.

---
Tags: civicontribute, paypal
---


# Question
Title: Getting problem while getting group id of current logged in user
I am trying to get a group id of currently logged in user

`function search_civicrm_preProcess($formName, &$form) {
 $getContactId = (int) CRM_Core_Session::singleton()->getLoggedInContactID();
 $query = "select 'group_id' from 'civicrm_group_contact' where contact_id ='.$getContactId'";
$dao1 =& CRM_Core_DAO::executeQuery( $query, CRM_Core_DAO::$_nullArray );
}`

# Answer
I would use api to find groups of logged in user

```
$result = civicrm_api3('Contact', 'getsingle', [
  'return' => ["group"],
  'id' => 'user_contact_id',
]);

or

$result = civicrm_api3('GroupContact', 'getsingle', [
  'return' => ["group_id"],
  'contact_id' => 'user_contact_id',
]);

```

HTH

Pradeep
> 2 votes

---
Tags: extension, groups, core
---


# Question
Title: Duplicates being created by Webform Submissions
We are seeing issues when users submit a Drupal Webform and accidentally click the submit button twice, duplicate records are being recorded in CiviCRM. This goes for creating 2 of the same contact or assigning 2 event registration to the same contact.

This was never an issue before but seems to have crept in after we upgraded to CiviCRM 5.0.2. We are now on CiviCRM 5.5.3

Using webform\_civicrm 7.x-4.21

Any guidance would be appreciated

# Answer
> 7 votes
We’ve come across this issue several times in the past and our solution was to use the below Drupal module –

https://www.drupal.org/project/hide\_submit

---
Tags: webform-civicrm
---


# Question
Title: Assign a group from logged in user contact group to new individual
I am trying to assign a group from currently logged in user(One group in assigned only) to a newly created individual.

```
function search_civicrm_post($op, $objectName, $objectId, &$objectRef){ {

$getContactId = (int) CRM_Core_Session::singleton()->getLoggedInContactID();

try {
    $result = civicrm_api3('GroupContact', 'getsingle', [
        'return' => ["group_id"],
        'contact_id' => $getContactId,
    ]);
}
catch (CRM_Exception $e) {
    echo "error";
}

$getGroupId = $result['group_id'];
$recentContactId= '';
$query ="INSERT INTO `civicrm_group_contact` (`group_id`, `contact_id`, `status`) VALUES ('.$getGroupId', '$recentContactId','Added')";

```

But problem is that how will I get the id of recently added individuals;

# Answer
> 3 votes
If I understand it correctly you want to add contact (New individual) to a group of logged in user, then i would write something like this

```
function search_civicrm_pre($op, $objectName, $id, &$params) {
  if ($objectName == 'Individual' && $op == 'create) {
    $groups = civicrm_api3('Contact', 'getsingle', [
      'return' => "group",
      'id' => 'user_contact_id',
    ])['groups'];
    foreach (explode(',', $groups) as $groupId) {
      $params['group'][$groupId] = 1;
    }
  }
}

```

HTH

Pradeep

---
Tags: extension, groups, postcode
---


# Question
Title: Drupal login destination is ignored when members log in
When members log in, they are always redirected to their Drupal user profile page, and the login destination in the URL is ignored.

For instance, when they try to access a members-only page, they are prompted to login, but after they do, instead of returning to the page they were accessing, they are send to their user profile page. This does not happen to non-members who have a Drupal account, where they are redirected as specified in the URL.

We do have LoginToboggan and LoginDestination modules installed, but they do not seem to have anything to do with this behavior. Any ideas why this is happening and how to fix it? Thanks!

# Answer
> 3 votes
I use the r4032login module. I find that it often fixes issues where users hit a login-in CiviCRM page, then redirects them correctly back.

---
Tags: drupal, civimember, user-account
---


# Question
Title: How to identify if the event is a repeat event?
I want to identify repeat events and mark it as not paid event programmatically and
only if the user has paid for the main event, I want to allow them for repeat events
Right now I don't see any value in event array which indicates that the event is a repeat event How can I implement it?

```
 "id": "49",
            "title": "Title",
            "event_title": "Title",
            "summary": "Summary",
            "description": "Description",
            "event_description": "Description",
            "event_type_id": "2",
            "participant_listing_id": "1",
            "is_public": "0",
            "start_date": "2019-01-15 20:20:00",
            "event_start_date": "2019-01-15 20:20:00",
            "end_date": "2019-01-17 00:00:00",
            "event_end_date": "2019-01-17 00:00:00",
            "is_online_registration": "0",
            "max_participants": "22",
            "event_full_text": "This event is currently full.",
            "is_monetary": "0",
            "is_map": "0",
            "is_active": "0",
            "is_show_location": "1",
            "default_role_id": "2",
            "is_email_confirm": "0",
            "is_pay_later": "0",
            "is_partial_payment": "0",
            "is_multiple_registrations": "0",
            "max_additional_participants": "0",
            "allow_same_participant_emails": "0",
            "has_waitlist": "0",
            "allow_selfcancelxfer": "0",
            "selfcancelxfer_time": "0",
            "is_template": "0",
            "created_id": "2",
            "created_date": "2019-01-07 20:22:38",
            "is_share": "0",
            "is_confirm_enabled": "1",
            "is_billing_required": "0"
        }

```

# Answer
> 4 votes
The repeat entity is stored in `civicrm_recurring_entity` table so you might need to use the `RecurringEntity` api for this purpose. The following should result the repeating events for you -

```
$result = civicrm_api3('RecurringEntity', 'get', [
  'sequential' => 1,
  'entity_table' => "civicrm_event",
  'parent_id' => main_event_id,
]);

```

Similarly the api can also be used to find repeated activities.

---
Tags: civievent, api, repeating-events
---


# Question
Title: How to Parameterize Backup & Migrate to have both DBs saved?
Moving to Drupal 7.61 / Civi 7.8.2

Using Backup & Migrate, I realize that my Civi DB has never been saved (I can only do it manually via quick Backup) :

Settings give the ability to back-up :

* Drupal DB
* Civi DB
* Public Files
* Entire site

... based upon specific pertaining options (mostly exclusions).

But only my Drupal DB is actually saved

How can I have all of them saved, or select which should be ?

# Answer
There is a known issue (Too many connections in backup\_migrate\_source\_db-\>\_get\_db\_connection()) with recent versions of Backup and Migrate from 3.3 onwards which prevents CiviCRM from backing up as well is Drupal. If you use version 3.3 or later it is likely that you will not be able to backup the CiviCRM database as well as the Drupal database. However, you should still be able to backup the Drupal database.

I would suggest two possible workarounds:

1. Either uninstall Backup and Migrate and then reinstall an earlier version such as 3.2 or even 2.8.
2. Leave the latest version of Backup and Migrate in place and use it to backup the Drupal database only and set up a bash script that gets triggered by Cron to back up the CiviCRM database. This is what I am doing. The script I am using is:

`#!/bin/bash`

`# Database credentials
user="username"
password="db_password"
host="localhost"
db_name="db_name"

# Other options
backup_path="/absolute_path_to_backup_folder"
date=$(date +"%d-%b-%Y-%H-%M-%S")

# Set default file permissions
umask 177

# Dump database into SQL file
mysqldump --user=$user --password=$password --host=$host $db_name > $backup_path/$db_name-$date.sql

#Compress the backup file
#7z a $backup_path/$db_name-$date.7z $backup_path/*.sql
gzip $backup_path/$db_name-$date.sql

#Remove the original sql file
#rm -I $backup_path/*.sql`

`# Delete files older than 30 days
#find $backup_path/* -mtime +30 -exec rm {} \;
find $backup_path/* -name *.sql.gz -mtime +30 -exec rm {} \;`

for which I have set up a Cron job to execute every day.

Any debugging information you can provide for the issue will probably be welcome and help them in finding a fix.
> 3 votes

---
Tags: backups
---


# Question
Title: How can I skip display of repeat events on the manage events page?
I need to skip showing repeat events on the manage events section.How can that be implemented programmatically?

# Answer
You need to add some custom code via extension to hide some rows on manage event page. Some quick thoughts are -
> 2 votes

---
Tags: civievent, api
---


# Question
Title: “CiviCRM Upcoming” block displaying old events
Currently running Drupal 7.61 with CiviCRM 5.7.2.

We have the "CiviCRM Upcoming" block enabled in our sidebar, however it continues to display events after their start date.

I've been fixing this by manually going into CiviCRM and disabling events which have passed, but ideally would like the Upcoming Events block to only display events which are actually upcoming (as I read it should here: https://wiki.civicrm.org/confluence/display/CRMDOC46/Event+Listings)

Thank you in advance!

Views export below (not sure if I've done this properly -- haven't done it before!)

```
$view = new view();
$view->name = 'civicrm_events';
$view->description = 'Calendar of CiviCRM Events';
$view->tag = 'civicrm';
$view->base_table = 'civicrm_event';
$view->human_name = 'CiviCRM Events';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Event Calendar';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'view event info';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['mini'] = '0';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['row_plugin'] = 'civicrm_event_calendar';
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array(
  'article' => '#ffffff',
  'page' => '#ffffff',
);
/* Header: Global: Text area */
$handler->display->display_options['header']['area']['id'] = 'area';
$handler->display->display_options['header']['area']['table'] = 'views';
$handler->display->display_options['header']['area']['field'] = 'area';
$handler->display->display_options['header']['area']['label'] = 'Year Month Week Day';
$handler->display->display_options['header']['area']['content'] = '

<a href="/events/year/<?php print date(\'Y\'); ?>">This Year	<a href="/events/month/<?php print date(\'Y-m\'); ?>">This Month	<a href="/events/week/<?php print date(\'Y-m-d\'); ?>">This Week	<a href="/events/day/<?php print date(\'Y-m-d\'); ?>">Today	Full List

';
$handler->display->display_options['header']['area']['format'] = 'php_code';
/* Footer: Global: Text area */
$handler->display->display_options['footer']['area']['id'] = 'area';
$handler->display->display_options['footer']['area']['table'] = 'views';
$handler->display->display_options['footer']['area']['field'] = 'area';
$handler->display->display_options['footer']['area']['label'] = 'More events';
$handler->display->display_options['footer']['area']['content'] = '<a href="/events/month/<?php print date(\'Y-m\'); ?>">More events';
$handler->display->display_options['footer']['area']['format'] = 'php_code';
/* Field: CiviCRM Events: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'civicrm_event';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_civicrm_event'] = 'page';
/* Field: CiviCRM Events: Start Date */
$handler->display->display_options['fields']['start_date']['id'] = 'start_date';
$handler->display->display_options['fields']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['fields']['start_date']['field'] = 'start_date';
$handler->display->display_options['fields']['start_date']['label'] = '';
$handler->display->display_options['fields']['start_date']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['start_date']['hide_alter_empty'] = FALSE;
$handler->display->display_options['fields']['start_date']['date_format'] = 'long';
/* Field: CiviCRM Address: City / Suburb */
$handler->display->display_options['fields']['city']['id'] = 'city';
$handler->display->display_options['fields']['city']['table'] = 'civicrm_address';
$handler->display->display_options['fields']['city']['field'] = 'city';
$handler->display->display_options['fields']['city']['label'] = '';
$handler->display->display_options['fields']['city']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['city']['location_type'] = '0';
$handler->display->display_options['fields']['city']['location_op'] = '0';
$handler->display->display_options['fields']['city']['is_primary'] = 0;
/* Sort criterion: CiviCRM Events: Start Date */
$handler->display->display_options['sorts']['start_date']['id'] = 'start_date';
$handler->display->display_options['sorts']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['sorts']['start_date']['field'] = 'start_date';
$handler->display->display_options['sorts']['start_date']['granularity'] = 'minute';
/* Contextual filter: CiviCRM Events: Start Date */
$handler->display->display_options['arguments']['start_date']['id'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['start_date']['field'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['default_action'] = 'default';
$handler->display->display_options['arguments']['start_date']['default_argument_type'] = 'date';
$handler->display->display_options['arguments']['start_date']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['start_date']['granularity'] = 'year';
$handler->display->display_options['arguments']['start_date']['add_delta'] = 'yes';
$handler->display->display_options['arguments']['start_date']['date_fields'] = array(
  'civicrm_event.start_date' => 'civicrm_event.start_date',
);
/* Filter criterion: CiviCRM Events: Is Active */
$handler->display->display_options['filters']['is_active']['id'] = 'is_active';
$handler->display->display_options['filters']['is_active']['table'] = 'civicrm_event';
$handler->display->display_options['filters']['is_active']['field'] = 'is_active';
$handler->display->display_options['filters']['is_active']['value'] = '1';
$handler->display->display_options['filters']['is_active']['group'] = 0;
/* Filter criterion: CiviCRM Events: Is Public */
$handler->display->display_options['filters']['is_public']['id'] = 'is_public';
$handler->display->display_options['filters']['is_public']['table'] = 'civicrm_event';
$handler->display->display_options['filters']['is_public']['field'] = 'is_public';
$handler->display->display_options['filters']['is_public']['value'] = '1';
$handler->display->display_options['filters']['is_public']['group'] = 0;

/* Display: Month */
$handler = $view->new_display('page', 'Month', 'page');
$handler->display->display_options['display_description'] = 'Monthly calendar of events';
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'date_views_pager';
$handler->display->display_options['pager']['options']['date_id'] = 'month';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['mini'] = '0';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['style_options']['multiday_hidden'] = array(
  'start_date' => 'start_date',
  'city' => 'city',
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'civicrm_event_calendar';
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array(
  'article' => '#ffffff',
  'page' => '#ffffff',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['footer'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: CiviCRM Events: Start Date */
$handler->display->display_options['arguments']['start_date']['id'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['start_date']['field'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['default_action'] = 'default';
$handler->display->display_options['arguments']['start_date']['default_argument_type'] = 'date';
$handler->display->display_options['arguments']['start_date']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['start_date']['add_delta'] = 'yes';
$handler->display->display_options['arguments']['start_date']['date_fields'] = array(
  'civicrm_event.start_date' => 'civicrm_event.start_date',
);
$handler->display->display_options['path'] = 'events/month';

/* Display: Week */
$handler = $view->new_display('page', 'Week', 'page_1');
$handler->display->display_options['display_description'] = 'Weekly calendar of events';
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'date_views_pager';
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
$handler->display->display_options['pager']['options']['skip_empty_pages'] = 0;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['calendar_type'] = 'week';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['mini'] = '0';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['style_options']['multiday_hidden'] = array(
  'start_date' => 'start_date',
  'city' => 'city',
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'civicrm_event_calendar';
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array(
  'article' => '#ffffff',
  'page' => '#ffffff',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: CiviCRM Events: Start Date */
$handler->display->display_options['arguments']['start_date']['id'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['start_date']['field'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['default_action'] = 'default';
$handler->display->display_options['arguments']['start_date']['default_argument_type'] = 'date';
$handler->display->display_options['arguments']['start_date']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['start_date']['granularity'] = 'week';
$handler->display->display_options['arguments']['start_date']['add_delta'] = 'yes';
$handler->display->display_options['arguments']['start_date']['date_fields'] = array(
  'civicrm_event.start_date' => 'civicrm_event.start_date',
);
$handler->display->display_options['path'] = 'events/week';
$handler->display->display_options['menu']['title'] = 'News & Events';
$handler->display->display_options['menu']['description'] = 'Events This Week';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;

/* Display: Day */
$handler = $view->new_display('page', 'Day', 'page_2');
$handler->display->display_options['display_description'] = 'Daily calendar of events';
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'date_views_pager';
$handler->display->display_options['pager']['options']['skip_empty_pages'] = 0;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['calendar_type'] = 'day';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['mini'] = '0';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['style_options']['groupby_times'] = 'half';
$handler->display->display_options['style_options']['multiday_hidden'] = array(
  'start_date' => 'start_date',
  'city' => 'city',
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'civicrm_event_calendar';
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array(
  'article' => '#ffffff',
  'page' => '#ffffff',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: CiviCRM Events: Start Date */
$handler->display->display_options['arguments']['start_date']['id'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['start_date']['field'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['default_action'] = 'default';
$handler->display->display_options['arguments']['start_date']['default_argument_type'] = 'date';
$handler->display->display_options['arguments']['start_date']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['start_date']['granularity'] = 'day';
$handler->display->display_options['arguments']['start_date']['add_delta'] = 'yes';
$handler->display->display_options['arguments']['start_date']['date_fields'] = array(
  'civicrm_event.start_date' => 'civicrm_event.start_date',
);
$handler->display->display_options['path'] = 'events/day';

/* Display: Year */
$handler = $view->new_display('page', 'Year', 'page_3');
$handler->display->display_options['display_description'] = 'Annual calendar of events';
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'date_views_pager';
$handler->display->display_options['pager']['options']['date_id'] = 'month';
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
$handler->display->display_options['pager']['options']['skip_empty_pages'] = 0;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['calendar_type'] = 'year';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['mini'] = '0';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'civicrm_event_calendar';
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array(
  'article' => '#ffffff',
  'page' => '#ffffff',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['footer'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: CiviCRM Events: Start Date */
$handler->display->display_options['arguments']['start_date']['id'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['start_date']['field'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['default_action'] = 'default';
$handler->display->display_options['arguments']['start_date']['default_argument_type'] = 'date';
$handler->display->display_options['arguments']['start_date']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['start_date']['granularity'] = 'year';
$handler->display->display_options['arguments']['start_date']['add_delta'] = 'yes';
$handler->display->display_options['arguments']['start_date']['date_fields'] = array(
  'civicrm_event.start_date' => 'civicrm_event.start_date',
);
$handler->display->display_options['path'] = 'events/year';

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['mini'] = '0';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'civicrm_event_calendar';
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array(
  'article' => '#ffffff',
  'page' => '#ffffff',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['footer'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: CiviCRM Events: Start Date */
$handler->display->display_options['arguments']['start_date']['id'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['start_date']['field'] = 'start_date';
$handler->display->display_options['arguments']['start_date']['default_action'] = 'default';
$handler->display->display_options['arguments']['start_date']['default_argument_type'] = 'date';
$handler->display->display_options['arguments']['start_date']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['start_date']['add_delta'] = 'yes';
$handler->display->display_options['arguments']['start_date']['date_fields'] = array(
  'civicrm_event.start_date' => 'civicrm_event.start_date',
);

/* Display: Upcoming */
$handler = $view->new_display('block', 'Upcoming', 'block_2');
$handler->display->display_options['display_description'] = 'Upcoming Events';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['header'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
$handler->display->display_options['block_description'] = 'CiviCRM Upcoming';

```

# Answer
> 3 votes
In the filter criteria of the view, add the filter - CiviCRM Events: End Date (\>= now)

# Answer
> 1 votes
I ran into this on a Joomla site and may be related. For me, the online registration settings didn’t have an end/date time. Once I set this, these events no longer showed. Again, this was on a Joomla site (no sidebar) and may not be related.

---
Tags: civievent, drupal
---


title: Unable to create a new mailing

text:
# Question
Title: Unable to create a new mailing
I am editing this question to provide more information. I am running CiviCRM 4.7.8 with WordPress 4.5.3. We are using php 5.6.23.

When selecting "New Mailing" from the "Mailings" menu, the screen is blank. Using inspector and console I can see that there are more than 70 errors. The first error is on line 270 of the angular.js file. It seems that there is a comment in the file that is not commented out. All other errors are related to angular, mostly angular is not defined.

So we are unable to do a new mailing. We used this feature early last week and it worked fine. We did not upgrade or install anything new. I tried to turn off extensions, but that had no impact. The extensions were installed prior so no reason to expect that is causing the problem.

Any ideas what would cause this and how to troubleshoot.

Update: We did a fresh install of civicrm, but that did not solve this problem. Also, we have a staging version, which is the same as production without data (a different database) and staging works, just as production worked a few days ago.

When I go into Unscheduled reports, all of my attempts to start a new mailing are listed, but when I click the option to "Continue" I get the same error message.

# Answer
> 3 votes
Found the problem. Debugging was turned on. Once I turned it off "New Mailing" worked.

# Answer
> 1 votes
We had the same problem for a Joomla install with Civi 5.7.2. Deubgging wasn't on, but Asset Caching was. Turning off Asset Caching fixed it for us.

---
Tags: civimail, javascript, angular
---


title: Blank Mosaico templates

text:
# Question
Title: Blank Mosaico templates
Just newly installed Mosaico - I did the three extensions in the right order and the correct versions (afaik), but when I try to create a mailing, the templates are not there, just the text/title. There's no way to edit the template, either when creating a new mail or via the Mosaico Templates menu link.

It's also gone super slow - is this related?

I was going to do a screenshot but now the Mailing edit page won't load. No error message, it just displays the Title ('CiviCRM') and a blank page. Is this related? When I disable just the Mosaico extension, the speed almost returns to normal and the normal 'traditional' mailing component works as normal.

# Answer
> 1 votes
Turning off Asset Caching fixed this issue for us.

# Answer
> 0 votes
I see a similar thing after upgrading CiviCRM from 4.7.30 to 4.7.31, I have as well all the Mosaico templates now blank ! This affect all the archive.

# Answer
> 0 votes
It's probably permission thing with the webserver. We're running nginx and in the nginx logs we were getting access forbidden by rule for this. There are other extensions in the same directory but I guess they don't need the same level of access.

---
Tags: civimail, extension, mosaico
---


# Question
Title: Searching by check number after upgrading to 5.5.0
I recently upgraded to 5.5.0 and now when you edit a pending pay later contribution, add a check number, change status to complete and then i go to search contributions, enter the payment method and search by check number i get no result.

I

# Answer
> 3 votes
I was able to replicate this issue.

Historically, CiviCRM didn't support multiple payments on a single contribution. So the check number is part of the contribution. However, now that it supports multiple payments, the check number is part of the financial transaction.

The check number being searched is the contribution's, not the financial transaction's. I think it needs to be changed; I can't think of a case where it's desirable not to.

I just opened a ticket on https://lab.civicrm.org, financial#37.

---
Tags: civicontribute
---


title: Event Registration - Conditional fields

text:
# Question
Title: Event Registration - Conditional fields
We have online registration for an event. The registration allows the main attendee to register additional participants. The main person and the additional participants have different registration options. I don't want to display the additional participant registration fees/info on the main registration form. I only want to display that on the 'Additional Participant' page. On the additional participant page, which is only displayed if the main participant indicates on the main page that they want to register more than 1 person, I only want to display the additional participant fees.

Right now, this is display on both pages:

How do I just display the Registration pulldown on the main page for the first attendee and just display the additional participant information on the additional participant page? Right now both blocks are displayed on both pages.

I'm using Wordpress 4.9.9 and Civi 5.4.1.

# Answer
> 1 votes
It's not the easiest to work with, but you could do this with the Profile Conditionals extension.

---
Tags: civievent
---


title: How do I run a report for an event

text:
# Question
Title: How do I run a report for an event
How do I run a report on an event that includes things such as participant name, email and organisation they are from?

# Answer
The best approach depends on what you intend to do with the list, but generally speaking you'll use the **Reports** menu as follows:

* In the CiviCRM menu, click **Reports menu » Event Reports**.
* Select **Attendee List**.
* Click the **Columns** tab. Check the box next to **Email** and **Current Employer** (and anything else you need).
* Click the **Filters** tab. In the **Event** box, select the event(s) you want a report on.
* Click the **View Results** (or **Refresh Results** if you already pressed it once).
> 2 votes

---
Tags: civireport, reports
---


title: SMTP Verification failed

text:
# Question
Title: SMTP Verification failed
SMTP settings are checked (with user@domain as login) and *Track replies using VERP in Reply-To header* is disabled (it worked before).
How come a generated email adress name is used as login, thus preventing CiviMAIL to send a test mail?
Drupal 7.61 CiviCRM 4.7.30

> Jan 09 07:00:10 \[info\] Ignoring exception thrown by nullHandler:
> 10005, Failed to add recipient: *user*@*domain*
> \[SMTP: Invalid response code received from SMTP server while sending email.
> This is often caused by a misconfiguration in Outbound Email settings.
> Please verify the settings at
> Administer CiviCRM \>\> Global Settings \>\> Outbound Email (SMTP).
> (code: 550, response: Verification failed for
> \< b.1223.8100.d34261f00e3242ab@*domain*\>
> This email address does not exist. Dit e-mail adres bestaat niet. Sender verify failed)\]

# Answer
My comment above notwithstanding, there is a possibility that this isn't a mail server issue.

If you recently upgraded to a newer version of PHP, you may have gone from a version that uses *mcrypt* to encrypt the outgoing mail password to one that doesn't. To fix this, go to **Administer menu » System Settings » Outbound Mail** and re-enter your SMTP password and save.
> 1 votes

---
Tags: civimail
---


# Question
Title: How to create a search view that displays selected columns
I have never managed to get this function to work properly so here goes.

I have created profile with some custom fields (individual) and selected the option Search Views, Standalone Form or Directory

I then go to advanced search and select the group I want to view; I also select views for display contacts and select the profile I want.

When I press search I get the correct list of people but not the fields that I want to see. I just get display name.

I am on 5.3.2 although i've never been able to get it to work tbh

Any tips!? Thanks Caroline

# Answer
Caroline,

You need to enable additional setting for the fields you want to display them as a column. You can do this now by editing the fields you want to show them as a column and do the following

1. Select 'Expose Publicly' from visibility
2. Check 'Results Column?'

HTH

Pradeep
> 5 votes

---
Tags: profile, advanced-search
---


# Question
Title: How do I set the display size for custom fields?
I have a profile that combines built-in fields with custom fields, both alphanumeric. The custom field displays shorter than the built-in fields which, when I examine the page source, are size="30".

How can I set the display size of the custom field to match that of the built-in fields? I can't find a setting for it in the custom field edit area.

Thanks.

# Answer
The Add/Edit custom field doesn't provide facility to add additional attributes but the Custom field table does have a column to store this attributes and this field is used while rendering the custom field. You can do this by any one of the method below

1. Create a extension and use buildform() hook to add the attribute field on Add/Edit Custom field form. Once its added on the form after submit it will be automatically processed and stored in db by Civi.
2. Once you have created the custom field you can use API explorer(CiviCRM \>\> Support \>\> Developer \>\> API Explorer) to update the attribute for a custom field as shown in below screenshot

> **Note:** Make sure you add space at the end for each attribute as this is concatenated with other attributes while rendering the field.

Thanks

Pradeep
> 3 votes

# Answer
I just use CSS to make the fields the width that I want. For instance:

```
#custom_92 { width: 236px; }

```

I just use the "inspect" feature on my web browser (Chrome: right click on an item, choose Inspect on the menu) to see the pixel width of the field I want to match to. Then I set it to be that same width in my CSS.
> 2 votes

---
Tags: custom-fields, profile
---


# Question
Title: How can I see the quota (number of participants which can still register) under the manage events section?
How can I fetch **the number of participants(quota) who can register for an event** and
the max number of participants in an event if the event has not started on the manage events

# Answer
> 4 votes
There is a BAO function in CiviCRM which returns the available slots for registration

```
CRM_Event_BAO_Participant::pendingToConfirmSpaces($eventId);

```

You can use api to get the max number of participant for an event

```
$result = civicrm_api3('Event', 'getvalue', [
  'return' => "max_participants",
  'id' => 1,
]);

```

To answer your question in detail, you canuse pagerun hook on event page and then get the variable assigned in smarty using `$rows = $page->get_template_vars('rows');` override the variable to add or remove values and then assign it back to smarty using `$page->assign('rows' $rows);`

HTH

Pradeep

---
Tags: civievent
---


# Question
Title: How to add additional action buttons in a civicrm Add Event form?
I have added a button in the EventInfo.tpl

```
 <div class="crm-submit-buttons">
           <div style="display:none">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
           <span class="approved-logic crm-button crm-button-type-upload">
            <button>Approve</button>
        </span>
           <span class="request-approval crm-button crm-button-type-upload"
            <button>Request for Approval</button>

        </div>

```

But when I click on Add Event under Manage Events, I see a popup which does not
show my button but when I click on add event and add it to new window it shows
the button, how can I make sure it works on both the places
1) Popup  2) New Window(which is showing currently)

# Answer
> 4 votes
First think its not a good practice to over-ride any core files specially templates when you can use jQuery to play around.

You can use buildform() hook to add button(s) to a form and the pop up window will recognise the button based on class or attribute and append it on popup form

HTH

Pradeep

---
Tags: civievent
---


title: Deleting Contributions

text:
# Question
Title: Deleting Contributions
I imported 50 new contributions but it did not import correctly.

**How do I delete a contribution?**

Previous suggestions have been to follow this process:

Contributions \> Find Contributions \> \*Enter criteria and Select "Search" \> \*Check Desired Contribution(s) \> Select "delete"

**But a "Delete" button does not exist. Is there another way?**

Thank you

# Answer
There should be a 'Delete contribution' option in the list of actions:

If you don't see it there, check that you have the 'Delete contributions' permission.
> 4 votes

---
Tags: contributions, contribution-page, data-import, delete
---


# Question
Title: Getting permission error when installing CiviCRM under Drupal
I've recently set up a subdomain of mine on a VPS, installed Drupal 7.56, and managed to download the civicrm module but when I go to http://mysite.net/drupal-7.56/sites/all/modules/civicrm/install/index.php

It give me this:

```
You don't have permission to access this page

```

I was logged in as the admin before I tried the install. Not sure if this is file permissions or what.

PHP 7.0 Drupal 7.56 CiviCRM 4.7.28

Thanks in advance, John

# Answer
I faced this problem too and tried a lot of things to make it works, but failed.

Finally, I opened the file "index.php" in "http://(mysite)/sites/all/modules/civicrm/install/index.php". I put the comments in line number 265th through 274th like this.

```
/*
  // Check that user is logged in and has administrative permissions
  // This is necessary because the script exposes the database settings in the form and these could be viewed by unauthorised users
  if ((!function_exists('user_access')) || (!user_access('administer site configuration'))) {
    $errorTitle = ts("You don't have permission to access this page");
    $errorMsg = ts("The installer can only be run by a user with the permission to administer site configuration.");
    errorDisplayPage($errorTitle, $errorMsg);
    exit();
  }
*/

```

Yeah. IT WORKS!!!.

Who use this way like me, DON'T for get to remove the comments after installation is completed.
> 11 votes

# Answer
The error is due to an incorrect base url of your Drupal installation.

Go to site/default and edit the file settings.php

Search for $base\_url, and set it to the correct url of your site.

e.g. http://localhost/~YOUR-USER-NAME/SUBFOLDER-OF-YOUR-SITE

In my case, line 315 of settings.php looks like this:

```
$base_url = 'http://localhost/~alain/civitest';  // NO trailing slash!

```
> 7 votes

# Answer
on investigate the root cause of problem to identify the reason for condition "!user\_access('administer site configuration')" getting true; it is, while checking for the user roles in "user.module", the global variable $user is assigned with values corresponding to anonymous user and that make the condition to true and returns the error message and exits.

May be we need to investigate further in "session.inc" to clearly identify root cause of the problem to find a straight forward solution for this.
> 2 votes

# Answer
I think this message is displayed because of some code that I added during the UK CiviCRM Sprint. This code automatically fills in the database details in the installer.

As this is disclosing sensitive information it checks to see if the user has sufficient permissions to access the installer page. It will fail if your user doesn't have permission to 'administer site configuration'. Please check that your user has the correct permissions.

The check will also fail if Drupal isn't bootstrapped correctly. Is Drupal installed and functioning correctly?
> 2 votes

# Answer
Windows installation (XAMPP) with Drupal 7.59 and civicrm 4.7.31
I tried first the trick of Muhammad Sadiq:
\- it worked to avoid the error and to initiate the install
\- but the permissions for the civicrm module were all blank (index.php?q=admin/people/permissions)
Second I tried the trick of pnbps with commenting line numbers 265th through 274th of "http://(mysite)/sites/all/modules/civicrm/install/index.php"
\- it worked to avoid the error and to initiate the install
\- this time the default permissions for the civicrm module are ok
> 2 votes

# Answer
I have no idea how to solve the issue but I think commenting out the security check is not a great idea :-) As mentioned I encounter the same issue on a clean install of Drupal 7.56 on my local machine without creating any new user. When I then install CiviCRM 4.7.29 I get the permission error. @WilliamMortada: happy to provide details and test if you are happy to have a look.

My own local workaround is to install 4.7.27 and then immediately upgrade!

Checking with Tim here at the sprint: it looks like the test for the permission does not work if you install Drupal in subfolders? We are not sure if that is the issue but it might be worth a quick look.
> 1 votes

# Answer
* i got the point, i also faced the same problem for 2 days and at last i figure out that the user created during installation looks like not given the administrator rights and this might be a bug may be, anyways i did by changing following permissions.
* Goto People-\>permissions
* Under system heading there is 'Administer site configuration' permission.
* Give this permission to Annonymous User and Authenticated User.
* save changes and you are done.

Note: Revoke permission from both users after installation.
> -1 votes

---
Tags: drupal, installation
---


# Question
Title: Somehow our summary fields got a old version of sumfields.php. What's the best way to get the current versions?
The triggers weren't enabled and I tried to get them enabled. Couldn't seem to. Tried uninstalling and reinstalling still didn't work. Dug into it and found it was getting an error when trying to copy the summary fields data from the temp table into the custom fields table. The error was violating a constraint. Debugged it a bit and found that it was creating a row with a null contact\_id. Dug into that and found that sumfields.php was doing an outer join incorrectly. I figured that couldn't be current code and looked at the latest and greatest and found that sumfields.php file was different from ours. Sadly, there are no version numbers or anything on that file so it's hard to tell what version it is.

The info files says it's version 3.1.3. I guessing the last upgrade somehow messed this up.

So the question is what's the best way to get current. Is it to just replace all the files in the custom\_ext with the current ones or is it to uninstall and delete those files or maybe change the info so it thinks it older so I'll prompt for upgrade.

# Answer
> 1 votes
I ended up just changing the version number in the info file to 3.1.0. Then on the Manage Extensions page it then said there was an upgrade. Hit upgrade and everything was good.

---
Tags: summaryfields
---


# Question
Title: Civi 5.9 - DB Error: no such table / cannot disable logging
Drupal 6 / Civi 5.9 / Aegir

I deleted my log\_civicrm\_... tables and now am getting a "DB Error: no such table" across a range of CiviCRM actions including adding contacts, running cron etc.

Logging is switched on and I cannot disable it via Administer \> System Settings \>Misc (...) \> Logging).

Is there another way? Is there a table or a file I can edit or a command I can run to to disable logging?

# Answer
> 3 votes
Try disabling the logging functionality using API Explorer. Navigate from the menu link - `Support -> Developer -> API Explorer`.

Or using Drush(if drupal) -

```
drush cvapi Setting.create logging=0

```

---
Tags: logging, drupal-6
---


title: Impossible to disable logging

text:
# Question
Title: Impossible to disable logging
I am on Civi 4.7.6 / Drupal 7.5

I have not been able to record any new phone numbers for some days (via Webform Integration).

I realize that I have lost a number of log\_civicrm\_... tables (those alphabetically beyond ...\_payment\_processor\_type), and this can be the reason why.

Thus, I would like to disable logging (via Administer \> System Settings \>Misc (...) \> Logging), but I get this error : "Save failed : DB Error : unknown error".

I assume that this error is due to those missing tables.

How can I get out of that ? (I am not a programmer)

...

As a matter of fact, I have an other Test Civicrm, where logging is disabled, and when I want to enable it, I get the same error, and there is no enabling.

Anything in relationship with Drupal ?

BTW, I have all privileges on thoses DBs

# Answer
Fortunately, in CiviCRM 4.7 (and Civi 4.6.17+), installing ANY extension will recreate your missing logging tables. Not that enabling an extension isn't sufficient - you must install an extension. See CRM-15078

The reason this works: If advanced logging is enabled, extensions without a corresponding logging table will generate errors. Because an extension can add a table, there's a function that runs whenever an extension is installed called "fixSchemaDifferences". It checks for any tables without a corresponding logging table and generates it - whether or not that table was added by the extension or not.
> 5 votes

# Answer
I close this question here : things are a bit more complicated : I report a more extended question here :

https://civicrm.stackexchange.com/questions/15062/help-lots-of-troubles-malfunctions-errors-civi-4-7-6-and-4-7-11-dru

Thanks anyway
> 1 votes

# Answer
2019 UPDATE - In case anyone finds this question there is an answer at Civi 5.9 - DB Error: no such table / cannot disable logging
> 1 votes

---
Tags: logs, logging
---


# Question
Title: Any OTHER way to disable DB logging (CiviCRM 4.6x)?
Enabled logging to a DB caused "TABLE log\_xxx doesn't exists" similar to this issue ; Extension installation (which should re-create LOG\_ tables) has failed by the same reason. A sneaky trick from here hasn't worked either, due to a missing MySQL/MariaDB ARCHIVE engine, which by default is being used for LOG\_ tables.

Any other options of disable logging, apart from messing with MySQL installation and temporary DB tables re-creation code insertion?

Thank you!

# Answer
UPDATE in case anyone stumbles on this question. There is a working answer at Civi 5.9 - DB Error: no such table / cannot disable logging
> 1 votes

---
Tags: logging, db-logging, mariadb
---


# Question
Title: CiviMail > New Mailing > No recipients Error
We've recently installed CiviCRM 4.6.6 and we're on WordPress 4.3. I'm experiencing the same issues as shown in this thread: CiviMail Mailing - Unable to select group, getting error of No recipients When I go into New Mailing, No Recipients shows up on the right. I can't enter email addresses, I can't select a group, I'm stuck. If I use Search and select a group, and pick the Action to Send a Mass Mailing, the Mail screen has Recipients = Search Results, but still says No Recipients. I'm stuck. Since Mail won't work Debug and Backtrace can't either. I don't know what Ajax is, I'm not that techie. We're on DreamHost, no cpanel, but I can use FTP. Send Mail works and there's no one opted out or anything in my test group. This looks like a bug that's been around for a few months? How can I fix this??? Thanks, in advance...jim

# Answer
> 0 votes
This \> check the **Mailing list checkbox** for Group Type

Solved this issue for me.

---
Tags: civimail
---


# Question
Title: How to get contact id of logged-in user in JS API
Sorry if I'm being thick here, but I've looked and looked. Is there an API call to get the contact id of the logged-in user?

What I need to do is check whether an activity has been authored by the logged in user (in order to show or hide an edit button, in an angular extension).

If there is a way of restricting people from editing (but not from viewing) CiviCase activities that weren't created by them, that would be even better, but I fear it will be easier to do the above.

Cheers

# Answer
In case of an angular page use something like

```
function myext_civicrm_angularModules(&$angularModule) {
  [...]
  $session =& CRM_Core_Session::singleton();
  drupal_add_js(array('CurrentCiviUid' => $session->get('userID')), 'setting');
  [...]
}

```

and access it in JS:

```
var uid = Drupal.settings.CurrentCiviUid;

```
> 3 votes

# Answer
For a Javascript-only solution, you can also make an API call using `user_contact_id` for the contact ID. For instance:

```
$result = civicrm_api3('Contact', 'get', [
  'sequential' => 1,
  'return' => ["id"],
  'id' => "user_contact_id",
]);

```
> 2 votes

---
Tags: api, javascript, angular
---


title: Thank you page not displaying

text:
# Question
Title: Thank you page not displaying
Whenever someone registers for an event, this error displays instead of the thank you page:

I'm using Wordpress and I have a civicrm page, and I have the Wordpress base page set to the civicrm page on the CMS Database Integration page in civi. The url for the error page displayed is: ?page=CiviCRM&q=civicrm%2Fevent%2Fregister&\_qf\_ThankYou\_display=true&qfKey=

I see the error below in the the civi debug log.

A thank you email is sent as requested. I'm usisng CiviCRM 5.4.1 and Wordpress 4.9.9.

What do I need to configure or change to fix this problem?

ETA: The thank-you page used to display properly. I think it stopped working when Wordpress was automatically updated to 4.9.9. Any ideas?

Update: We are using credit cards through Paypal Website Payments Pro for payments. The transactions go through and are marked as complete.

We also get this error when people register with a discount code giving them a free registration, thus no paypal transactions are required, or if they register using the pay later option. For donations and memberships, the orginal donation or membership screen is displayed instead of the thank you screen.

Update:

I finally found the correct debug log. We have a subsite and I was looking at the main site ConfigAndLog. Here's the error and backtrace:

```
Jan 07 11:01:08  [info] $Fatal Error Details = Array
(
     [message] => Could not find valid value for id
     [code] =>
)

Jan 07 11:01:08  [info] $backTrace = #0 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(381): > CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Request.php(121): CRM_Core_Error::fatal("Could not find valid value for id")
#2 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php(52): CRM_Utils_Request::retrieve("id", "Positive", Object(CRM_Event_Controller_Registration), TRUE)
#3 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php(47): CRM_Event_StateMachine_Registration->__construct(Object(CRM_Event_Controller_Registration), TRUE)
#4 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(304): CRM_Event_Controller_Registration->__construct("Event Registration", TRUE, "null", NULL, "false")
#5 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
#6 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#7 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:3))
#8 /var/www/vhosts/site/httpdocs/wp-content/plugins/civicrm/includes/civicrm.basepage.php(141): CiviCRM_For_WordPress->invoke()
#9 [internal function](): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
#10 /var/www/vhosts/site/httpdocs/wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
#11 /var/www/vhosts/site/httpdocs/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))
#12 /var/www/vhosts/site/httpdocs/wp-includes/plugin.php(515): WP_Hook->do_action((Array:1))
13 /var/www/vhosts/site/httpdocs/wp-includes/class-wp.php(728): do_action_ref_array("wp", (Array:1))
#14 /var/www/vhosts/site/httpdocs/wp-includes/functions.php(960): WP->main("")
#15 /var/www/vhosts/site/httpdocs/wp-blog-header.php(16): wp()
#16 /var/www/vhosts/site/httpdocs/index.php(17): require("/var/www/vhosts/site/httpdocs/wp-blog-header.php")
#17 {main}

```

# Answer
> 2 votes
I am fairly confident that your issue is that the WordPress `redirect_canonical` function is rewriting your unescaped CiviCRM URLs and redirecting to properly escaped URLs during the registration process. This would cause your session to be cleared during the redirect.

I recently fixed the as much of the code as I could find where CiviCRM generates URLs and updated it to produce valid URLs that wouldn't be caught by `redirect_canonical`. The latest CiviCRM has the fixes (so upgrading is as always recommended) but here are the relevant PRs in case you want to back-port them to your version:

As the question is also Paypal-related, you should also be aware of:

I haven't verified that jgillmanjr's fix works, but the logic looks right to me.

---
Tags: wordpress, civievent, civimember, paypal
---


title: Mass upload of file to records

text:
# Question
Title: Mass upload of file to records
I have a bunch of certificates which are scanned as images that needs to be uploaded into the correct record to be attached in the Certificate file field. Can this be 'imported' like how you can import data into CIVICRM contacts ? Thanks.

Clement

# Answer
> 0 votes
While Aidan's answer is correct that it's not hard to code a solution, you might be asking if a solution has already been coded. If so, I'm afraid the answer is no.

# Answer
> 3 votes
This should be fairly simple to script using the Attachment api. For docs, go to https://dmaster.demo.civicrm.org/civicrm/api#docs and select Attachment as the entity which has an example of using create with a custom field.

---
Tags: data-import
---


# Question
Title: Stripe - Billing section not displaying for events
CiviCRM: 5.6.1 Drupal: 7.59 Stripe extension: 5.2

For contributions, stripe integration is working fine but for paid events, billing section do not shows up when amount is selected.

# Answer
> 1 votes
Its resolved, problem was a civicrm custom template file needed to be updated.

---
Tags: civievent, stripe, billingblock
---


title: API 'match' => "external_identifier"

text:
# Question
Title: API 'match' => "external_identifier"
I am writing a script that updates contacts from an external source when their external identifier is equal to the contact being imported. My research shows (and the API explorer confirms) that it should look like this:

```
'options' => ['match' => "external_identifier"],

```

I get the error "CiviCRM\_API3\_Exception: Ambiguous match criteria in civicrm\_api3() (line 45 of /var/www/html/sites/all/modules/civicrm/api/api.php)."

Can anyone suggest a solution for what I am doing wrong?

Thanks, Josh

# Answer
> 3 votes
You need to implement something like below

```
$result = civicrm_api3('Contact', 'create', [
  'first_name' => "first name",
  'last_name' => "last name",
  'email' => "pradeep@test.com",
  'external_identifier' => "S-123456",
  'options' => ['match' => "external_identifier"],
]);

```

Make sure you pass `external_identifier` in api params.

So basically above code snippet will first check if external\_identifier "S-123456" is present in database and get its id if present and update the contact, if not present then new contact will be created.

HTH

Pradeep

---
Tags: api, duplicate-contacts
---


# Question
Title: when upgrading should i delete all files AND all folders in templates_c directory?
I am following the wordpress upgrade procedure here: https://docs.civicrm.org/sysadmin/en/latest/upgrade/wordpress/

the instrucutions say to clear cached files by removing all files in the templates\_c directory.

I have a subdirectory en\_US within the templates\_c directory which has many further subdirectories. Am i supposed to delete these too? or just the files in the template\_c director itself?

many thanks

# Answer
Yes also the en\_US subfolder. Actually **especially** that folder, since that's where the precompiled files get stored.

You can also use the menu option under Administer -\> System Settings -\> Cleanup Caches, which will do it for you.
> 2 votes

---
Tags: upgrade
---


title: Invoices option

text:
# Question
Title: Invoices option
I have a question, please? in case validated creation invoice option on CiviCRM, is there any possibility to use it for the events only, and deactivate it for the membership? Thanks,

# Answer
> 2 votes
To me it sounds as if there has been a similar question with some answers some years ago in this forum:

Custom Invoice ID

The latest comments are from 2017/2018. Apparently, there has been a PR for custom invoice IDs, but it appears to be closed without pulling it into core.

However, some workarounds are discussed also. Hope this helps a bit.

---
Tags: invoice
---


title: Data Importation Issue

text:
# Question
Title: Data Importation Issue
Procedural question... I have a record set of individuals related to various organizations. The employee/individual info set is handled well, EXCEPT FOR organization name... i can get work phone, work address, work city, work state, work zipcode. And, in organization, there rightly are no individual information fields.

So, what comes first, chicken or the egg?

Assume it best practice to import organization info first, then the individual info??? As this makes sense. But, I cannot find answer on how to get the "organization name/Employer" field into the individual recordset so I can then toggle the individual/organization relationship.

Hopefully, I'm missing something simple.

PS I've imported 100k records for individuals so far, thou no employer/employee relationship. Now the "vender" database set is coming on, thus another riddle.

thx

# Answer
> 3 votes
In your spreadsheet, you should have the organization name and all organization info on the same row as the individual/employee info.

When mapping the import, for all the organization fields first select "employee of". another drop down menu will appear to select the field (org name, email...)

This will import both contacts with their relationship. Note that you can only import 1 relationship per import.

# Answer
> 1 votes
Jenni Simmonis's clarification is precisely correct. Import organizations first. PRIOR TO importing "employees", be certain the relationship desired exists. Then, when importing "employees", include the organization and that field then select the relationship "employee of". Works perfectly! Thx.

---
Tags: relationships, data-import
---


# Question
Title: how to get list of all buttons in civicrm hook_buildform?
I need to add one more button to an event form but right now when I use

```
addButtons

```

it overrides existing buttons How can I make sure the buttons which I add are updated instead of replacing the existing ones?

```
function custom_changes_civicrm_buildForm($formName, &$form){
  if($formName == 'CRM_Event_Form_ManageEvent_EventInfo' && $user->uid){
        $buttons = array(
        array(
          'type' => 'upload',
          'name' => ts('Request for Approval'),
          'isDefault' => TRUE,
        ),
      );
      $form->addButtons($buttons);

  }
}

```

In the CRM\Event\Form\ManageEvent.php
I see there are protected variables, which I am unable to add it in the conditions inside hook\_buildForm
e.g. \_cancelURL, \_single , so how can I override it using hook\_buildForm , an
example would be helpful.

```
 /**
   * Build the form object.
   */
  public function buildQuickForm() {
    $session = CRM_Core_Session::singleton();

    $this->_cancelURL = CRM_Utils_Array::value('cancelURL', $_POST);

    if (!$this->_cancelURL) {
      if ($this->_isTemplate) {
        $this->_cancelURL = CRM_Utils_System::url('civicrm/admin/eventTemplate',
          'reset=1'
        );
      }
      else {
        $this->_cancelURL = CRM_Utils_System::url('civicrm/event/manage',
          'reset=1'
        );
      }
    }

    if ($this->_cancelURL) {
      $this->addElement('hidden', 'cancelURL', $this->_cancelURL);
    }

    if ($this->_single) {
      $buttons = array(
        array(
          'type' => 'upload',
          'name' => ts('Save'),
          'isDefault' => TRUE,
        ),
        array(
          'type' => 'upload',
          'name' => ts('Save and Done'),
          'spacing' => '                 ',
          'subName' => 'done',
        ),
        array(
          'type' => 'cancel',
          'name' => ts('Cancel'),
        ),
      );
      $this->addButtons($buttons);
    }
    else {
      $buttons = array();
      if (!$this->_first) {
        $buttons[] = array(
          'type' => 'back',
          'name' => ts('Previous'),
          'spacing' => '     ',
        );
      }
      $buttons[] = array(
        'type' => 'upload',
        'name' => ts('Continue'),
        'spacing' => '         ',
        'isDefault' => TRUE,
      );
      $buttons[] = array(
        'type' => 'cancel',
        'name' => ts('Cancel'),
      );

      $this->addButtons($buttons);
    }
    $session->replaceUserContext($this->_cancelURL);
    $this->add('hidden', 'is_template', $this->_isTemplate);
  }

```

# Answer
> 3 votes
You will need to over-ride the button to include existing + new button through buildform. The other option is to add button using smarty in tpl file using below snippet

```
{crmButton p='civicrm/request' q="action=browse&reset=1&gid=$gid" icon="th-list"}{ts}Request for Approval{/ts}{/crmButton}

```

HTH

Pradeep

---
Tags: quickform, button
---


title: Mass cancelation of memberships

text:
# Question
Title: Mass cancelation of memberships
I have a list of some 700 email addresses that currently have a membership status of *Current*. I'd like to change to a new Membership status I've created in Membership Status Rules called *Bouncing Cancelled*.

I've tried exporting doing it via an import:

```
"Email","Membership ID","Membership Start Date","Membership Type","Status Override","Status Override End Date","Membership Status"
"xxxx@yyyy.com","19201","2018-10-01","Member","1",,"Bouncing Cancelled"

```

And variations of that (like setting the just the status to just *Cancelled*), but regardless of what I do the import always fails with: `Invalid value for field(s) : Membership Status`.

Can suggest a different way?

# Answer
> 2 votes
`Invalid value for field(s) : Membership Status` means that the csv file had invalid options for Membership status. The import file should use machine name rather label (or hopefully membership status ID).

Here is the similar post that might help to find solution for your question.

Cheers

Pradeep

---
Tags: civimember, status
---


# Question
Title: Ignoring a hidden field on event registration form
I have a custom event template on which I hide some fields based on whether someone is registering themselves or an additional participant. There are 2 different price options, one for the main registrant and one for the additional participant. The price set needs to have required fields for each situation. How can I get civi to ignore the required fields if they are hidden?

# Answer
> 2 votes
AFAIK this cannot be controlled in CiviCRM ATM. However there is an extension(from Allen Shaw) for conditional filtering on profile but I guess this will not work in your case.

I would suggest you to create an extension and use combination of buildForm or ValidateForm hook to achieve.

Cheers

Pradeep

---
Tags: civievent, custom-templates
---


# Question
Title: civicrm dashboard menu does not work in Joomla
I have installed Joomla on CentOS 7, and then CiviCRM 5.9 on top of that. If I install a CRM dashboard menu I get an error message "Requested page can't be found". (I tried logging on to Joomla as the administrator, but the error still occurs. Do I need to create / log in as a different user?)

Additional error message text is as follows: ' @import url(/joomla/components/com\_civicrm/civicrm/css/civicrm.css); @import url(/joomla/components/com\_civicrm/civicrm/css/crm-i.css); @import url(/joomla/components/com\_civicrm/civicrm/bower\_components/font-awesome/css/font-awesome.min.css); Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. You do not have permission to access this page.

Return to home page.

function toggle( element ) { var parent = element.parentNode; var className = parent.className; if ( className == 'crm-accordion-wrapper collapsed crm-fatal-error-details-block') { parent.className = 'crm-accordion-wrapper crm-fatal-error-details-block'; } else { parent.className = 'crm-accordion-wrapper collapsed crm-fatal-error-details-block'; } } '

From what I can see, the addition of the CRM dashboard menu should have worked straight out of the box. Am I missing something here?

Any advice would be most appreciated.

# Answer
> 4 votes
You are right that it should work out-of-the box. This might not be the full solution, but your error is showing that the URLs are missing `/administrator` (that is, `/joomla/components/com_civicrm/civicrm` should be `/joomla/administrator/components/com_civicrm/civicrm`) so I think you are affected by this issue: https://lab.civicrm.org/dev/joomla/issues/5

Try changing 'CiviCRM Resource URL' (in Administer \> System Settings \> Resource URLs) from `[civicrm.root]` to `administrator/components/com_civicrm/civicrm/`.

I suspect there will still be something else to solve but try that to begin with.

---
Tags: joomla
---