Am I right in thinking that users cannot add their own script or text to their page, and also they cannot add a specific node to their page? This would be fixed if users could add their own Droplets for other people to use - now that would be cool, but is it possible?

Comments

agentrickard’s picture

Right. 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.

B747’s picture

Well 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.

agentrickard’s picture

On 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.

B747’s picture

OK - 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.

agentrickard’s picture

Yup. That will require a new plugin, though you might be able to tack something on to mysite_type_node_block_node().

agentrickard’s picture

No, 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.

agentrickard’s picture

I'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.

B747’s picture

That looks all really comlicated to me.

agentrickard’s picture

Version: 5.x-2.5 » master

Well, 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_block creates 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.

B747’s picture

OK - but what about my other request, about just adding a static node?

agentrickard’s picture

I'd like to see someone other than me write that. That one is very simple. Look at comment.inc for the structure.

B747’s picture

StatusFileSize
new7.26 KB

What's wrong with the attached? It doesn't show up on the MySite admin configuration

agentrickard’s picture

I 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)
}

agentrickard’s picture

The first problem is actually in mysite_type_anode(). Set

'include' => 'anode',

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.

agentrickard’s picture

Component: Miscellaneous » - Type plugin
Status: Active » Needs review
StatusFileSize
new6.66 KB

Try 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.

B747’s picture

Sorry - 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.

agentrickard’s picture

StatusFileSize
new37.86 KB

That 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.

agentrickard’s picture

B747’s picture

OK - 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...

agentrickard’s picture

Not the contrib folder. /plugins/types. The contrib folder is a distribution folder. See the README.

B747’s picture

I'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?

agentrickard’s picture

StatusFileSize
new6.67 KB

That was an oversight. This code is still under testing. New version fixes that problem. There may be more, so please report them.

B747’s picture

And 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.

agentrickard’s picture

Answers.

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.

B747’s picture

Thanks 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:

return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields));

but I don't know how or where. Could you help me out, please?

agentrickard’s picture

Why 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

agentrickard’s picture

Status: Needs review » Fixed

The "post" plugin has been rolled into 5.x.2.7. It allows users to add individual posts to a MySite collection.

B747’s picture

Thanks for including our code! And thanks for the help...

Anonymous’s picture

Status: Fixed » Closed (fixed)