Isn't the machine-readable "type" field supposed to be locked? If the type is changed to "profile" or anything else, the text in the Bio tab disappears from the user profile and navigating to user/uid/bio or user/uid/profile just shows the regular user profile.

CommentFileSizeAuthor
#11 bio-lock-type-name-203331-11.patch1.24 KBwebchick
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jjeff’s picture

Yes, a great patch would add a hook_form_alter() to make the machine-readable name of the the currently selected bio node-type uneditable. The alter should also add or change the description of this field to explain why it is uneditable and link to the bio settings page where the admin can select a new node type as bio.

Christefano-oldaccount’s picture

I'm interested to know if altering the node type form is a better idea but it may be better to just change 'locked' => FALSE in bio.module to 'locked' => TRUE and then roll out an update in the bio.install file.

function bio_update_2() {
  $ret = array();
  db_query("UPDATE {node_type} SET locked = TRUE WHERE type = 'bio'");
return $ret;
}

This won't work in if the bio node type has been changed to something else, but I immediately got errors when trying that and imagine that anyone else would, too:

warning: array_keys() [function.array-keys]: The first argument should be an array in /Applications/MAMP/htdocs/d55/sites/all/modules/bio/bio_views.inc on line 39.
warning: array_keys() [function.array-keys]: The first argument should be an array in /Applications/MAMP/htdocs/d55/sites/all/modules/bio/bio_views.inc on line 109.
Christefano-oldaccount’s picture

Title: Can't view user bios after modifying the machine-readable node type from "bio" to something else » Can't view user bios after modifying the machine-readable node type from "bio" to something else when Views is installed

I forgot to mention that this bug only appears when Views is installed.

Christefano-oldaccount’s picture

Status: Active » Needs review

OK, bumping this up to get more eyes on it. Code is included above but a patch isn't attached because I'd prefer not to roll one just to change one line in the bio.module file.

Has anyone else had this problem or is it just me?

webchick’s picture

It's desired that the type is in fact /not/ locked. So I think something along the lines of jjeff's fix in #1 makes more sense.

webchick’s picture

Status: Needs review » Active
Christefano-oldaccount’s picture

Why is this desired behavior? I'm actually curious because I've had nothing but problems when I try renaming the machine-readable name. The error in bio_views.inc reported in #2 does appear to have been fixed, though. Thanks for all of your recent work, webchick!

This is the error received this morning with the latest Bio 5.x-1.2 when changing the name from bio to something else and then visiting the User biographies settings page:

warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/d56/sites/all/modules/bio/bio.module on line 369.
webchick’s picture

The lack of "locked" flag is what's desired behaviour. We want people to be able to blow away that content type altogether if they don't want it. If it's set to "locked" then the only way to get rid of it is to disable Bio module, even if you're using some other content type like "Super Profile" as the Bio content type.

The error, obviously, is not desired. ;) So we should use hook_for_alter to either disable the ability to edit the type name altogether (jjeff's suggestion) or else add another submit handler and do a variable_set() to change the bio_nodetype setting when the type name changes.

webchick’s picture

Priority: Normal » Critical

Also, bumping this to critical as a note to fix it before 1.3.

webchick’s picture

Huh. Interesting. Changing locked to TRUE does /not/ appear to block me from deleting the node type, despite what it's supposed to do. ;)

Ok cool. Let me whip up a patch.

webchick’s picture

Status: Active » Needs review
FileSize
1.24 KB

Here's the patch that does what you suggest.

I'm not sure though. It seems like if someone's already gone through and changed "Biography"/"bio" to "Profile"/"profile" manually that it's going to change it back on them suddenly, and then their themes, etc. will break. A hook_form_alter solution might be best after all.

Note that this is only a suspicion. I don't have time to actually test the patch atm.

gausarts’s picture

Version: 5.x-1.x-dev » 5.x-1.2

Got the same exact problem with 5.x-1.2 when I change machine-readable bio to profile. The worst thing is when a user edited his own bio, the profile page disappeared from his eyes upon submitting, but strangely still visible to admin role. A successfull message on updating displayed, no error logs, but the profile just disappeared. Any help would be appreciated. Thanks

webchick’s picture

Did the patch work?

gausarts’s picture

Have no idea how apply a patch. Perhaps I'd better wait for the stable release and try to stick with the bio unchanged. It's just useless to change it to other word anyway since the link always refers to the word bio. Thanks for the great module.