I'm using Drupal 6.9

I setup Content Profile. when I want to change things in the profile, I don't see a "save" button ???

really funny. pls help me.

CommentFileSizeAuthor
#29 show_save_button-366397-29.patch784 bytesfirebus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Status: Active » Postponed (maintainer needs more info)

Where exactly do you try to edit your profile?
Can you reproduce the problem on a clean install with just content profile?
If not, try enabling modules until the problem comes back. So identify the module causing the troubles.

Summitt Dweller’s picture

I just posted a new forum topic for this as I'm experiencing the very same problem.

Summitt Dweller’s picture

OK, I now have a new, clean 6.9 installation with only CCK and Content Profile having been added to the mix thus far. The CP form is working...the SAVE button is visible and appears to function properly.

So, if I understand correctly, fago's recommendation is to start adding modules back in to see if/when the SAVE button breaks again? I have a lot of modules activated (and formerly activated) in my broken configuration. Any suggestion which ones might cause this kind of problem?

Summitt Dweller’s picture

I have an assistant ready and waiting to input some user profile data for me so I find I'm having to move on this ASAP. Still don't have CP working in my target production environment but I'm also unable to break it in my test configuration.

In that test environment I have thus far enabled Profile (the basic Profile content type) as well as nearly all CCK options and a whole host of other modules. Still the test environment shows me a SAVE button and works without any apparent problems. I even tried enabling Profile, adding some Profile content then disabling that module...no problem.

I know PHP and have written some of my own code for custom blocks, etc... however, I don't have a clue where to look in the code to see what might cause the missing SAVE button in CP. Any guidance in that regard would be most welcome.

Thanks.

drupallogic’s picture

I solved it. The problem is when you don't allow direct submission and ask for a pre-look before submitting, save button disappears! so just alllow direct submission to users.

andreiashu’s picture

According to what drupallogic says this is not a bug.
@Summitt Dweller can you tell us if #5 solved this problem ?

drupallogic’s picture

no! this is certainly a bug and should be corrected.

vitamink’s picture

I have exactly the same problem... profile edit page has no save/submit button.
Drupal logic - i've tried to follow your solution but am having trouble, any chance you could be a bit more explicit?

"don't allow direct submission" - is this a permission i'm missing somewhere?

thanks in advance

drupallogic’s picture

yes users must be able to save instead of first previewing. if user needs to preview before submitting, then save button disappears.

jacobson’s picture

This is exactly the problem and does seem like a bug. FYI, even when the Save button is not visible, hitting enter does "save" the form and the data that's been input.

dsms’s picture

i got the same problem and I suggested to make a preview-button available to user-profiles too...

>> http://drupal.org/node/436848

but no maintainer answered!

pimok3000’s picture

Hi, I´m using the dev Version from today with v6.10 and can confirm this problem to appear, but the option to simply hit ENTER fails with my setup.

in user/1/edit i find these 3 input-types="submit" and the buttons show correctly:

<input type="submit" name="op" id="edit-submit" value="Save"  class="form-submit" />
<input type="submit" name="op" id="edit-delete" value="Delete"  class="form-submit" />
<input type="submit" name="op" id="edit-submit-1" value="Search"  class="form-submit" />

in user/1/profile/edit i find only these 2 input-type="submit" and the save/cancel buttons don´t show up:

<input type="submit" name="op" id="edit-submit-1" value="Search"  class="form-submit" />
<input type="submit" name="attach" id="edit-attach" value="Anfügen"  class="form-submit" />

So in user/1/profile/edit those two buttons are missing in the generated soucre code:

<input type="submit" name="op" id="edit-submit" value="Save"  class="form-submit" />
<input type="submit" name="op" id="edit-delete" value="Delete"  class="form-submit" />

What is a possible reason for this issue?

Summitt Dweller’s picture

Title: I don't see a save button ? » Follow-up: I don't see a save button ?

Sorry for not posting a reply much earlier...got caught up in other issues and had this one resolved so I didn't even notice the replies.

Problem is, I'm not exactly sure what steps enabled me to resolve this. 8^( Does one have to leave the core Profile module enabled in order to successfully run Content Profile? At one point I thought maybe that was the problem... I had core Profile working, disabled it, then installed Content Profile and it didn't work. Eventually I think I found that core Profile had to be enabled to make Content Profile fully functional. Unfortunately I can't even check the status of my site modules now because I've hit my hosts process memory limit and can't get the admin/modules screens to open anymore. Porting to a new host soon (fingers crossed) to get past this little headache.

TomSherlock’s picture

