Drupal6 - Display specific View from a specific user in page - drupal

I need a help displaying a specific View result in a page which the user created it.
story...
"User X has created a Page called My Store and UserX has products which was created in custom Content Item."
Now how do I show this UserX's products in his My Store page?
I have already made a view called User_Store_View, I added a Page Display and on Page Settings:Path, the value was "node/%".. now I guess my problem is on the Arguments?

The path should be something like my-store and it should have an argument of user id. Given your requirements I think setting the default behaviour for the argument being invalid or not being supplied to an empty result set would be the most sensible(I think the default is show all). That may be all you really need.
However, if your product is a type that you've created yourself you will need to do some behind the scenes wiring to expose all your fields to Views; it's almost always better to build a content type using CCK so it's already hooked up to Views. And D7 is a different beast in this regard, with fields part of core and whatnot, so I can't help you out there.

Related

ACF - Template Assignment Seems Permanent

I've been using the Advanced Custom Fields (ACF) plugin for quite a while now. It's absolutely awesome but I'm experiencing some behaviour that is not the norm.
I've noticed that if I change the page template that is assigned to a set of custom fields, the pages that ran off that template (no longer assigned to those fields) effectively holds onto those custom fields and thus renders correctly on the site.
E.g.
ACF Partner Fields are assigned to a Partners Template that has a number of pages running of it.
If I assign these fields to another template, all of the pages running of the Partners template, still render correctly.
I'm not sure I've ever experienced that before and it is causing issues with another plugin that is being integrated for translation.
Any ideas what might be happening?
All time and help is appreciated.
When you change the template, your only changing where those fields appear on the backend and what post type or location they write to in the database. The database table for those unassigned posts still contains the information form those ACF, they just won't be written to any longer.

Auto-associate page metadata?

Links require SDL Live Content login.
We can choose default schema (and a mandatory option) in folder properties. New components in these folders will have the schema selected with appropriate fields filled out.
We can choose default page template for structure group (SG) properties. New pages in these SG will have the page template selected.
Do we have a similar option for page metadata such that in a given SG, author gets both page template and predetermined page metadata (fields) for either:
page creation
page template selection
We can do this easily with Inline Editing (SiteEdit) and page prototypes. But how would you configure or implement this type of requirement with the Content Manager Explorer?
I'd say there are a number of ways to achieve this:
1) Using the UI 'Page Types' - If the page you are using as the page type this should keep that same metadata. *I've not tested this!!! maybe you could confirm?
2) GUI extension - When a page template is selected a page metadata is selected based on the page template.
3) Event system. I'm not sure how well this would work as it would likely have to be on the creation of the page (checking if a default template is used) or on save if a template is used and a metadata schema isn't selected... but then if there is mandatory metadata etc etc.
4) The page template. This will set the metadata (on publish or preview) - or warn a user that a specific metadata should be set for this given page template.
Hope this helps.
Thanks
John
Very interesting question and I can see the benefits of this functionality for Editors. I don't have the answer for you. But AFAIK, even event system might not be relevant here since there are no events fired when you start creating a page unless we save the page. GUI Extension a possibility?
When you create a new item, this takes place via the GetNewitem() method in the API (or GetNewObject() in old money). I always thought there should have been separate events system hooks for this activity than for that of modifying an existing item. I once suggested this on ideas.sdltridion.com with regard to Components, however someone referred me to the OnSchemaGetInstanceDataPost event hook, and the discussion was over.
So in the case of a new component, the schema is automatically queried, and via the hook, you can interfere with the default data. So far so good, but I still believe that it would be generically useful to be able to modify the default data of any item type when first created.

Drupal 7 Webform fills hidden field with current node title

I'm using a webform as a block on all the pages from a specific content type. The form is the same in all, but on the list of submissions I want to know which page the user was seeing. I thought a hidden field, and a default value of %title would do it, but it's not the case. I tried a bunch of other token values, and a lot of them do work, but none of them gives me an identifier of the current node.
I think the reason it's not working is because the node element of the webform tokens refers to the node of the webform itself, not the current node page. Why webform doesn't use the in-built token system I have no idea, seems like a missed opportunity.
Looking at the webform module I think the easiest way to get this done is to write a quick custom module defining a single table (two columns, nid and url) and then implement hook_webform_submission_insert() to save the current $_SERVER['REQUEST_URI'] for all webforms. You can then use hook_webform_submission_load() and hook_webform_submission_render_alter() respectively to re-attach the URL data to the submission and display it to the page.
You can find all of those hooks in the webform_hooks.php file included in the module, they're pretty well documented.

How to create a custom form in drupal

I need help on how to create a 'custom form' using the same fields provided by cck.
Drupal gives you the ability to add fields to 'nodes' and how to theme their output. But I would like to be able to post a data from my own form (that pops-up) and sends data to the drupal database using the same drupal cck.
How do I access the specific form inputs to add data to my content types ? because the default form is kind of 'ugly' and loads on different page(without ajax).
Help would be much appreciated
There are several routes you could go down.
The easier option is to use the Webforms module. While this gives you similar fields to cck, they are not exactly the same, and if you have a module that implements a specific cck field type, it won't be available to webforms.
The second choice is to write your own module using the forms api. This can mean a lot of learning, add it takes time to get up to speed, but ultimately you have total control over how your form will look and behave. The forms api doesn't give you exactly the same fields, but all the tools are there to create them. Sometimes you need to hack open a module to find out haw a specific field is implemented.
A third option would be to use cck itself. You could create a content type and add the field types you want on your form. You would them give users permission to create but not view or edit the content type. The form submissions would them be nodes on your website. This would make me slightly nervous, so make sure all your permissions are correct!
The second part of your question: you can use a theme file to override the appearance of most forms and make them pretty.
James

Drupal User Profile

One of my favourite sites at the moment is developmentseed.org. I really like what they do with there user profiles. How would you go about recreating it.
http://developmentseed.org/team seems to be a view of users/nodes
/team/eric-gundersen is a profile/node
"Posts by Eric Gundersen" block on the right of 2. seems to be a view. Is an argument being parsed to return content by Eric?
/blog/2009/oct/21/announcing-managing-news-pluggable-news-data-aggregator the user name links to the profile/node
Same link as above seems to be a block (teaser I guess).
Do you think there are using the defaults drupal module or a custom content type? How would you go about trying to implement something like this?
Thanks
Ryan
This seems to be a view of users with 3 fields: The avatar, the title of the user node (see 2) and the role name.
They're most likely using Content Profile.
In Views you can add an argument and specify that when no argument has been supplied (as is always the case for a block) a default value should be used. Among those default values you can select the user id from the current path. By adding a argument for the author of a node and specifying a default argument for it you can limit a node list to just the nodes created by that author.
I think this is built in functionality - the nice URL is probably an alias for user/123 created through PathAuto.
The block is probably a variant of 3 - the default argument is to take the id from the currently shown node instead and the teaser comes from the node linked to the user with the module described in 2.
So - to create something like that I would install Content Profile and then create some Views with arguments that has default values and with block displays. Does that help? :)
Of course, you can easily custom and theme the related User Profile page by including a user-profile.tpl.php file in your theme.

Resources