Line #450
$node = db_fetch_object(db_query("SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM ".$tbl_prefix."node n INNER JOIN drupal_shared.users u ON u.uid = n.uid INNER JOIN ".$tbl_prefix."node_revisions r ON r.vid = n.vid WHERE n.nid=%d", $item->sid));
The table drupal_shared.users shouldn't be hard coded like that. Not sure how you would code it as there are various ways for people to set up their database.
I for example have shared users table, so I have just changed it to main_users which works for me, but wouldn't work for most other people.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | multisite_search.zip | 6.71 KB | jamestombs |
Comments
Comment #1
earthday47Bumping to critical since obviously this won't work unless your system is set up this way.
This was a carry over from my custom implementation... whoops.
Comment #2
jamestombs commentedI guess the easiest way would be to allow the user to set a variable in the settings page, with sufficient documentation is should be fine.
By default you would leave it as {users} as the best way I have seen of running this module is to share the multisite_search tables from the main/controller site.
Comment #3
earthday47I've committed this to HEAD. Let me know once you get the latest -dev version that it's working alright.
Comment #4
jamestombs commentedWorks for me.
The only issue I can see, is if the multisite setup isn't sharing any tables, it will be looking up the wrong user as author for nodes from the other sites.
If you are using a shared users table this works perfectly.
On top of this, there are 2 minor issues that result from this bit of code, #816988: node_get_types() doesn't work as the node type doesn't exist and #816958: Minor formatting problem getting comments from external sites.
Comment #5
jamestombs commentedAttached is an updated file with all the changes I think needs to be done as well as improving spacing and whitespacing etc.
Comment #6
earthday47Thanks for this code, jamestamr! I've committed your code, plus some more spacing cleanup, to HEAD.
Issues fixed:
And addressed this issue, although still not complete: #817584: Improve code formatting to conform to standards
You are on top of this, thank you so much! Want to become a co-maintainer? :)
I think more thought is required about the users. Your suggestion to add a field is a good idea...
Since in a Multisite installation, the users may or may not be shared. If they aren't shared, do we want to expose the other site's users? I suppose so, since we're sharing the content. But the link would jump them to the other site... If they are shared I suppose it would just link to the master domain.
I'm tempted to just remove user information from the search results, but that would be too easy. :)
Comment #7
earthday47This had been previously discussed starting here: http://drupal.org/node/271712#comment-1000750
Comment #8
jamestombs commentedI would be happy to co-maintain although I have no knowledge of how to use CVS (and no account yet) or how to create patches (hence why I uploaded the whole module).
Comment #9
earthday47Updating title to be more accurate.
Believe it or not, I am actually working on this! I'm going to try writing a small function to return user data. I'm not going to include a link to their profile, because permissions are a whole nother issue.
If the function is providing limited benefit, I may just remove the user data altogether.
Comment #10
earthday47For now, I've removed any user information from the query. (We were only getting user->name anyway.)
I also removed the link to the user, since trying to determine cross-site permissions would be a major pain.
May come back in for a feature request.