Closed (fixed)
Project:
MySite
Version:
master
Component:
- Type plugin
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2007 at 18:40 UTC
Updated:
4 Sep 2007 at 09:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
agentrickardRight. It might be possible to let users create droplets, but there are security issues. Users would never be allowed to add their own JavaScript or PHP to their page. That's just asking for security trouble.
As for adding individual nodes, the new Comment plugin lets users track the comments attached to specific nodes.
Comment #2
B747 commentedWell for example what I want is for users to create an event (with event module), or a video (video cck), and then add that event or video to their page. Or to add events from certain users. (You can add nodes by certain authors, and nodes of certain types, but nodes by a certain author of a certain type. So users can't add their own videos, for instance.)
As for Droplets, I'd prefer users to create nodes and then for those nodes to be added. Would it be possible to only allow scripts from certain sources? (embed module?)
Thanks for your time.
Comment #3
agentrickardOn the first request, I think we need another plugin which would search for nodes by type and by author. That wouldn't be too hard. The system doesn't do that now because "static" personal content wasn't rally in the original design.
On the second, MySite uses the input filter system for both Droplets and content. That is, if you display a node that is "Full HTML," MySite will render that as expected. Access to filters is set by role under Admin > Input Formats.
So the second issues is really handled already. What you want is the first option. I think that is doable. Look at the new Comment plugin for an example of how to search all nodes. The real problem is the UI challenge of searching by user.
Would it be enough to be able to search for one's own nodes? That would be simple to implement.
Comment #4
B747 commentedOK - the answer to my problems is this: let the main site do the UI for finding and displaying nodes (views module). Then, for each node, have the following displaying in the MySite block (let's say user is looking at a poll created by God):
1. Add all polls to your MySite
2. Add all polls by God to your MySite
3. Add all of God's Content to your MySite
4. Add comments to this poll to your MySite
5. Add this poll to your MySite.
Then, when users are configuring their newly-added content, they should be able to choose whether it lists the content or displays full nodes / teasers.
Comment #5
agentrickardYup. That will require a new plugin, though you might be able to tack something on to mysite_type_node_block_node().
Comment #6
agentrickardNo, it has to be a plugin, because we have to tell the _options and _data hooks how to handle the content.
I would call this 'post.inc' and write it to accept NID as the $type_id.
Comment #7
agentrickardI'm incapable of complete answers today.
Items 1, 3, and 4 on your list are currently supports.
Items 2 & 5 require new and separate plugin handlers. I'd call them 'author' and 'post', respectively.
#2 is tricky and would require the use of the {mysite_content} table because you will effectively have a multi-key. $type = 'author' and $type_id = 'UID-nodetype'.
See http://therickards.com/api/function/mysite_get_myid/MySite for the logic and droplet.inc for an implementation.
Related: I was already thinking of writing a 'commenter' plugin that will track all comments by user.
Comment #8
B747 commentedThat looks all really comlicated to me.
Comment #9
agentrickardWell, the function is complicated because what you are trying to do -- search data across two variables instead of one -- is complicated. But the implementation is rather trivial.
Take a look at /contrib/refine.inc for example. The function
mysite_type_refine_blockcreates a new entry into {mysite_content} every time someone browses to a page with the path /taxonomy/term/x+y+z.Filing against HEAD. I'd like to see someone take a stab at writing this.
Comment #10
B747 commentedOK - but what about my other request, about just adding a static node?
Comment #11
agentrickardI'd like to see someone other than me write that. That one is very simple. Look at comment.inc for the structure.
Comment #12
B747 commentedWhat's wrong with the attached? It doesn't show up on the MySite admin configuration
Comment #13
agentrickardI haven't had a chance to test this. I think the "active" check is too complex for what you need.
For right now, change hook_active to:
/**
* Implements mysite_type_hook_active().
*/
function mysite_type_anode_active($type) {
return array($type => TRUE, 'message' => NULL)
}
Comment #14
agentrickardThe first problem is actually in mysite_type_anode(). Set
You had it as 'node'.
I'd like to revise this file and include it in the release. Please rename the file 'post' and change the functions accordingly. You also need to indent the file according to Drupal's coding standards.
Comment #15
agentrickardTry this version. Your code got us about 70% done. I cleaned it a little and did a quick test.
Still a few text string issues to resolve, but it should work.
Comment #16
B747 commentedSorry - doesn't work at all. Posts, when the MySite block is enabled, display 'Could not find title' error message, and there's no link on neither the block nor the content section of the MySite interface block for users.
Comment #17
agentrickardThat last entry was not helpful. It works fine on my test machine (see attached). Be sure you use the attachment from http://drupal.org/files/issues/post.txt, not your original.
The 'could not find title' error is coming from a separate source. In my test case, it comes from blog posts without an author.
Comment #18
agentrickardNote new issue: http://drupal.org/node/167364
Comment #19
B747 commentedOK - I've tracked down the 'Could not find title' error to two MySite options - blog posts and forum posts. Have disabled them for now. I've put the code you gave me in the contrib folder - is that right? - but still nothing shows up. No option to enable in the MySite admin page...
Comment #20
agentrickardNot the contrib folder. /plugins/types. The contrib folder is a distribution folder. See the README.
Comment #21
B747 commentedI've got it to work now. However, when you click on the title of the post when it's in MySite it goes to /node. Any way to make it go to the actual post?
Comment #22
agentrickardThat was an oversight. This code is still under testing. New version fixes that problem. There may be more, so please report them.
Comment #23
B747 commentedAnd some more questions if I may:
1. The 'could not find title error' seems to be caused by the forum and blog plugin, when the MySite block is displayed on pages other than a forum or a blog. There's two errors on pages which are neither, and one error on a page which is either. Any suggestions about how to go around fixing this?
2. Is it possible to have the user's MySite page come up when their username is clicked, instead of the profile? The profile would still exist, however.
3. For my earler query of adding posts by both username and type, would it be possible to clone and edit blog.inc for this? Or do blogs act in completely different ways?
Thanks for all your help.
Comment #24
agentrickardAnswers.
1) Tracking this bug here: http://drupal.org/node/167364. Think I fixed it but have not uploaded the new code.
2) I don't know. Probably, but I have been reluctant to tamper with that, since it is a core feature. There is a My Site tab on the profile page, currently.
3) Blog.inc is the perfect example for what you want, since it is by content type and by user. Clone it, change all the _blog_ function names and all the 'type' = 'blog' calls to use your new type.
I never saw the use-case for extending this to other node types, so I wrote the generic node.inc instead. While I would prefer to have a generic "add posts of type X by user Y" plugin, simply creating a new nodetype plugin will do. The weblinks.inc in the contrib folder is another example of this.
Comment #25
B747 commentedThanks for those. I want to add profile information (such as profile fields) to MySite via droplets in PHP. I know I have to include something like this:
but I don't know how or where. Could you help me out, please?
Comment #26
agentrickardWhy don't you just use the provided Profile plugin?
And no, I can't answer this one right now. Plus it complicates this issue (even more).
On Drupal.org, we try to keep threads to one issue at a time. In this case, either open a new Support request, or go post in the MySite group.
http://groups.drupal.org/mysite
Comment #27
agentrickardThe "post" plugin has been rolled into 5.x.2.7. It allows users to add individual posts to a MySite collection.
Comment #28
B747 commentedThanks for including our code! And thanks for the help...
Comment #29
(not verified) commented