CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Joomla Extensions (Moderator: lcdweb) »
  • Set default membership status to pending
Pages: [1]

Author Topic: Set default membership status to pending  (Read 1793 times)

5b4ahz

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 3.3.2
  • CMS version: joomla 1.5.15
  • MySQL version: 5.0.75
  • PHP version: 5.2.6-3ubuntu4.5
Set default membership status to pending
January 16, 2011, 12:50:49 pm
Hi,
using joomla,
I need to set the membership status to "Pending", and membership type to "Regular" or "Associate", based on whether or not a specific custom field is filled out during a new individual registration.

Alternatively, if the above is not possible, once a user registers on the joomla site, he is redirected to a new individual registration form for civicrm. How can the membership status of all new individual registrations be set to "pending", so that the administrator can filter them at a later stage and set their membership type accordingly.

Any ideas on either solution (preferably the first) would be more than welcomed.
Thanks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Set default membership status to pending
January 16, 2011, 06:11:58 pm

You should be able to do this via hooks. Check:

http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviCRM+hook+specification
http://en.flossmanuals.net/CiviCRM/DevelopIntro (though this link seems broken at this very minute (sun nite))

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

5b4ahz

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 3.3.2
  • CMS version: joomla 1.5.15
  • MySQL version: 5.0.75
  • PHP version: 5.2.6-3ubuntu4.5
Re: Set default membership status to pending
January 31, 2011, 03:21:12 am
Hi,
I've been trying to get the above to work. As I am very new to civicrm I would appreciate any help with my code. It seems to freeze on me without doing what it's meant to. (I am using civicrm for joomla).

Basically, once an individual register's or edits his/her details during a new registration, I check a custom field known as callsign. If this is empty I set the membership type to "2" (Associate), otherwise I set the membership type to "1" (Regular).  For the moment the status id is set to Pending.

Code: [Select]
<?php
$custom_fields 
= array('callsign' => 'custom_1');
function 
joomla_civicrm_post($op, $objectName, $objectId, &$objectRef) {
  
/**************************************************************
  * status_id
  *  1 New, 2 Current, 3 Grace, 4 Expired, 5 Pending, 6 Cancelled, 7 Deceased
  *
  * membership_type_id
  *  1 Regular, 2 Associate, 3 Honorary
  *
  *  with id   if  value_amateur_radio_1.callsign_1 = blank   then  membership_type_id = 2 and status_id = 5
  *  with id   if  value_amateur_radio_1.callsign_1 <> blank  then  membership_type_id = 1 and status_id = 5
  **************************************************************/

  /**************************************************************
  * Set membership type and status when Individual Contact is CREATED or EDITED
  */

//if ($objectName != 'Individual' || ($op != 'edit' && $op != 'create')) {
  
if ($objectName != 'Individual' || ($op != 'create')) {
     return;
  }

  
$get_params = array('entityID' => $objectRef['contact_id'],
       
$custom_fields['callsign'] => 1 );

  require_once 
'CRM/Core/BAO/CustomValueTable.php';

  
$values = CRM_Core_BAO_CustomValueTable::getValues($get_params);
  
$callsign_field = $values[$custom_fields['callsign']];

  if ( 
$callsign_field == "" ) {
   
/*    assign membership_type_id = 1 and status_id = 5    */
        
$customParams = array("contact_ID" => $objectId,
            
"membership_type_id" => 2,
            
"status_id" => 5);
     } else {
   
/*    membership_type_id = 2 and status_id = 5    */
        
$customParams = array("contact_ID" => $objectId,
            
"membership_type_id" => 1,
            
"status_id" => 5);
     }

  require_once 
'CRM/Member/BAO/Membership.php';
  
CRM_Member_BAO_Membership::setValues( $customParams );

}
//end FUNCTION

?>


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Joomla Extensions (Moderator: lcdweb) »
  • Set default membership status to pending

This forum was archived on 2017-11-26.