23 votes

How would you anonymise (or redact) private data for developer stage?

Some thoughts Anonymizing data is hard work. Eg: Would it be OK if your developer could de-anonymize your contacts by identifying from geolocated data? What about identifying by "metadata", ...
Chris Burgess's user avatar
9 votes
Accepted

How to develop extension that relies on libs brought in by composer

Approaches There are a few different patterns one could follow in connecting Civi extensions with composer: (Broad scope) Site build via composer: The entire web site is defined with a custom ...
Tim Otten's user avatar
  • 5,684
9 votes
Accepted

How can I use Xdebug with CiviCRM unit tests?

Xdebug configuration is a somewhat temperamental issue -- the details depend on the IDE, the PHP build, host OS, target application, test suite, etc. Providing a good answer to this is tricky -- e.g. ...
Tim Otten's user avatar
  • 5,684
9 votes

How do I make the menubar a different color on my dev/staging sites

As of CiviCRM v5.12.1 the menubar color is a configurable setting. On your main site you can change the color via the UI by visiting Administer -> Customize Data & Screens -> Display Preferences. ...
Coleman's user avatar
  • 18.3k
8 votes
Accepted

Find CiviCRM version programmatically?

Agree with Chris that System.get is a great API for inspecting the system -- with a trade-off of breadth vs speed. If you need something more performant, use CRM_Utils_System::version(), e.g. $ cv ...
Tim Otten's user avatar
  • 5,684
8 votes
Accepted

CiviCRM integration with Eventbrite

You will need to create extension to have Eventbrite sync with CiviEvents. Here is some guideline on how to approach this Create extension. Add page using civix In run() use CiviCRM api to create ...
Pradeep Nayak's user avatar
7 votes

Find CiviCRM version programmatically?

