Not a easy task to explain my problem, but I'll give it a try...
I'm building feature-rich user profiles on my site using the node profile family-modules. Anyway, in order to make things clean I use my own "edit userprofile" page where users can change there profile information.
My current problem is that every time a user updates his/her profile, the node gets unpublished... because of the code I'm using (found on a tutorial):
<?php
global $user;
if (in_array('administrator',$user->roles)) {
// This line prints everything, including fields we haven't specified
print drupal_render($form);
} else {
// This prints just the fields that we've specified to keep it simple for regular users
print drupal_render($form['form_token']);
print drupal_render($form['form_id']);
print drupal_render($form['preview']);
print drupal_render($form['submit']);
print drupal_render($form['delete']);
}
?>
The node gets unpublished when the publishing option isn't printed I guess, since when I remove this part and replace it with just "print drupal_render($form);", it seems to work, but it prints a lot of information I don't want. Is there a way to just print the Publishing option, or is there another way I can fix this?
Thanks
Comments
hook_nodeapi
Hook_nodeapi has the capability to set/unset the workflow options. For "published," the name is actually "status." So your code (op='submit' or 'insert') would be
node->status = 1;. Fairly simple.Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Thanks for your reply, but
Thanks for your reply, but I'm new to Drupal and not really familiar with the use of the API yet, where do I have to put the code "node->status = 1;"?
hey NeoID! Have you already
hey NeoID!
Have you already found out how to solve this?
It may seem, I'm lazy and just want an out-of-the-box-solution, but thats not true. I've been reading a lot about hook_nodeapi, but just can't get it to work... any further help on how to call this would be very appreciated. Thanks a lot...
...sebi
An example
Here's an example from a module I wrote. I don't set it, but you should be able to get the idea.
This goes into a module.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
I don't know where to put that code either,
So can you be specific in where to put to codes in?