Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: http://api.drupal.org/api/drupal/includes%21form.inc/group/batch/7
Enter a descriptive title (above) relating to Batch operations, then describe the problem you have found:
* $node = node_load(array('uid' => $uid, 'type' => $type));
node_load() does not work this way any more!
Comments
Comment #1
jhodgdonHm, good point. I'm not sure it's a Novice issue to fix it, but maybe... I guess we'd need to do a query to find a node authored by the given user, of the given type, presumably via EntityFieldQuery?
The Drupal 8 version uses the entity_load_multiple_by_properties() function, but we don't have that in 7...
Comment #2
joachim CreditAttribution: joachim commented> I guess we'd need to do a query to find a node authored by the given user, of the given type, presumably via EntityFieldQuery?
Oh yeah you're right. I was just thinking it would be case of changing the params to node_load(), but I didn't properly read what the code was doing. I wonder if the example should be simplified instead?
Comment #3
jhodgdonThere's another error on the page too: the "finished" callback has one name in the $batch definition but the function name is something else (this is noted in one of the comments below).
The whole thing really ought to be documented with our new callbacks anywy... didn't we make an issue on that?
And... really I have no idea what that example function is supposed to illustrate. Can't we find a more realistic example?
Comment #4
joachim CreditAttribution: joachim commentedUntagging.
Comment #5
BerdirIf we change it to a better example, we should probably update 8.x too. I just updated at some point when I noticed this in 8.x with something that's technically correct, but it remains weird :)