Skip to main content

GROWING AND SUSTAINING RELATIONSHIPS

GROWING AND SUSTAINING RELATIONSHIPS
Close
Lisa Hubbert

94110

Creative Arts Charter School, SFArtsED

http://www.sfartsedsummer.org

Online donations, class registration, school tour registration, online enrollment applications, volunteer hour tracking, organization directories

GROWING AND SUSTAINING RELATIONSHIPS
Close
Michal Mach

Core Team Member, Developer, Implementor

CiviCRM, Caltha

http://civicrm.org

I've always been passionate about what non-profits and advocacy groups can achieve using technology. For me, CiviCRM shows an essential example of how non-profit and technology worlds can come together to provide real change - working as community, creating value for yourself, but also for others in non-profit sector.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Sushant Paste

Developer

Implementors and Developers

http://osseed.com

Worked with CiviCRM as core team developer for more than 2 years. Now we are working as a team and providing service with CiviCRM installation, customization and training. One thing about CiviCRM community is that it's very healthy and really helpful. It's really great that i am part of this community and we want to grow this more and more . Also whatever the problems we are facing there is a solution on forums, or we will get the proper guidelines to solve the issues. Big salute to the CiviCRMcommunity :)

GROWING AND SUSTAINING RELATIONSHIPS
Close
Lynna Landstreet

Web developer

Freeform Solutions

http://www.freeform.ca

Freeform Solutions uses CiviCRM to help the non-profit organizations we develop sites for to manage information about their members, volunteers, activists, donors, employees and other contacts, and to handle donations, correspondence, mailings and more. We support the CiviCRM community by contributing documentation, patches, modules and code, and are a silver sponsor of CiviCon 2013.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Gary Zimmerman

Implementor

CSH Consulting, Inc.

http://www.eCSH.net

CiviCRM is a great tool for the Non-Profit world. Our business needed a solution for them. CiviCRM is that solution.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Andrew Wasson

Implementor, Developer

Luna Design

http://www.lunadesign.org

We produce custom civiCRM/Drupal solutions for professional organizations and societies to satisfy their membership management needs. In its standard configuration, civiCRM provides a great deal of functionality and its integration with Drupal is outstanding.

