Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Hide photos from specific usertype in Latest Photos module

11 years 8 months ago
  • Tahir's Avatar
    Topic Author
  • Tahir
  • Offline
  • Fresh Boarder
  • Posts: 48
  • Thank you received: 2
Licenses:
JomSocial Expired

Hi.

The module mod_community_photos shows latest photos from all users. Can i change this that way so it doesnt display photos from 2 specific usertypes?

I have more then 8 different profile types and only wanna display the photos of 6 different profile types.

I had a situation before where Dimas helped me with hiding specific profile types from the registration page.
www.jomsocial.com/forum/profile-universa...on-registration-page

Can you advise me with a tweak like this?

THX

11 years 8 months ago
Licenses:

Hi, Tahir.

This could be done by editing module template.
First create override for this file: ROOT/modules/mod_community_photos/tmpl/default.php
By coping in to: ROOT/templates/your-template/html/mod_community_photos(if you don't have "html" or "mod_community_photos" folders, feel free to create them)

Now you'll need to check current user (logged in user) profile type and add php condition to foreach loop (combined photo album ID and user profiletype check) so photos from certain album are displayed only if user has certain profile type id.

Recommended reading:

docs.joomla.org/Selecting_data_using_JDatabase
docs.joomla.org/Accessing_the_current_user_object


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
11 years 8 months ago
  • Tahir's Avatar
    Topic Author
  • Tahir
  • Offline
  • Fresh Boarder
  • Posts: 48
  • Thank you received: 2
Licenses:
JomSocial Expired

Hi Michal.

I have found something useful for me in the default.php which i was looking for some time :)

I have created the override as you suggested but i cant understand what exactly i need to write there now. So i got 10 different usertypes but DONT want to display the photos from 2 specific usertypes.

Can you help me little more deeper in this topic please?

11 years 8 months ago
Licenses:

Hi, Tahir.

I presume that you're familiar with php so you could create sql queries and php conditions...

So first you'll need to check what profile type has currently logged in user (user that view your site at the moment - to determine if he/she has rights to see those photos).

As everything is based on user ID you could check it using code described here:

docs.joomla.org/Accessing_the_current_user_object

Once you have menu ID you'll need to write a SQL query to fetch profile type ID that user has

So you'll need this documentation: docs.joomla.org/Selecting_data_using_JDatabase

Now you should have variable that contains current user profile type ID.

You should also know certain photo album ID - as I understand, users with certain profile type should be forbidden to see photos from certain albums.

Next you should write php condition that loads photos if certain conditions are meet. In file that I mentioned previously, you should look for foreach loop that loads photos. And now wrapp it with php condition. In your case it should be like this:

here starts foreach loop
<?php if ($user_profile_type_id != '123' AND $photo_album_id != '456') { ?>
here goes photo code
<?php } ?>
here loop ends

Of course your variables may have different names - it's up to you how you call them.

Condition could be translated as follows:

Load images except the one from album with ID 456 when current user has profile type ID 123.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
11 years 8 months ago
  • Tahir's Avatar
    Topic Author
  • Tahir
  • Offline
  • Fresh Boarder
  • Posts: 48
  • Thank you received: 2
Licenses:
JomSocial Expired

Hi Michal.

Thank you. Im beginner in PHP but its much clearer now for me.

But one thing. I think you understand me wrong.

I dont want to limit the view for current users.

What i exactly need is: No matter what usertype you are (current), if you login and see the photos module and the pics inside this module, you shouldnt see the photos uploaded by usertype1 and usertype2. If a usertype1 or usertype2 uploads a photo to the community it should act same as regular jomsocial (the uploaded photo is visible in the stream and in the users album.) but the latest photos module shouldnt display these photos. If any other usertype uploads a photo it should be as it is in the regular module.

So actually i dont want to restrict any user from seeing something. I like to restrict the mentioned usertype1 and usertype2 from showing their photos in this module. So if a usertype1 want his pictures to be displaying in this module too, they need to upgrade to usertype3, usertype4, usertype3 etc.

So i expected that there should be added a line of code in the default.php like: when the module is fetching the content (photos) it shouldnt display photos from usertype1 and usertype2. Something like if usertype1 and usertype2 display:hidden :) you know what i mean right? :)

The reason why we are doing this is simple. Its a photographer community and we only like to exhib the photos of our professional users. So when a user is logging in he shouldnt see the photos from beginners since they are not so beautiful.

Im waiting for your response if theres a easier way because your solution is little bit more functional.

Thanks

11 years 8 months ago
Licenses:

HI, Tahir.

Oh, then I'm sorry... but this will be a bit more complicated as you'll need to determine:

1. Which user uploaded certain photo - so you'll have his/her user ID
2. Then you'll need to check to what profile type ID is user assigned to.
3. Create php condition

UploaderID is stored here:

$row->user->id;

So now you should create query to check what profile type ID user is assigned to.

And then condition:

if {$uploader-profile-type-id != ('56' OR '78')}

Images will be not loaded but still will be counted so you'll need to increase number of photos to be displayed in module.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW