I would like to know the status of porting Modr8 to Drupal 7. Any plans on this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cpelham’s picture

Subscribe

geekgirlweb’s picture

I don't think there are any plans considering the module still hasn't been updated to fix issues in D6. I would look toward the new project Maestro which allows for an even more advanced way of queuing and reviewing unpublished nodes. If you are looking for a working D6 version of sometime similar try Workflow

danielm’s picture

subscribe

berenddeboer’s picture

Status: Active » Needs work
FileSize
40.93 KB

Hi guys, enjoy this initial Drupal 7 patch. It's a bit rough as I haven't tested everything. So I think blocks don't work. But the basics do work.

giorgio79’s picture

It seems Revision Moderation module wont be updated since Workbench Moderation can achieve the same:
#995876: Revision Moderation Drupal 7 port wonder if modr8 could join forces as well with Workbench module to focus efforts.

More info on Workbench Moderation
http://drupal.org/project/workbench_moderation

anavarre’s picture

Subscribe

pwolanin’s picture

Title: Drupal 7 » Drupal 7 update for modr8
podarok’s picture

Issue tags: +D7 porting

subscribe

TomSherlock’s picture

Hi, berenddeboer and subscribers.

Phunster and I had decided to start a Drupal 6 to Drupal 7 upgrade project. After reviewing some candidate modules, we decided to tackle modr8 first. The fact that berenddeboer had published a patch has given us a great start.

We do not have a patch yet to build on top of the patch from comment #4, however we would like to share what we have done so far and the direction we are considering.

First we installed modr8 in Drupal 7. We could not enable it until we had applied berenddeboer's patch (comment #4). Then we ran the patched module through Coder and found about 30 errors distributed among the *.module, *.inc, *.install files. Most errors were syntactical: a space was required between the concatenating period and a leading and/or following character. We corrected those errors.

Our first major error was a PDO error; the sql query was looking for the 'moderate' column in the {node} table. Of course that column is no longer there. So that become a decision point. Do we re-insert the column into the node table as suggested in http://drupal.org/node/564462, or do we add it to the modr8_log table or a new table?

For the moment we just added the column 'manually' to the node table to see what other type of errors we would encounter. We came across the Drupal-7-obsolete db_rewrite_sql. Its main purpose is to "add access control checks to SQL queries" (http://api.drupal.org/api/drupal/includes--database.inc/function/db_rewr...).

The suggested solution is to tag the db query for hook_query_alter:

$nids = db_select('node', 'n')
->fields('n', array('nid', 'created'))
->condition('type', 'blog')
->condition('status', 1)
->orderBy('created', 'DESC')
->range(0, variable_get('feed_default_items', 10))
->addTag('node_access')
->execute()
->fetchCol();

We are not yet sure how to set up a db query in the Drupal 7 fashion. Well have to review the database abstraction layer.

I wonder if we can just use db_query and not implement hook_query_alter as a first pass?

If thought useful, we could create a patch with what we've done so far.

pwolanin’s picture

In terms of the schema, there are 2 options:

1) separate table
2) hook_schema_alter on {node}

#2 actually makes for an easier upgrade from 6, and maybe easier load/save code, but might be considered a bit of a hack.

berenddeboer’s picture

@TomSherlock, you might have missed that I added a table in my patch, so you should have used that. Don't hack the core node table, that's bad practise.

phunster’s picture

@berenddeboer et al, We did notice it after posting the progress report. And we're thinking that the block is still looking at the node table, thus that would be a fairly simple fix. BTW, thanks for the original patch it's awesome.

TomSherlock’s picture

@berenddeboer, thanks for pointing out that the table was added in the patch. As phunster mentioned we didn't notice it until after publishing our progress report.

What we were looking previously was db queries such as:


'SELECT n.nid, n.title FROM {node} n WHERE ' . $is_published . ' n.moderate = 1 ORDER BY n.changed DESC'

It only points to the {node} table. I agree, btw, that the {node} table should not have the column reinserted.

I found the following two lines (446, 447) in your patch and was wondering if they were intentional?

-  $event->author = db_fetch_object(db_query("SELECT u.name, u.uid from {users} u WHERE u.uid = :u.uid",
 array(':u.uid' => $event->author_uid)));
+  $event->author = db_fetch_object(db_query("SELECT u.name, u.uid from {users} u WHERE u.uid = :u.uid",
 array(':u.uid' => : u . uid, '' => array(':u.uid' => $event->author_uid))));

Did you want a double array?

TomSherlock’s picture

I'm working on rewriting modr8_db_rewrite_sql as modr8_query_alter per Drupal 7 uses a query-tagging system and db_rewrite_sql() replaced with hook_query_alter().

So here is modr8_db_rewrite_sql:

function modr8_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
  $node_table = $primary_table;
  switch ($primary_field) {
    case 'nid':
      // this query deals with node objects
      $access = (user_access('administer nodes') || user_access('moderate content'));
      if (!$access && $query) {
        global $user;
        $return = array();
        if ($primary_table != 'n') {
          $return['join'] = "LEFT JOIN {node} modr_n ON $primary_table.nid = modr_n.nid";
          $node_table = 'modr_n';
        }
        if ($user->uid == 0) {
          $return['where'] = "($node_table.moderate != 1)";
        }
        else {//lt-tjs 2011June02 Coder:  Line 278: String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
          $return['where'] = "($node_table.moderate != 1 OR $node_table.uid = " . (int)$user->uid . ")";
        }
        return $return;
      }
      break;

  }
}