We are also active in extending civiCRM with custom extension modules which are in development at our Github account(https://github.com/awasson)

GROWING AND SUSTAINING RELATIONSHIPS
Close
Karen Morrissey

Administrator

Democratic Party of Denver

http://www.denverdemocrats.net

We use CiviCRM to communicate with our members and volunteers.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Jon Goldberg

Implementor

Palante Technology Cooperative

http://palantetech.com

Palante Tech works with social justice organizations on a tight budget to be more effective through technology. CiviCRM allows us to provide a high-quality low-cost database for community organizing, donor and membership management.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Joshua Lange

Administrator

Concordia Welfare & Education Foundation

http://cwef.org.hk

CWEF is deploying CiviCRM on Wordpress to build and manage a database of our staff, volunteer, recipient, donor and partner contacts.

GROWING AND SUSTAINING RELATIONSHIPS
Close
David Barratt

Developer

Donor Depot

http://www.donordepot.com

They provide us a way to manage Non-Profit Donors

GROWING AND SUSTAINING RELATIONSHIPS
Close
Linus Widborg

Administrator

Responsive Development Tecnologies

http://www.responsive.se

We use CiviCrm to keep track of our customers and to administer our seminars and conferences.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Michael Daryabeygi

Implementor

Ginkgo Street Labs

http://ginkgostreet.com

CiviCRM enables me to empower my clients with a database that suits their unique needs.

LOGIN | REGISTER
  • Create new account
  • Request new password

Search form

  • BLOG
  • DEMO
  • Find An Expert
  • NEED HELP
  • SUPPORT US
  • DEVELOPER RESOURCES
CiviCRM Community Site logo CiviCRM Community Site
  • WHAT IS CIVICRM
    • Community
    • Case Studies
    • Experts
    • Contributors
    • Core Team
    • Licensing
    • Contact Us
  • WILL CIVICRM MEET YOUR NEEDS?
    • Contacts
    • Contributions
    • Communications
    • Peer-To-Peer Fundraisers
    • Advocacy Campaigns
    • Events
    • Members
    • Reports
    • Case Management
  • GET STARTED
    • Evaluate Your CRM Needs
    • Evaluate CiviCRM Features
    • Read Books
    • Contact an Ambassador
    • Demo CiviCRM
    • Download CiviCRM
    • Download Extensions
    • Find An Expert
  • PARTICIPATE
    • Join the community
    • Make it happen
    • Support CiviCRM
    • Meet ups
    • Document CiviCRM
    • Translate CiviCRM
    • Developer resources

You are here

Home » Blogs » Stoob's blog

Blog

  • API
  • Architecture Series
  • CiviCampaign
  • CiviCase
  • CiviCon
  • CiviContribute
  • CiviCRM
  • CiviCRM v4.1
  • CiviEvent
  • CiviMail
  • CiviMember
  • CiviMobile
  • CiviPledge
  • CiviReport
  • Documentation
  • Drupal
  • Extensions
  • Finance and Accounting
  • Interface Design and Layout Standards
  • Internationalization and Localization
  • Joomla
  • Make it happen
  • Marketing and Promotion
  • Meetups
  • Older Versions
  • Release
  • Schools
  • Solutions (case studies and user stories)
  • Sprints
  • Teams
  • Training
  • v1.6
  • v1.7
  • v1.8
  • v1.9
  • v2.0
  • v2.1
  • v2.2
  • v2.3
  • v3.0
  • v3.1
  • v3.2
  • v3.3
  • v3.4 and v4.0
  • v4.2
  • v4.3
  • WordPress

Using only jQuery and CiviCRM to create Members Only Pricing

Submitted by Stoob on February 13, 2012 - 19:44

There have been several hook() or Drupal module based solutions for "members only" pricing for events or for other 'discounts' related to memberships.

 

I take a different approach by using only jQuery and blocks in Drupal 6.  For those who use Drupal 7 you can adapt this code with Drupal 7's new javascript namespace and Joomla folks could even make use of this in custom TPL files.

 

The whole concept of this code is that any 'member only' fee label must contain a specific word or phrase, in my example this word is "Member".  Staff must be trained to do this - it is relatively simple to do so.

 

How it works:

1. Place this code in a block, selecting "full HTML" or "unfiltered" input type, and assign the block to an inconspicuous region in your theme

2. Show the block only on certain pages, such as: civicrm/event/register

3. Show the block only to anonymous users in the block visibility settings

 

That's it!  Fee levels containing the word "Member" will be hidden.

<script>
cj(document).ready(function() {
    cj("input[name=amount]").each(function() {
      var thisPrice = cj(this).attr('id');
      cj("label[for='"+thisPrice+"']:contains('Member')").hide();
      cj("label[for='"+thisPrice+"']:contains('Member')").prev("#"+thisPrice).hide();
    });
});
</script>

Ways you can customize and enhance this

1. Change the word "Member" to a phrase of your choosing

2. Hide only the radio button, not the label, to 'entice' people to join. Delete the first line with hide() at the end

3. Activate this code only on certain pages by placing the unique id of the page in the if() statement near the top. That would look like this:

<script>
cj(document).ready(function() {
// add the id numbers of the pages you want below
if ( 
  document.location.href.indexOf('id=1') > 0 ||
  document.location.href.indexOf('id=2') > 0 ) {	
    cj("input[name=amount]").each(function() {
      var thisPrice = cj(this).attr('id');
      cj("label[for='"+thisPrice+"']:contains('Member')").hide();
      cj("label[for='"+thisPrice+"']:contains('Member')").prev("#"+thisPrice).hide();
    });
  }
});
</script>

4. Show the member pricing not simply to authenticated users, but to only users who are memembers

  • Activate the CiviMember > Roles Sync script
  • Change the visibility settings of the first block to be seen by all, thus hiding member pricing for everyone
  • Make a second block with visibility settings only for your exclusive Member > Roles
  • Copy and paste the same code, but change hide() to show(), thus re-showing member prices only to members
  • Place this second block just below the first block
  • Stoob's blog
  • Log in or register to post comments

Comments

Good display trick, no security

Permalink Submitted by xavier on February 13, 2012 - 23:31

Hi,

 

That's a nice trick, but keep in mind that it wouldn't stop any anonymous visitor to "hack" and choose the members only anyway (eg. if you disable javascript).

 

If security is needed (probably not a big deal in your case), then you'd need to add hook on the server to double check that no non member has chosen a member price.

 

Thanks for sharing

X+

  • Log in or register to post comments

That's correct. 

Permalink Submitted by Stoob on February 14, 2012 - 09:47

That's correct.  Absolute security of 'members only' pricing isn't a concern in my application.  Non-members are aware that members get a discount, we just don't want non-members to be presented with an option for a discount and have them select it by mistake.  We will spot check any event participants for valid memberships.

  • Log in or register to post comments

Why?

Permalink Submitted by dharmatech on February 15, 2012 - 10:10

Where do the other solutions fall short that you needed to implement this in jQuery?

  • Log in or register to post comments

Links?

Permalink Submitted by Stoob on February 15, 2012 - 12:26

Would you mind posting links to the other solutions to which you are referring?

  • Log in or register to post comments

You probably have a more

Permalink Submitted by dharmatech on February 15, 2012 - 13:48

You probably have a more exhaustive list since you wrote:

There have been several hook() or Drupal module based solutions for "members only" pricing for events or for other 'discounts' related to memberships.

I'm only aware of the civievent discount module which provides discounts for events, price sets and membership. I was curious what the other solutions are, why they didn't work for you and what use case you were fulfilling in your approach.

  • Log in or register to post comments

Nope

Permalink Submitted by Stoob on February 15, 2012 - 23:23

That module plus one other random post I found via Google (link now lost to time-space) was all I have.  Sorry if you feel I didn't give your module a try, but when I saw Civi3.3 was the highly recommended version, I moved on.  Upgrading to 4.1 will be just around the corner, and I wanted a lightweight solution that could be used with 4.1, adapted to D7, and used with Wordpress in conjunction with Widget Logic plugin.   Security and the fuller features of your module aren't necessary in my cases.  Your module does sound cool though.  Thanks.

  • Log in or register to post comments

D7

Permalink Submitted by cognoscento on March 15, 2012 - 09:20

For me, it's easy D7 support... I have yet to find something I can use as a non-coder. All the options I've seen are for D6.

I'd use the code above, but I don't have the chops to convert the above code D7 compatible... maybe someone would perform that small act of kindness for me and others?

 

 

 

  • Log in or register to post comments

MIH for this

Permalink Submitted by lobo on March 15, 2012 - 10:53

There is an MIH to make modules CMS agnostic (so will include D7 and wordpress). Its quite close to being fulfilled:

http://civicrm.org/participate/mih#cmsagnostic

Help make it happen

lobo

Url: 

http://civicrm.org/
  • Log in or register to post comments

MIH module

Permalink Submitted by KarlaChrist on April 3, 2012 - 02:16

Very true while using wordpress platform MIH module will be better option even its good for Joomla.

Bayside lounge

  • Log in or register to post comments

Modified code for Drupal 6

Permalink Submitted by zkrebs on June 5, 2012 - 12:23

Modified code for Drupal 6 and CiviCRM 4.1.2. The above code did not work for some reason. Note, it only works right now with radio and checkbox fields.

 

Block 1 has visibility for anonymous users. It removes all pricing options with word 'Member' in them. In effect, anonymous people don't get member pricing.

 

<script>
cj(document).ready(function() {
       //Find all labels containing the text 'Member' that are descendants of the element with id 'priceset'
     cj("#priceset").find("label:contains('Member')").each(function() {
               //Get the value of this labels for attribute. 
               var id = cj(this).attr('for');
               //If it has a value, this is one we want to remove
               if (id) {
                       //Remove the previous element which we know is an input
                   cj(this).prev().remove();        
                   //Remove this element as well
                   cj(this).remove();
       }
       });
});
 
</script>
 
Block 2 has visibility for Members (Members Role, sycned to Drupal user from CiviCRM). It hides all options that don't have word "Member" present. This in effect shows only Member-pricing for Members. The opposite of Block 1.
 
<script>
 
cj(document).ready(function() {
       //Find all labels containing the text 'Member' that are descendants of the element with id 'priceset'
      cj("#priceset").find("label:not(:contains('Member'))").each(function() {
               //Get the value of this labels for attribute. 
               var id = cj(this).attr('for');
               //If it has a value, this is one we want to remove
               if (id) {
                       //Remove the previous element which we know is an input
                   cj(this).prev().remove();        
                   //Remove this element as well
                   cj(this).remove();
       }
       });
});
 
</script>
 
Also, for those new to CiviCRM and jQuery, cj is a renamed jQuery object so it does not conflict with Drupal's jQuery. 
 
This code was developed by Corey Sunwold, http://coreysunwold.com/

 

  • Log in or register to post comments

Modifeid for Drupal 7

Permalink Submitted by fabriko on January 4, 2013 - 02:24

Here's the code for the anonymous block modifided for Drupal 7. I added in a bit to remind users to login to get their member price

<script type="text/javascript">

(function($) {

$(document).ready(function() {

//This is our custom jQuery code

$("#priceset").find("label:contains('Members')").each(function(){

var id = $(this).attr('for');

if (id) {

$(this).prev().remove();

$(this).remove();

}

});

$("#priceset").prepend("<h3>If you are a member, log in for member prices</h3>");

//This is the end of our custom jQuery code

});

}) (jQuery);

</script>

  • Log in or register to post comments

CIVICRM


GROWING AND SUSTAINING RELATIONSHIPS

WHAT IS CIVICRM
  • Community
  • Case Studies
  • Experts
  • Contributors
  • Core Team
  • Licensing
  • Contact Us
WILL CIVICRM MEET YOUR NEEDS?
  • Contacts
  • Contributions
  • Communications
  • Peer-To-Peer Fundraisers
  • Advocacy Campaigns
  • Events
  • Members
  • Reports
  • Case Management
GET STARTED
  • Evaluate Your CRM Needs
  • Evaluate CiviCRM Features
  • Read Books
  • Documentation
  • Demo CiviCRM
  • Download CiviCRM
  • Download Extensions
  • Find An Expert
PARTICIPATE
  • Join the CiviCRM Community
  • Read Our Blog
  • Community Forum
  • Attend a Training or Meetup
  • Make It Happen
  • Become A CiviCRM Developer
  • Issue Tracker
  • Help with Documentation
  • Translate