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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Auto-check create new account box
Pages: [1]

Author Topic: Auto-check create new account box  (Read 3753 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Auto-check create new account box
November 06, 2008, 06:19:36 am
I'm using 2.0 and Drupal 5, and I have a profile form that I'm using as standalone code. In my profile I have the option to create an account. Is there any way I can have this box automatically checked and the username field expanded?

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: Auto-check create new account box
November 06, 2008, 06:53:48 am

you can modify the code and the javascript to

1. have the block expanded all the time

2. Use a hidden field and set the value of is_cms_user to 1. You should not display the is_cms_user checkbox if you do this

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

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Auto-check create new account box
November 06, 2008, 07:24:32 am
thanks, lobo. works great!

genkml

  • Guest
Re: Auto-check create new account box
November 09, 2008, 01:57:42 am
Hi Lobo, this is exactly what I need. It's not clear from your respond, where do I modify the code and the javascript for both of the points you mentioned, ie: which file and in which folder.

I am using Joomla 1.5.7 and CiviCRM 2.1

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: Auto-check create new account box
November 09, 2008, 08:19:14 am

check: http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

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

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Auto-check create new account box
November 10, 2008, 06:38:24 am
genkml

in my case, since i was using the standalone code, i just did the following (might not be the proper way to do this):

I edited the code and first looked for
Code: [Select]
if ( document.getElementsByName("cms_create_account")[0].checked ) {
     show('details');
  } else {
     hide('details');
  }
I just changed the "hide('details')" to also be "show('details')"

Then you need to find the input checkbox which the code will probably look like this:

Code: [Select]
<input onclick="return showHideByValue('cms_create_account', '', 'details','block','radio',false );" name="cms_create_account" type="checkbox" value="1" id="qf_2e525b" class="form-checkbox" />
and you need to make it hidden and checked by default, which you can do by changing the above to:

Code: [Select]
<input type="hidden" onclick="return showHideByValue('cms_create_account', '', 'details','block','radio',false );" name="cms_create_account" value="1" id="qf_4e7b2d" class="form-checkbox" checked />
then it should work.

danh

  • Guest
Re: Auto-check create new account box
December 10, 2008, 11:19:36 am
Any advice on how to do this (i.e. Auto-check the "new account" box), but for CiviContribute forms rather than for a standalone profile? 

We are using two profiles in our contribute form, and one of them has the "Drupal user account registration option?" box checked... but it is a bit different than the above solution when it was a stand-alone profile because, unlike with profiles, CiviContribute doesn't have a standalone-forms mechanism.  So I'm not sure how to ensure that that box stays checked.

Thanks!

Dan

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Auto-check create new account box
December 10, 2008, 04:18:58 pm
The included profile(s) in your CiviContribute page are rendered using the same template as a standalone - so for 2.1.x the customized tpl approach should work. Starting w/ 2.2 - you can force "create new account" for a profile as an option in the administrator interface:

http://issues.civicrm.org/jira/browse/CRM-3788
Protect your investment in CiviCRM by  becoming a Member!

danh

  • Guest
Re: Auto-check create new account box
December 10, 2008, 04:43:15 pm
Thanks, Dave.  We're only at version 2.0.6, though.   Should the customized tpl approach work there too?

Also, I'm having another related problem here.  Even though there is not a *forced* CMS user-creation option in 2.0, there *is* the optional user-creation, and I'm trying to get it to at least do that... but I'm not able to get even that working.  We have the create new CMS user checkbox on our two profiles that are included at the top and bottom of a civicontribute form... When I fill in the contribute form and check that box (yes, I want a user created for me), and even fill in a new Drupal username for it, it accepts my submission, says it was successful, creates my contact, but a Drupal user is never created.  Any idea how I can fix this?

Dan


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: Auto-check create new account box
December 10, 2008, 08:54:41 pm
Quote from: danh on December 10, 2008, 04:43:15 pm
Thanks, Dave.  We're only at version 2.0.6, though.   Should the customized tpl approach work there too?

yes

Quote from: danh on December 10, 2008, 04:43:15 pm
Also, I'm having another related problem here.  Even though there is not a *forced* CMS user-creation option in 2.0, there *is* the optional user-creation, and I'm trying to get it to at least do that... but I'm not able to get even that working.  We have the create new CMS user checkbox on our two profiles that are included at the top and bottom of a civicontribute form... When I fill in the contribute form and check that box (yes, I want a user created for me), and even fill in a new Drupal username for it, it accepts my submission, says it was successful, creates my contact, but a Drupal user is never created.  Any idea how I can fix this?

2.0 is no longer supported, but i'm pretty sure the above feature worked for quite a few people. Your best bet might be to debug the code at CRM/Core/BAO/CMSUser.php, function createDrupalUser

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

brotherhutch

  • Guest
Re: Auto-check create new account box
December 30, 2008, 10:07:33 pm
I have made some progress following the posts here -- thanks all -- but I'll need help hiding the checkbox and label (I managed to get the checkbox checked, the block expanded, and the "message help" hidden, but I still see "
  • Create an account?").  The code posted for hiding this information seems to be generated on execute, and I cannot edit it (because it isn't there) in the CMSUser.tpl, though of course I see it in the source for the page.  I am using Joomla and do not know much about code, so if someone could give me a file name and what code to add/change, I would be grateful.


Cheers all and happy new year! :D
 

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: Auto-check create new account box
December 31, 2008, 05:38:51 am

1. You can get rid of the javascript in the CMSUser.tpl page

2. You can delete the line:

Code: [Select]
    <div>{$form.cms_create_account.html} {$form.cms_create_account.label}</div>

and replace it with

Code: [Select]
<input type="hidden" name="cms_create_account" value="1">

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

brotherhutch

  • Guest
Re: Auto-check create new account box
December 31, 2008, 04:56:44 pm
Brilliant! Thanks lobo.  The support here is excellent as usual. cheers.   ;D

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Auto-check create new account box

This forum was archived on 2017-11-26.