@Summit Dweller
@fago

I too have encountered the "no save button" phenomenon.

It seems that setting the profile form as a content profile for users causes the buttons to disappear.

  1. I First shut off most of the contrib modules (i know this is vague. I compile a list of active modules if requested).
  2. I also removed content_profile, deleted the directories and deleted any trace of the content_profile in the database.
  3. I downloaded a fresh copy of content_profile (6.x-1.0beta3).
  4. I installed content_profile.
  5. I edited the content type (content) profile.
  6. I renamed body to 'bio' and set a minimum of 100 words.
  7. I ensured that the check box for 'Use this content type as a content profile for users' was NOT checked.
  8. I created a profile.
  9. At the bottom of the form was the 'preview' button.
  10. After clicking on 'preview', i was presented with the preview and two buttons: 'save' and 'preview'.
  11. I was able to save the profile.
  12. I re-edited the content type profile.
  13. I set bio word minimum to 10.
  14. I checked the checkbox for 'Use this content type as a content profile for users' was NOT checked'.
  15. I returned to my profile to edit it.
  16. I could no longer see buttons at the bottom of the form.
skizzo’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev

I had no problem before with 6.x-1.0-beta3, but then I started experiencing the OP problem... not sure what caused it.
The problem persisted with 6.x-1.x-dev (using either the core Profile content type, or a brand new content type). As a workaround I disabled force preview in admin/content/node-settings, which unfortunately applies to ALL content types... I have not been able to identify another module as the cause of this problem.

intent’s picture

After a little investigation, I think I uncovered the problem and a potential solution.

It would appear that line 263 in content_profile.module forcefully eliminates the "Preview" button on any node identified as a content profile type. This makes sense because nodes that are acting as content profiles are not typical nodes and a preview of content profile edits is unnecessary.

Unfortunately, this prevents the display of any button at all when preview is set to be required, because no Save button will appear on the initial edit page.

What I did, and it seems to work for me though I haven't thoroughly tested yet, is to add the following line of code directly above line 263:

$form['buttons']['submit']['#access'] = TRUE;

This then forces the display of a Save button on content profile pages.

Again, so far this seems to have worked for me, but needs more testing. Also, I am far from a pro php programmer, so please take this suggestion with the appropriate grain of salt. Still, thought I should post in case it helps anyone.

pimok3000’s picture

@skizzo i can confirm that changing the preview to "optional" brings back the "save" button after doing the changes at admin/content/node-settings

TomSherlock’s picture

After creating a new website with Drupal and installing the bare minimum of contrib modules to get content profile installed, i have noticed that when i
activate the option 'Use this content type as a content profile for users', i am unable to see the 'preview' and 'delete' buttons. When i deactivate this option the buttons reappear. I have been able to reproduced this behavior consistently.

@intent
I haven't gotten to the point yet of proposing a solution, however i have noticed that in the function content_profile_form_alter the following:

 elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
    // Customize the redirect target and buttons of our own node forms.
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {
      $form['buttons']['preview']['#access'] = FALSE;
      $form['buttons']['delete']['#access'] = FALSE;
      $form['#redirect'] = arg(2) == 'profile' ? 'user/'. $form['#node']->uid : $_GET['q'];
    }

which may be the code you were referring to.

The only other code that explicitly refers to ['buttons']['preview'] is node.pages.inc in the node_form method.

intent’s picture

Yes Tom, the code in content_profile.module is the code to which I'm referring.

FWIW, upon adding the extra line I mentioned above, I have experienced no issues and everything is now working.

TomSherlock’s picture

That's good to know, intent. However, i'm trying to understand what's happening under the covers.

I'm debugging the code in Eclipse, using xdebug to set break points. Any suggestions as to where to set the breakpoints for content_profile?

My concern is that the module does not force the display of the 'save' button, because it is depending on core modules to do.
Adding your code could conceivably create unintended redundancies, notwithstanding your encountering no issues with your code.

I'm trying to locate the code that inserts and displays the buttons for '/node/add/profile', 'node/###/edit' and '/user/#/edit/profile'.

Suggestions are welcome.

Thanks.

fago’s picture

Title: Follow-up: I don't see a save button ? » No-Save button when direct submission of the node is disallowed
Category: support » bug

How can I disallow direct submission? To fix this, we need to display the preview button if the save button is already hidden.

TomSherlock’s picture

@fago,
it appears that you question is a response to my comment:
"My concern is that the module does not force the display of the 'save' button, because it is depending on core modules to do."