It is not clear in modr8_query_alter how to determine what the primary field and table are. I'm wondering if a different approach should be taken. I have the function signature as such:

function modr8_query_alter(SelectQueryInterface $query)

since SelectQueryInterface extends QueryAlterableInterface as well as allows me to inspect the query object for fields and tables with public functions. However the object does not seem to prioritize tables and fields such that I can determine which are the primaries. Again, not sure if this is the correct approach.

I have additional questions on the above code. Will post them later.

berenddeboer’s picture

Looks like a copy/paste or replace mistake.

chx’s picture

Stay tuned, I will help with this in a week. If I forget to get back to you ping me on June 30th or later.

BeaPower’s picture

any updates?

chx’s picture

No, sorry client dropped D7 port :/

Starminder’s picture

+1

berenddeboer’s picture

Sorry, I don't get this. We have a perfectly acceptable Drupal 7 port, why is this being held up? Why don't the "maintainers" accept new maintainers of they are too busy?

I suggest people fork this project, clearly the maintainers have no time to maintain it and are not willing to give up control.

WorldFallz’s picture

There's no reason to fork it. There's a process for handling abandoned projects: http://drupal.org/node/251466. All it requires is someone wanting to take over.

Liliplanet’s picture

subscribe thx!

Have found Modr8 most valuable plus the interaction with Userpoints interaction has been ported. Would most appreciate a D7 release :)

GlobalRaj’s picture

Is any one working on a release for D7? It would be so nice to have that. Come on experts!!!

mathankumarc’s picture

subscribe!

mathankumarc’s picture

Hi berenddeboer,

Thanks for the patch. It works great, However I'm unable to view the log of all actions on moderated contents. It throwing the following error

Fatal error: Call to undefined function tablesort_sql() in /var/www/fyn_1.0/sites/all/modules/custom_modules/modr8/modr8_admin.inc on line 666

I think we need to rewrite the query to achieve the table sorting. How to Fix this issue.

Thanks in advance.

mathankumarc’s picture

Hi berenddeboer,

I found two issues in your patch,

1. pager is missing in moderated content page
2. unable to view the log of all actions on moderated contents, because of tablesort errors

I have fixed these issues and testing it. Will provide the patch as soon as possible.

Liliplanet’s picture

Hi mathankumarc,

Would you be so kind to offer us your patch, would love a working version of Modr8 for Drupal7 ..

Most appreciated :)

mathankumarc’s picture

@liliplanet
Sorry for this late reply. I'm doing some cleanup on it according to the drupal coding standards, will submit the patch by nextweek.

Liliplanet’s picture

@mathankumarc,

that is wonderful .. thank you!

mathankumarc’s picture

FileSize
49.08 KB

Hi guys,

Sorry for this late reply.

Finally here is the complete patch(didnt looked into mail notification and cron job). Its includes berenddeboer's patch also. So apply this patch directly to the D6 version of this module.

@berenddeboer thanks for providing the initial patch. If it has any issues let me know, will try to fix them.

mathankumarc’s picture

FileSize
48.24 KB

Here is the complete port to D7.

Liliplanet’s picture

That is fabulous mathanhumarc, any chance you can release the module package please?

mathankumarc’s picture

@lilliplanet I think the owner is busy with other things, so I already raised a issue asking module maintainer role. http://drupal.org/node/1413848

d.novikov’s picture

http://drupal.org/node/964012#comment-5503928 patch doesn't cleanly apply to modr8.info

d.novikov’s picture

Also, a notice appear on this page admin/reports/modr8

Notice: Undefined variable: rows in modr8_log_overview() (line 715 of [...]sites\all\modules\contrib\modr8\modr8_admin.inc).

mathankumarc’s picture

Missed this one in the patch, will update the patch.

wxman’s picture

Any chance you can post a downloadable file? I can never get patches to work either on Windows or the web server. I can usually do it manually, but this one is a bit complicated for that.
Thanks.

cigotete’s picture

FileSize
39.22 KB

I have converted the patch to a module (I have attached the module if is useful) patch -p1 -i modr8_0.patch. seems that was installed fine, but I am not sure if is working properly or not, because I can not see (user id 1) any content in the queue of moderation (also was disabled the Publish option in content type, and was disabled permissions for publish content). will be useful any direction. I have installed the following modules:

  • View Unpublished
  • Publish Content
  • Override node options
  • Field Permissions
  • Content Access
wxman’s picture

Thank you for the downloadable copy.
I gave it a try as a test user on my local test site, and it seemed to work fine. As admin, the post shows in the moderated content list, and it says pending moderation on the node itself.
The only problem I see is the content is still being published before being approved in moderation. Even looking at it as an anonymous user I could still open it. Thanks again for the help.

mathankumarc’s picture

We cant do everything in a port. I think the project is abandoned.

Please dont rely on this port for production sites.

geekgirlweb’s picture

I think you should look at alternatives such as:
http://drupal.org/project/workflow
http://drupal.org/project/maestro

They have stable D7 releases and are being currently maintained.

mathankumarc’s picture

Status: Needs work » Fixed

@all the lovers of modr8
I'm the new maintainer for modr8 module.

Added new branch for 7.x. dev release will be available soon for downloading.

Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -D7 porting

Automatically closed -- issue fixed for 2 weeks with no activity.