By allankayak on
Hi there,
I am developing a site, where I want to have registered users, but have a 'team' role, for just a few of my users.
I want to be able to have a block or list, like the users block, but that only shows my 'team' role. I cant for the life of me work out how to make a view, or flexinode to show that content,.
site - http://www.riverkore.com/h2o
I have found snippit that wouldl let me decide which roles are viewable, but this does not quite work. I want a list of 'all users' and a list of just my team.
thanks
Allan
Comments
don't think views can do this, but...
Not exactly sure what you want to output regarding the team role, but this may get you started.
I had a similar problem, don't think views will do it since everything in views has to link back to a node so user roles kind of goes against the grain. I used a block of php with SQL to join uid to user_roles table then joined those rid values to roles table.
Something like this in a block would list users with the team role
Nearly there!
This is so close to what I am looking for, I can taste it.
How can I get your snippet to pull values of custom profile fields?
Then how can we make this a module, its so elegant.
this will list user,profile field, profile field value
Here you go
check out the handbook for examples of how to write modules.
don't need the LIMIT 0,30
remove that line otherwise you'll only return a maxium of 30 rows.
profile_listing.tpl.php
Is there a simple way to use your code for sorting/filtering profiles to display the custom profile_listing.tpl.php formatting that I already have in my theme directory? This is based on the how-to here:
http://drupal.org/node/35728
Basically instead of calling individual fields for the found profiles, calling up the profile template file. What do you think?
So you mean past this code
So you mean past this code into a new block?
I am trying this, I pasted teh code in, changed the name to may role name, got the filter turned off, and tried a just PHP filter, but all my block does it print the code, not the list?
(very new to PHP)
Am I missing something?
Allan
http://www.riverkore.com/h2o
need to change input format
Look under the text area where you pasted the code, expand the Input Format, then select php.
text fields are filtered HTML by default, so you just need to change to php and it'll work
"list users who belongs to role X" PHP snippet
This PHP snippet looks like it will do exactly what you're looking for:
http://drupal.org/node/63422