Drupal 7 displaying different user content - drupal-7

I have searched and searched and cannot find a solution to my specific problem...
I have a site that users join, and can upload their own videos. I crated a specific video type to handle this upload.
Other users can log in and see this content, they get to the content by clicking on a "profile" link for a specific user, and then it should display all the videos that user uploaded. Currently all I can get to work is display ALL of that content type, or none... I cannot figure out how to just get the user being looked for.
In my URL i have the user name being sent, because other info on the profile page that loads is driven off of that ( looked up in mysql tables and displayed with PHP).
As I mentioned I have a filter that limits to playervideo ( which is my content type) and that works, but as mentioned it displays all not just the user I am looking for.
any help would be much appreciated!!
thanks

I think your question is "How do I make a page for all users that lists content authored by a specific user"
I'd do this with the Views module.
Add a view for all your nodes.
Then add a "relationship" for "Content: Author".
Now add a "contextual filter" for the field "user: uid" with a default argument the userid from the URL.
Or you could try to add a contextual filter of "Content: User posted or commented" with the default value as the UID from the URL.
Cheers!

Related

DotNetNuke Switching Between Multple Edit Modules

I have a custom module in DNN 7 that has a data structure where items belong to categories (called "sections", not DNN taxonomy, just a simple list of section names). The module edit screens work so that on the view control you may click on an edit link on each category, which loads the category edit screen (passing the category id). This works great, and when you save I use Globals.NavigateURL() to return to the view screen. This all works as intended.
On each category edit screen I also have a list of the items within that category, each with an edit link. Clicking the edit link opens the item edit screen, passing the correct item id, and allowing me to edit that item. This all works great, until you save. The save works properly, but when I want to send the user back to the edit screen for the category it doesn't work. When I use:
Response.Redirect(EditUrl("SectionId", sectionid.ToString(), "EditSections"), true);
...nothing happens. It simply doesn't redirect anywhere. This is exactly the same URL I'm using to get to the category edit page in the first place:
EditUrl("SectionId", Eval("SectionId").ToString(), "EditSections")
And then I use a similar URL to get to the item edit page:
EditUrl("ItemId", Eval("ItemId").ToString(), "EditItems")
I don't understand why using the same URL to navigate to the same page I already navigated to would simply not do anything. For now I am sending them all the way back to the view, but it's painful if you need to add several items to the same category to have to navigate back into the category and add another item, only to be sent back to the view.
Anyone see anything like this before?
Have you tried to use the overload of NavigateUrl instead of EditUrl?
Globals.NavigateURL(TabId, "EditSections", "mid", ModuleId.ToString(), "SectionId", Eval("SectionId").ToString())
I haven't seen that myself but I would have to assume that somehow the context is being lost with EditURL and you're not getting sent to the proper location due to that.
I would suggest you try one of two things (or both).
Debug the URL that EditURL is returning and see if you can find the
difference.
Use NavigateURL for all your links and pass in MID=## for your
moduleid as a querystring parameter, to ensure that the proper
values are being passed.
UPDATE: If you're trying to have multiple edit views, and move between them, you might look at using a "loader" instead of having separate module definitions for the edit controls. Basically have a single Edit.ascx file defined, and it loads other ASCX files within it, injecting into a Panel. The View control on this module http://dnnsimplearticle.codeplex.com/ does that, but I haven't tried it with an edit control before.

Show related users on user page

On the user page (/user/20 for example) I want to display a view with some related users. Each user has a field of type entity reference that points to a user. The users are related if they point to the same user.
I tried to do this using the Entity Views Attach module, but didn't succeed (although I think it should be possible using it).
Could someone give me some advice on how I could do this?
I would create an block (or eva) view using contextual filters with your reference field that takes the uid from the url (or node's author) as parent.
maybe this other post can help
PR

Website "you can do this" script

I want to create a training path for new users accessing my site. This training path must display info bubbles showing what you can do on every page, but only the first time you access it.
So, for example, if a user enters a page where there's an edit button an info box should appear next to the edit button telling the user that he can edit that page.
I will create the script myself, I just want to know what's the best method to check if the user has already seen that box or not. I was thinking about storing in database a boolean value for each info box which will be set to true if the user has seen the box. To save some queries from the DB I think I can also store the same values in localStorage or in Cookies.
What is the best practice for creating user training paths for a website?
The way I suggest is to store user id (ip or username ? ) and a bit value for each bubble like you say.
PS: for your script you can use this:
http://www.maxvergelli.com/jquery-bubble-popup/documentation/
Jérôme

upload files to specific user

I want to let admin upload files (PDF files) to a separate user (client), such as bill, information and documentation.
I think to Add new content type with some fields, like file field, but I don't know how to add users list, so admin can choose file to upload and corresponding user.
After I finish this step, how can I display these files to user when login?
To reference the user, you could install the entity reference module.
http://drupal.org/project/entityreference
You can use that to add a field that will reference users.
As far as listing files for the user, you can use Views to make a list of your new content type, and filter it by the user who is logged in.
To elaborate more, Install the Views module, and make a new View, with a content-type filter for your new type, and a contextual filter for current User, and then add a Field for the file field, and configure the field however you would like the file to be displayed to the user.
Depending on what you want, you could also set that view as the frontpage of your site, so that people will see it when they log in.
To filter by current user, when you add the Contextual Filter, in the "WHEN THE FILTER VALUE IS NOT IN THE URL" section, select "Provide Default Value" and then select the type "User ID from logged in user"

relate an object in salesforce with multiple objects

1) I have created a custom object "Hello".
Added two lookup fields to it, one is associated to Accounts and another to Leads.
2) now my custom object appears as a related list in both Account and lead
3) if i goto an account say "**Test_account**" >> i click on the new button
on the "Hello" related list.here i have redirected to a custom
visualforce page "**Welcome**".
Now I want that on my "Welcome Page" I want to display 2 fields.
If user reached this "Welcome Page" via hello related list in accounts then label on this page is set to Accounts
but
If user reached this "Welcome Page" via hello related list in leads then label on this page is set to Leads.
I dont know how to do this.
I can get the retURL in the currentpage URL but it gives me only the id.
Now I am not sure this id belongs to Accounts or Leads.
Accounts nad leads are just examples,there could be many more ojects.
By looking at the first three characters of the id, you can tell the type of object. For example, all Accounts start with '001' and all Leads start with '00Q'. You can get all the key prefixes from the DescribeSObjectResult in either Apex or the Web Services API. The API also returns this in the DescribeGlobalResult, which is handy if you want to load all the key prefixes in one call. The REST API also has the key prefix, but you'd have to traverse all the objects to get to it.

Resources