Workbench Moderation Profile is an extension of Workbench Moderation. It adds the ability to have multiple workflows, divided into profiles, based on the states and transitions defined by Workbench Moderation. These workflow profiles can then be applied to nodes based on criteria you determine, and an API is included to help with that process.

It comes with two submodules, Workbench Moderation Profile Node and Workbench Moderation Profile OG, which allow you to define profiles of transitions by content type and Organic Group, respectively.

Link to project page: https://drupal.org/sandbox/srjosh/2172925
Link to repository: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/srjosh/2172925.git

It is probably worth noting that I am a committer on the http://drupal.org/projects/workbench_moderation module.

Comments

srjosh’s picture

Issue summary: View changes
shantanu1’s picture

Hi srjosh,

Here are some quick issues to get started:

  1. README.txt or README.md is missing
  2. All functions defined by your module must be prefixed with your module's name to avoid name collisions with others.

Also, please take a look at the automated code review results here:
http://pareview.sh/pareview/httpgitdrupalorgsandboxsrjosh2172925git

Thanks
Shantanu

shantanu1’s picture

Status: Needs review » Needs work
srjosh’s picture

Status: Needs work » Needs review
dsnopek’s picture

Status: Needs review » Needs work

Overall, the module looks great! I just have some nit picky stuff:

  1. This module entity-ifies the data on the workbench_moderation_transitions table which comes from Workbench Moderation. I think it'd be best to submit a patch to that project which does this, since that table is its responsibility. It probably won't be accepted right away, so I think it's fine to leave the code you have for this in your project for now.
  2. There are class declarations directly in the .module file. It's best practice to put all class and interface declarations in an include file and then add a a line like files[] = workbench_moderation_profile.entity.inc to the .info file. After clearing your cache, this will add your classes/interfaces to the code registry so the files will only be loaded (by the PHP autoloader) when they are used. Of course, those classes are really short so this doesn't provide much value in this case, but it is a best practice! You can learn more about the code registry here: https://drupal.org/node/350780
  3. Most of the stuff that's in files[] currently is unnecessary! You only need to specify files which contain classes or interfaces for the code registry to do autoloading. See the link I gave in the previous point for the full info. And .module files never need to be specified because they are always loaded.
  4. The WorkbenchModerationProfileUIController class is defined in workbench_moderation_profile.admin.inc, which is mostly fine (espectially since it's listed in files[] in the .info file!) - but if you move the other classes to a workbench_moderation_profile.entity.inc file per the previous point, you should put that one there too for consistency.
  5. The Doxygen comments for form constructors, submit and validate callbacks doesn't match the documentation standards here: https://drupal.org/coding-standards/docs#forms - for example, in workbench_moderation_profile.admin.inc it's got:
    /**
     * Administrative page callback for profile weighting.
     */
    function workbench_moderation_profile_weights($form, &$form_state) {
    

    ... where as it should be:

    /**
     * Form constructor for the for profile weight form.
     *
     * @see workbench_moderation_profile_weights_submit()
     *
     * @ingroup forms
     */
    function workbench_moderation_profile_weights($form, &$form_state) {
    

    You can pretty much copy and modify the examples from the docs that I linked above. As an aside about that particular function: it's convention (although totally not required) to name form constructors as *_form().

  6. In a number of places the Doxygen comments start with /* instead of /** (two stars). In order to get properly parsed by the API module, those comments need to have two stars. Some examples of functions with only one star include: workbench_moderation_profile_workbench_moderation_states_next_alter(), _workbench_moderation_profile_weighted_modules(), workbench_moderation_profile_form_workbench_moderation_admin_transitions_form_alter, and several more.

That's all I have for now! However, I don't think there is much after that stuff...

srjosh’s picture

Thanks dsnopek!

Numbers 3 and 6 should have been addressed already with the latest round of changes. I'll look into the other ones ASAP.

srjosh’s picture

dsnopek - all concerns are resolved.

#1 - see https://drupal.org/node/2174343 for feature request.

Thanks for the feedback!

dsnopek’s picture

Status: Needs work » Reviewed & tested by the community

The patch at #2174343: Make transitions into entities, for use with entity reference fields looks awesome!

All my nitpicks are addressed. I probably should have mentioned originally that I also tested the module and it works as described.

I can't find anything else that this application needs to get approved - marking as RTBC.

Excellent work! :-)

srjosh’s picture

As a side note, I've pushed up the branch of workbench_moderation_profile that has the entity code removed, in case #2174343: Make transitions into entities, for use with entity reference fields is accepted, or in case someone wants to use that patch.

git clone --branch 7.x-1.x-no-transition-entity http://git.drupal.org/sandbox/srjosh/2172925.git

dsnopek’s picture

Status: Reviewed & tested by the community » Needs work

I just noticed something that I didn't catch on my first couple passes through.

On line 380 in workbench_moderation_profile.module, there is:

$wmp_states[$wmpid] = &drupal_static(__FUNCTION__);

What you probably actually mean is:

$wmp_states =& drupal_static(__FUNCTION__, array());

drupal_static() always returns the same reference for the same argument (in this case __FUNCTION__ or "workbench_moderation_profile_get_states"). So, with the current code it's making every entry in $wmp_states a reference to the same value, which would probably lead to errors if you called workbench_moderation_profile_get_states() twice with two different profiles in the same request.

Also, minor coding style issues have snuck in since you last fixed them from PAReview.sh:

http://pareview.sh/pareview/httpgitdrupalorgsandboxsrjosh2172925git

srjosh’s picture

Status: Needs work » Needs review

All issues have been addressed as of commit #88f0221. Thanks dsnopek!

dsnopek’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

srjosh’s picture

Assigned: srjosh » Unassigned
mpotter’s picture

Minor issue: in the admin/structure menu it shows as "Workbench Moderation Profile settings" and should just be called "Workbench Moderation Profiles"

srjosh’s picture

Fixed in commit a9fda10.

Thanks @mpotter!

pingwin4eg’s picture

Status: Reviewed & tested by the community » Needs work

Hello @srjosh

There are still some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxsrjosh2172925git-7x-1x

Though below is the only release blocker, you should also take care of other coding style issues.

FILE: .../drupal-7-pareview/pareview_temp/workbench_moderation_profile.admin.inc
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------
 162 | WARNING | Messages are user facing text and must run through t() for
     |         | translation
-------------------------------------------------------------------------------

Please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)

srjosh’s picture

Issue summary: View changes
srjosh’s picture

Status: Needs work » Needs review

All changes have been noted and dealt with.

ultimateboy’s picture

Status: Needs review » Reviewed & tested by the community

All issues that have been brought up have been promptly resolved by srjosh.

hefox’s picture

I'm a comaintainer, so made it a full project as a comaintainer, not sure what else should be done here -- e.g. giving srjosh ability to create more full projects?

stborchert’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, Joshua!

I updated your account so you can create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

jackshot’s picture

Hi Srjosh

When I edit profile encounter system warning as below, I can't save continue, could you help check? thanks in advance.

Notice: Undefined property: stdClass::$id in workbench_moderation_profile_form_alter() (line 573 of C:\Bitnami\openatrium-2.23-0\apps\openatrium\htdocs\sites\all\modules\workbench_moderation_profile\workbench_moderation_profile.module).
Notice: Undefined property: stdClass::$name in workbench_moderation_profile_form_alter() (line 573 of C:\Bitnami\openatrium-2.23-0\apps\openatrium\htdocs\sites\all\modules\workbench_moderation_profile\workbench_moderation_profile.module).
Notice: Undefined property: stdClass::$id in workbench_moderation_profile_form_alter() (line 573 of C:\Bitnami\openatrium-2.23-0\apps\openatrium\htdocs\sites\all\modules\workbench_moderation_profile\workbench_moderation_profile.module).
Notice: Undefined property: stdClass::$name in workbench_moderation_profile_form_alter() (line 573 of C:\Bitnami\openatrium-2.23-0\apps\openatrium\htdocs\sites\all\modules\workbench_moderation_profile\workbench_moderation_profile.module).
Notice: Undefined property: stdClass::$id in workbench_moderation_profile_form_alter() (line 573 of C:\Bitnami\openatrium-2.23-0\apps\openatrium\htdocs\sites\all\modules\workbench_moderation_profile\workbench_moderation_profile.module).
Notice: Undefined property: stdClass::$name in workbench_moderation_profile_form_alter() (line 573 of C:\Bitnami\openatrium-2.23-0\apps\openatrium\htdocs\sites\all\modules\workbench_moderation_profile\workbench_moderation_profile.module).
Transitions field is required.

srjosh’s picture

Status: Fixed » Closed (fixed)

Jackshot - as I noted in email, please use the issue queue for the module to report issues. https://www.drupal.org/project/issues/workbench_moderation_profile