Solved

drupal profile 2

Posted on 2013-05-30
17
717 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
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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

822 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