SPECIAL OFFER: Only $69 for access to everything in OSTraining for 1 year! You save $75!  1
Join today and get access to 1,000's of books and videos. Learn WordPress, Drupal, Magento, Joomla and more! Sign up today!

First posting. Drupal advanced forum help

4 years 10 months ago #118983 by h0td0wg
Hello all..first time posting here on the support forum.

We have a Drupal forum setup with advanced forum, acl, forum access and adminsterusersbyroles modules.

The above config allows us to have users assigned to various roles thus giving control of access to different subject topics/threads on the forum.

I would like to display a list of members for each of these forum threads. Ideally when a forum user is viewing a forum thread. This would enable them to get a sense of who else is able to see what they are about to post.

I have tried creating a view that displays all users but I was not able to attach that view to a forum tid.

I have also successfully managed to do the sql query ( in a custom module) that links up all the related tables together and display a full list of users by tid and the user id. Could/will post these if needed.

I would like someones help in integrating this module with the corresponding advanced forum tpl file.

Running drupal 7.41.

I got a test site setup on patheon if anyone wants access to have a look at the config.

Thanks in advance and sorry for the long post. I have searched most of the forums and failed at finding help on this topic.

Please Log in to join the conversation.

4 years 10 months ago #118986 by steve
Replied by steve on topic First posting. Drupal advanced forum help
Hi and welcome to OSTraining , h0td0wg.

Glad to have you with us. No problem on the long post.

Let's focus on this initial problem:

Ideally when a forum user is viewing a forum thread. This would enable them to get a sense of who else is able to see what they are about to post.

I have tried creating a view that displays all users but I was not able to attach that view to a forum tid.


My questions:
1) Would you want this showing as a block in the sidebar?
2) What problems did you have connecting the view to a forum tid?

Please Log in to join the conversation.

4 years 10 months ago #119174 by h0td0wg
Replied by h0td0wg on topic First posting. Drupal advanced forum help
Sorry for the delay in replying and thank you,

In the view, I was not able to get the taxonomies to display together with user related fields. Due to the fact that I'm using forum access maybe the users and forum taxonomies are not connected directly.

Yes I would like the information to be displayed on a sidebar block.

Please Log in to join the conversation.

4 years 9 months ago #119289 by steve
Replied by steve on topic First posting. Drupal advanced forum help
Hi h0td0wg

Have you set up relationships inside Views before?

They're on the right-hand side of the Views screen, under the Advanced tab. That's what will allow you to connect up different forms of data such as users and taxonomies on a single View.

If you don't have user data, add a relationship to the users. That will then make the user fields available.

Please Log in to join the conversation.

4 years 9 months ago #119343 by h0td0wg
Replied by h0td0wg on topic First posting. Drupal advanced forum help
Hi,

Yes I tried all possible combinations including relationships etc. I could not tie the users and the forum tid together in each of the many views that I got to try out.

From what I understood the users and the forum tid's are tied using forum_access modules data tables. This could be the reason why the tid's were missing in the view with all the users. (or vice versa). There is no direct connection in the DB.

Please Log in to join the conversation.

4 years 9 months ago #119366 by steve
Replied by steve on topic First posting. Drupal advanced forum help
Ah, that's possible. Not all modules have a good integration with Views and it's possible that Forum Access is one such module.

If it helps, email a login to support@ostraining.com and I'll take a look for you.

Please Log in to join the conversation.

4 years 9 months ago #119652 by steve
Replied by steve on topic First posting. Drupal advanced forum help
Ok, thanks. I've gone through your setup and there's no way this can be done through the Views UI, using off-the-shelf tools.

I would recommend against hard-coding this query into a template.

I wonder if this would work?
www.drupal.org/project/views_raw_sql

1. In Views configuration, turn on the option to display query in preview.
2. Create a View that includes all of the fields you want to use in your SQL expressions. For example, if you want to add two number fields together, you first need to get the number fields loading. If you don't know how to do this, you shouldn't be using this module.
3. In the query preview, find the names of the fields you want to use. If you don't know how to read a SQL query, you shouldn't be using this module.
4. Add a new raw SQL field or sort, and write an expression that uses existing fields.


Alternatively, you can use Drupal's function system in your theme. There's an introduction in about 5 videos, starting here: www.ostraining.com/courses/session/drupa...d-overrides/contrib/

Here are some specific ideas on implementation: drupal.stackexchange.com/questions/73/custom-query-in-views

Please Log in to join the conversation.

Join today and get access to 1,000's of books and videos. Learn WordPress, Drupal, Magento, Joomla and more! Sign up today!