If so, i'm confused by your question. I'm trying to understand the logic and intent (no pun intended) behind the code in content_profile. I don't understand it enough to give it a fair critique. (Unfortunately, my confusion is compounded by the fact that i am becoming reacquainted with the eclipse IDE and am trying to understand xdebug)

When trying to view the profile (/user/#/edit/profile) of a user from the user account page i notice that i start in content_profile_page_edit() and end up in node.pages.inc.node_form() for the buttons save, preview and delete. Access for the save button is set to 'false', the preview button's access property isn't addressed and the code for the delete button is not executed.


// Add the buttons
  
  $form['buttons'] = array();
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])),
    '#value' => t('Save'),
    '#weight' => 5,
    '#submit' => array('node_form_submit'),
  );
  $form['buttons']['preview'] = array(
    '#type' => 'submit',
    '#value' => t('Preview'),
    '#weight' => 10,
    '#submit' => array('node_form_build_preview'),
  );
  if (!empty($node->nid) && node_access('delete', $node)) {
    $form['buttons']['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
      '#weight' => 15,
      '#submit' => array('node_form_delete_submit'),
    );
  }

In content_profile.content_profile_form_alter(), i took intent's suggestion (#16):

elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) {
  	
    // Customize the redirect target and buttons of our own node forms.
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') {

      // intent's suggestion,http://drupal.org/comment/reply/366397#comment-1621852,  tjs 2009 May 28
      $form['buttons']['submit']['#access'] = TRUE;  
      
      $form['buttons']['preview']['#access'] = FALSE;
      $form['buttons']['delete']['#access'] = FALSE;
      $form['#redirect'] = arg(2) == 'profile' ? 'user/'. $form['#node']->uid : $_GET['q'];
    }

What i see displayed on the resultant screen is the save button only. And yet content_profile's function content_profile_form_alter() is not invoked.
What am i missing here?

@fago, back to your comment: i'm not sure what you mean by disallow direct submission. Do you mean not to explicitly code for the save button in your module?

It's not clear to me why the save button is intended to be hidden (as node.pages.inc.node_form() appears to do). Drupal.org's comment page shows both the save and preview button.

Again, without understanding the logic and intent behind the code of profile_content, i would normally expect save and preview buttons for a node in edit mode that has yet to be saved (i.e. created). I would expect save and delete buttons for an existing node that is being edited. Perhaps even the preview button could be added as a third button?

TomSherlock’s picture

I don't understand the connection or lack of connection between
content_profile's content_profile_page_edit(),
node.pages.inc's node_form(), and
content_profile's content_profile_form_alter() with regards to the buttons.

Tracing the code, i can see that content profile's content_profile_page_edit() eventually dips into node.pages.inc's node_form(), which creates the save, preview and (conditionally) delete buttons.

I don't understand why the buttons do not show up on the page after being created. Is there some other code which shuts off the buttons? Or must all buttons have their access attribute turned on? Does the form's #redirect attribute influence the buttons?

As far as i can tell, writing something such as

$form[‘submit’]= array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#weight' => 10,
)

from content_profile_admin_settings() should be sufficient for the button to show.

I've also noticed that setting the preview button's #access attribute to TRUE in content_profile_form_alter will be changed to FALSE somewhere else in the code.

mhunt’s picture

I wanted to make a note here that you can change this here: admin/content/node-settings "Must users preview posts before submitting?" In my case the save button was removed on all node types, not just the content profile node type. This is the content access module setting that was causing this for me.

skizzo’s picture

Has anyone found a fix for this issue?
In order to bring back the Save button I set "Preview post" to Optional but now...

a) node/20620/edit?destination=user/32 : I see both Save and Preview buttons
b) user/32/edit/myprofile : I see the Save button only (no Preview button!)

note: URL a) is reached when entering node/add/myprofile (profile node may or may not exist already)

shunting’s picture

If you want to disallow direct submission, why not make sure the link to instantiate the content type doesn't appear on the menu, so the user can't get at it?

Or perhaps detect that the request to build the submission form came from the user profile page (the original) by the URL, and grey out the buttons with a note if the request comes from anywhere else?

#17 worked for me. I now have a Save button. This is a frustrating issue, especially since it crops up when you're all excited about saving your first profile...

gallamine’s picture

Any progress on this? I don't want to allow direct submission of nodes (I want to force a Preview), but that makes the "Save" button on Content Profiles disappear.

skizzo’s picture

Status: Postponed (maintainer needs more info) » Needs review

Changing status so that solution #16 can be taken into consideration for next official release.

firebus’s picture

Here's a patch that implements the suggestion in #16

my-family’s picture

subscribe