I'd use System.get API call. (source) In the return values, there's a value for version which corresponds to the value in civicrm-version.php $ cv api System.get name=version { "is_error": 0, ...
Chris Burgess's user avatar
7 votes

ER diagram for the latest Civicrm , Foreign key in Structure, test cases/plans

I will answer your questions #1 and #2. (I'm not sure what you mean by #3. If #3 is sufficiently unrelated to #1 and #2, I would suggest creating a separate question for it) Why an ER (Entity ...
Sean's user avatar
  • 3,168
7 votes

Within an extension how can load a custom `Civi` name-spaced class?

Add the following elements to your extension's info.xml file to enable PSR-4 autoloading: <classloader> <psr4 prefix="Civi\" path="Civi"/> </classloader> Also see docs on the <...
Sean's user avatar
  • 3,168
7 votes

How to create a hook in an extension?

EDIT This answer is now deprecated, you should use @bgm's answer instead, or for an alternative and possibly cleaner approach, try my other answer All thanks to the code example link in Eric's answer ...
artfulrobot's user avatar
  • 3,920
6 votes
Accepted

Civix reports "Failed to locate civicrm.settings.php"

The generate:api subcommand (and a few others) require access to a working copy of CiviCRM. To locate this, it uses a process reminiscent of drush or wp-cli. For example, if the command-line is ...
Tim Otten's user avatar
  • 5,684
6 votes

Are there up-to-date CiviCRM coding standards available?

Using the Drupal standards in your IDE ought to get you most of the way. For fine-tuning you can see https://wiki.civicrm.org/confluence/display/CRMDOC/PHP+Code+and+Inline+Documentation and also try ...
Coleman's user avatar
  • 18.3k
6 votes

What does LExIM stand for?

LExIM is the new overall release and extension strategy: LEAP BY EXTENSION. ITERATE BY MONTH. It basically means that: CiviCRM development will now happen mostly through extensions, ...
ErichBSchulz's user avatar
  • 1,571
6 votes
Accepted

Fetch data over the web: curl, file_get_contents or something else?

CiviCRM core has bundled in Guzzle for a few years now (this was an old issue that got highlighted just now) - so Guzzle is the recommended approach
eileen's user avatar
  • 2,204
6 votes
Accepted

How to reset the headless test db?

ah-ha! In your test class edit the setUpHeadless() method which might look at first like this: public function setUpHeadless() { ...
artfulrobot's user avatar
  • 3,920
5 votes
Accepted

Using event listeners in my extensions

I have found why it was not working. I was looking in the user interface whether my tokens showed up in the list with tokens a user can use. But they did not. After digging all the core code I found ...
Jaap Jansma - CiviCooP's user avatar
5 votes

Are there up-to-date CiviCRM coding standards available?

For IDE purposes, look at https://github.com/civicrm/coder/ This is a fork of drupal/coder which relaxes a number of conditions. (The coding practices in Civi differed from Drupal in some non-...
Tim Otten's user avatar
  • 5,684
5 votes
Accepted

How do I make one hyperlink which shows its target page as a modal dialog when clicked?

It's quite simple actually. Add the css class crm-popup to the link and you're done :)
Coleman's user avatar
  • 18.3k
5 votes

How can I help review/test a Webform CiviCRM PR

You will need ssh access to the code base (on your server): First: when working on latest code edits you may need to pull in the latest edits (that may not have been released yet) -> for example: ...
KarinG - Semper IT's user avatar
5 votes

How to create a hook in an extension?

Here is an example of a hook we created for CiviRules: https://lab.civicrm.org/extensions/civirules/blob/master/CRM/Civirules/Utils/HookInvoker.php Hope this helps :-)
ErikH - CiviCooP's user avatar
5 votes

How to create a hook in an extension?

Here is an example using the named parameter syntax: CRM_Utils_Hook::singleton()->invoke( ['pdf', 'pdf_variables', 'receipt'], $pdf, $pdf_variables, $receipt, CRM_Utils_Hook::$_nullObject, ...
bgm's user avatar
  • 3,401
5 votes
Accepted

Create new contact sub-type when extension is installed

A contact subtype is an "entity" - it exists as a record in the civicrm_contact_type table. So that means you can use the "managed entity" approach described here: https://civicrm.org/blog/totten/api-...
Alan Dixon's user avatar
  • 6,786
4 votes

How can I deal with a missing or corrupt binary ("advanced") log table?

As of CiviCRM 4.7, you can fix this by installing any extension; see CRM-15078. Schema differences are fixed on extension installation. If you are on an earlier version of CiviCRM, there's a trick ...
Jon G - Megaphone Tech's user avatar
4 votes

How can I use CiviCRM's cache table?

I found the corresponding reference page here: https://docs.civicrm.org/dev/en/latest/framework/cache/ Looks straightforward: Set a cache value with Civi::cache()->set('mykey', 'myvalue'); Get a ...
Alan Dixon's user avatar
  • 6,786
4 votes

How to communicate with the users of an extension?

The short answer is no. Per this blog post, only the core team can control in-app messages. I'd say you'd have to make your appeal directly to them. I'm sure they'd be hesitant (with good reason), ...
Jon G - Megaphone Tech's user avatar
4 votes

API: How do I delete a custom value?

Currently, you can't do this. If you try, you will get the notice: API (CustomValue, delete) does not exist (join the API team and implement it!) This is true for CiviCRM version 4.7.7, which is ...
moopet's user avatar
  • 145
4 votes

What are the most popular extensions for CiviCRM?

Here's the answer - the most popular extensions for CiviCRM ranking numbers are here: https://stats.civicrm.org/?tab=sites
Joe McLaughlin's user avatar
4 votes
Accepted

How to set a default value for a custom field

Used to work, before CiviCRM v5.18 Here's how I've opted to do it. Please do submit alternative answers if there's a better way. Use the civicrm_post hook like this: Note that you need to replace N ...
artfulrobot's user avatar
  • 3,920
4 votes
Accepted

What's the recommended way to handle redirection after quickform submissions?

Use the built in button types and corresponding CRM_Core_QuickForm_Action_* classes that are invoked when those buttons are clicked. For example, clicking on a button created with $this->...
michaelmcandrew's user avatar
4 votes

Where can our small non-profit find assistance with CiviCRM?

Best place to look for a CiviCRM Partner/Contributor is here: https://civicrm.org/partners-contributors - there are many Partners/Contributors in the US - even if you can't locate one in Michigan - ...
KarinG - Semper IT's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible