?
Solved

drupal profile 2

Posted on 2013-05-30
17
Medium Priority
?
738 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:Aaron Feledy
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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 9

Accepted Solution

by:
scifikillr earned 2000 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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
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 how to dynamically set the form action using jQuery.
Suggested Courses

800 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