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 Profiles (Moderator: Dave Greenberg) »
  • Profile HTML snippet not hiding Drupal registration field for logged in users
Pages: [1]

Author Topic: Profile HTML snippet not hiding Drupal registration field for logged in users  (Read 1729 times)

herb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 2
Profile HTML snippet not hiding Drupal registration field for logged in users
May 20, 2010, 12:33:35 pm
Using Civi 3.1.4 and Drupal 6.15 on a local dev server.

I created a profile with Drupal user account registration required and a few custom fields. I copy and pasted the HTML snippet into a Drupal node (because there is no way to move the Drupal registration to the bottom of the form AFAIK). The purpose is to collect information and create a Drupal account if the user is anonymous.

The problem is that the Drupal registration is still visible, blank and required even when I view it as Drupal administrator (uid = 1). This field is hidden when I access the profile directly (e.g. /civicrm/profile/create?gid=8&reset=1) so I know the logic is there to check for logged in users, but this logic isn't kicking in for the HTML snippet.

I couldn't find any info about this, so I'm wondering if this is a known bug / feature, etc.

I was able to do a quick fix by wrapping the Drupal registration field in some PHP: if (!$user->uid) { } and then setting the node's input format to PHP. This probably won't work in every situation and I can't think of an alternative fix right now.
Web Developer
Freeform Solutions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Profile HTML snippet not hiding Drupal registration field for logged in users
May 20, 2010, 02:20:50 pm
Quote from: herb@freeform on May 20, 2010, 12:33:35 pm
I copy and pasted the HTML snippet into a Drupal node (because there is no way to move the Drupal registration to the bottom of the form AFAIK).

You tried http://api.drupal.org/api/function/hook_form_alter ?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

herb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 2
Re: Profile HTML snippet not hiding Drupal registration field for logged in users
May 20, 2010, 02:29:11 pm
I'm talking about a CiviCRM profile with a Drupal user account registration (from the CiviCRM advanced settings) and then copied the HTML Form Snippet into a node, so hook_form_alter won't work.
Web Developer
Freeform Solutions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Profile HTML snippet not hiding Drupal registration field for logged in users
May 20, 2010, 02:31:29 pm
You wrote:

> no way to move the Drupal registration to the bottom of the form

I was suggesting to use that hook in order to change the order of the elements in that form. That would certainly be recommended, if possible, over copying and pasting HTML.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

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: Profile HTML snippet not hiding Drupal registration field for logged in users
May 20, 2010, 02:39:08 pm

note that PHP != HTML

an html snippet is not generated dynamically when copied into a node. hence it cannot distinguish between anon user / logged in user etc


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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Profile HTML snippet not hiding Drupal registration field for logged in users

This forum was archived on 2017-11-26.