We have something like 600 nodes that we are trying to get published, and don't need to moderate at this point. Since there's no way to do this, currently, I thought I would try using VBO's arbitrary PHP method. I'm not entirely sure I have the gist of the Workbench Moderation code, though. Using dpm($entity);, I was able to see some of the structure, but can't seem to affect any change. Here's what I'm trying, any ideas for something else I should try? Thanks!
$entity->workbench_moderation['current']->state = 'published';
$entity->workbench_moderation['current']->published = 1;
workbench_moderation_node_update($entity);
Comments
Comment #1
stevectorI greatly discourage using arbitrary PHP. It sounds like you don't need workbench moderation at all and could use the core publishing action.
Comment #2
mausolos commentedRight, I greatly discourage it too; yet the work needs to get done, and processing several hundred links by hand sucks. That's what we have computers for, no? The deal is, core doesn't know what "Draft" means, so sometimes it picks the right revision to publish, and sometimes it doesn't. It doesn't know to pick the latest revision necessarily, and results seem almost arbitrary.
In any case, I've been programming in PHP for many more years than I've been developing with Drupal, I test things out in a dev environment before applying them to staging or production environments, and I always do an sql-dump before I do anything potentially stupid. Let me worry about whether I think it's a good idea or not. If you know an answer to the question and can save me the time of reverse-engineering the whole system to find the answer for myself, please share. Otherwise, and I mean this with the greatest respect for your time and trouble, why bother posting?
Comment #3
mausolos commentedAnd, I should note, as far as I can tell, there are no Rules hooks I can leverage to accomplish this, either.
Comment #4
stevectorForgive the brevity of my last post. The latest 1.x version of Workbench Moderation does have Rules integration. I think that's what you're looking for. I suggested using the core publishing action and not moderation because your original post said you just needed to publish and not moderate. If you have "draft" versions of nodes then you do likely need moderation.
Also I did not mean to question your development practice or skill. To expand on my comment on arbitrary PHP, I mean that it is a better practice to build a core or Rules module action in a custom module rather than enabling the PHP module which allows PHP code to be entered in the browser.
Comment #5
mausolos commentedRight, I totally agree. I'll check out the latest dev and see if I can't wrangle it with that, thanks!
Yeah, I should have specified. These nodes all have revisions that we want (sometimes the first revision, but even that won't publish correctly), and they're all set to Draft because Workbench Moderation was enabled (and, obviously, core settings/Moderation settings were set to have new nodes save as Unpublished/Draft).
Currently, we have a high volume of initial content to wrangle, so we are using our staging server as content-management base, and just doing database dump/push to production in spurts. This means that Moderation is more or less irrelevant now, since the content gatekeepers are just throwing up content as quickly as they can from already-cleaned sources. I always turn PHP off when I send it up to production, but with our protected environment and small internal user base, I have no qualms running it on dev and staging to GetStuffDone.
Comment #6
damienmckenna