Solved

drupal profile 2

Posted on 2013-05-30
17
729 Views
Last Modified: 2013-06-18
Dear experts,

I am using profile2 to create a profile for each of my users. But there is something that my client requires and I don´t really know how to do. Each user is suppose to have different projects and each project is suppose to contain several pdf files. He wants to be able to create a project and assign it to the corresponding user profile.

I was thinking I could create a content type, say New Project. So when my client creates a New Project he will be able to assign that new project to an user.

Do you know a module that could let me do that?

thanks,

Winter
0
Comment
Question by:glepiza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
17 Comments
 
LVL 13

Expert Comment

by:Arrow_1
ID: 39209815
Yes, that would work. You could create a content type of "Project" and add a field for referencing a user using the Entity Reference module.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 39210766
If you create a content type called Project, you can specify that it can have uploads of documents, and you can limit the number of documents if you need to.
0
 
LVL 9

Expert Comment

by:scifikillr
ID: 39211012
Another option (instead of using Entity Reference) is to use the References module.

You could create the content type as you suggest, and use the user reference to associate each node with a specific user. Then you could build a view which uses this userreference field to populate a block (which is only contextually available, based on a userID argument in the view) and load that block on the profile page. This would give each user the ability to see what is assigned to them currently.

Then, you can simply format/theme the node in such a way that the files are listed as you wish.
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 9

Accepted Solution

by:
scifikillr earned 500 total points
ID: 39211026
To make the view block, you would want to do something like this:

First, add the user reference field to the node.
Then:
1. Add a new view
2. Add the fields you want from the project nodes.
3. Add a "contextual filter" (e.g., argument). Select Default argument, and then "User ID from URL". If that is not available, you may first need to add a user relationship, then try again.
4. Add whatever sort method you like.
5. Set the block visibility to only exist on the profile page (or on a user-specific page).

This block will basically only show up if the following is true
1. If the page you're on is a user page (not a node, in this case)
2. If the page matches the visiblity settings you defined for the block.
0
 

Author Comment

by:glepiza
ID: 39211412
Hey guys thank you for your answers.

scifikillr,

do add an user relationship I guess I need to download user relationship module right ?

Another thing, just to see if I am doing it right, since I am not very familiar with the References module.
I added a new content type named Projects with the following fields:

Project name (as a text field)
Documents (as a file field )
User Reference (as a user reference field).

Then I went ahead and create a new view. I added the Project Name and Documents Fields. then I tried to add a contextual filter, but there is no Default argument to select, so as you suggested I need to add a user relationship. There is where I am stuck, to make an user relationship do I need to download the user relationship module or there is another way to do it?

Thank you very much,

Winter
0
 
LVL 9

Expert Comment

by:scifikillr
ID: 39211786
For the user relationship, you've already gotten that sorted (via the References module). If you actually need to add a Views Relationship, Views should be able to do that on its own.

For the argument:
I would check for an argument called "User:UID". That should work. I'll have to check my resources and get to you on this, otherwise. Please let me know if the above works.
0
 

Author Comment

by:glepiza
ID: 39211863
I don´t see an User:UID, but I am still looking where I get see it.
0
 

Author Comment

by:glepiza
ID: 39211957
ok, I think I got the user id, but in mine it comes like the authors id. Now I am looking how to set the blocks visibility in views...
0
 

Author Comment

by:glepiza
ID: 39212016
Can someone please help me how to set blocks visibility only on the profile page?
0
 

Author Comment

by:glepiza
ID: 39212051
hmm , I think I did not get right contextual filters, I choose author uid but it seems I do need to user:uid, but I don´t see it.
0
 

Author Comment

by:glepiza
ID: 39212062
ok, I had to download user relationship module and now I get the user:uid. But now I don´t know how to set the block visibility to appear in profile pages..
0
 
LVL 9

Expert Comment

by:scifikillr
ID: 39216364
Block visibility can be set via the block settings page for the block in question. Navigate to Structure > Block, find the block, click 'Edit'.

Once on the edit page, scroll down to the section called 'Visibility Settings'. You have one of two choices:
1. Include on provided paths
2. Exclude on provided paths

The selection made above (include/exclude) will inform whether the paths. Using the example below with 'include' would result in the block appearing anywhere the first argument is equal to 'user':
user
user/*
0
 

Author Comment

by:glepiza
ID: 39220980
thanks for your answer. for some reason, User ID disappeared from contextual filter. I was deleting everything and when I wanted to added it back I just can´t see it anymore. But will will keep looking...
0
 
LVL 9

Expert Comment

by:scifikillr
ID: 39222340
If the field "disappeared" and you didn't delete it, then one of two things should be happening:
1. The field is replaced in the view by something called a 'broken views handler'. This is the representation of the field, but is reflected this way if the module that exposes this field/functionality is disabled.
2. Someone deleted the contextual filter from the view.

The UID relationship may be dependent on a relationship... I'm not sure. If so, it would explain the absence of the field. Adding relationships can sometimes expose other types of fields to the view (since views typically operate in a 'node' context, adding a relationship for something else would expose an entirely new set of fields)
0
 

Author Comment

by:glepiza
ID: 39257922
Ok, I ended up almost re building the view. Thank you all of you for your help.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question