In an effort to have a separate/second classified ad content type, specifically for "classified jobs," I used a copy of the current 7.x-3.1-beta1+1-dev and made the following changes to produce a new "classified jobs" module that can run side-by-side with "classified ads" module. I'm using D7.23.

I opened every file, searched and replaced:

"Classified" with "Jobs"
"classified" with "jobs"

I then changed any file name that had "classified" in it to "jobs."

In the .info files I changed:
package = Classified to package = Jobs
project = "ed_classified" to project = "ed_jobs"
...and then again anything with classified to jobs.

When installed alone (without ed_classified installed) it works fine. However, when they are both installed I get a couple warnings in the status report:

Warning: strcmp() expects parameter 1 to be string, array given in _system_sort_requirements() (line 2785 of /home/pcage0/public_html/site.com/modules/system/system.module).
Warning: strcmp() expects parameter 2 to be string, array given in _system_sort_requirements() (line 2785 of /home/pcage0/public_html/site.com/modules/system/system.module).
Warning: usort() [function.usort]: Array was modified by the user comparison function in system_status() (line 2320 of /home/pcage0/public_html/site.com/modules/system/system.admin.inc).

Line: 2785 is in bold:

/**
* Helper function to sort requirements.
*/
function _system_sort_requirements($a, $b) {
if (!isset($a['weight'])) {
if (!isset($b['weight'])) {
return strcmp($a['title'], $b['title']);
}
return -$b['weight'];
}
return isset($b['weight']) ? $a['weight'] - $b['weight'] : $a['weight'];
}
-----------------------------------------------------------------------------

Line: 2320 is in bold:

/**
* Menu callback: displays the site status report. Can also be used as a pure check.
*
* @param $check
* If true, only returns a boolean whether there are system status errors.
*/
function system_status($check = FALSE) {
// Load .install files
include_once DRUPAL_ROOT . '/includes/install.inc';
drupal_load_updates();

// Check run-time requirements and status information.
$requirements = module_invoke_all('requirements', 'runtime');
usort($requirements, '_system_sort_requirements');

if ($check) {
return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR;
}
------------------------------------------------------------------------------

I think I either missed a file or term with "classified" and "jobs", or I need to address other code that causes them to clash.

I don't know how to create patches. I'll upload the module in a couple minutes.

Thanks so much for any help.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

System Lord’s picture

FileSize
62.38 KB
System Lord’s picture

System Lord’s picture

Side note1: I found this in the ed_classified module/help/api.html (There is three "s" in classified: line:28)

in file classsified_notification.module.

I was missing the "custom display settings" in manage display, and the blue help box at the top until i corrected this. It did not get rid of my Warnings, though.

Side note2: In status report with the "ed_jobs" module installed alone I get a clean report for "Jobs Ads vocabulary" even though the "ed_classified" module has always reported that the terms were NOT set up in a tree hierarchy. Interesting?

"Jobs Ads vocabulary The terms in the Jobs Ads vocabulary are set up in a tree hierarchy."

System Lord’s picture

Did some research. See: node/933684

$requirements being defined twice. I'm not sure which, but assumed all of them since the module is a mirror copy of ed_classified. I removed lines 118-185 from /ed_jobs/jobs.install. I left this code in /ed_classified/classified.install. All errors are gone and both modules function perfectly (as of right now).

I should have it thoroughly tested by Friday, but I do declare that on this, the first day of 2014, a new module is born :)

I'll zip ed_jobs and upload it. Note: It also includes a change from a previous patch (I think it was a patch). It was added/patched at the end of the classified.module (now the jobs.module).

function jobs_menu_alter(&$items) {
$items['user/%user/jobs']['access callback'] = 'user_access';
$items['user/%user/jobs']['access arguments'] = array('create jobs content');
}

So, to recap I did all that I just wrote here plus...

I opened every file, searched and replaced:

"Classified" with "Jobs"
"classified" with "jobs"

I then changed any file name that had "classified" in it to "jobs."

In the .info files I changed:
package = Classified to package = Jobs
project = "ed_classified" to project = "ed_jobs"
...and then again anything with classified to jobs.

which produced "ed_jobs"

I recommend that once the $requirements part is worked out this module "ed_jobs" should be included in the "ed_classified" module giving folks the option to create a second content type.

Happy New Year!

System Lord’s picture

FileSize
60.83 KB
System Lord’s picture

FileSize
31.64 KB
System Lord’s picture

FileSize
12.71 KB

Whenever I'm working in the "ed_jobs" module and save changes I seem to always get the success reported twice. See "doublesave.phg".

Any idea which file in the module I need to focus on to troubleshoot?

System Lord’s picture

Delete comment

System Lord’s picture

FileSize
60.62 KB

Missed a couple "Classified" terms in two files. Went through all the files again to make sure. This is probably the cause of some instability I ran into.

System Lord’s picture

System Lord’s picture

I don't know anything about coding, but this seems strange to me. I'm viewing the code with edit-code in my cpanel. This code is a different color beginning in a unusual place.

This is the "ed_classified" module.

help/tokens.html

I'm trouble shooting a new clone "ed_bizads" and ran into this. I'm also going to have a new "ed_jobs" uploaded soon. The one loaded here still works, but I did find some clashing with the .info files. I renamed some text incorrectly.

System Lord’s picture

FileSize
61.82 KB
61.58 KB

Latest versions. Both seem to be working good.

fgm’s picture

Status: Active » Closed (won't fix)

This is not a strategy worth pursuing: better use the more general approach allowing any content type in #195494: Possible to use different content types?.