Hiding the image so as not to be seen by visitors

ClassiBase classifieds script Forums General help Hiding the image so as not to be seen by visitors

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Za Kene 2 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1966 Reply

    Za Kene
    Participant

    Dear support,

    I use a classibase script to create a public service websites. There will only display the text without the images, but we still need the image data as a basis for verification, for example, scanned id cards, utility bills, etc.

    How to keep the images doesn’t appear on the visitors, but are only visible by admins and these users.
    Which code should be changed? and how?

    Thank you.

    #1967 Reply

    ClassiBase
    Keymaster

    Edit /sys/app/models/Ad.php file at the end of method appendAdpics add following snippet.

    // if not moderator or admin
    if(!AuthUser::hasPermission(User::PERMISSION_MODERATOR))
    {
    	// check each ad and remove adpics if ad is not by user 
    	$ads = Record::checkMakeArray($ads);
    	foreach($ads as $ad)
    	{
    		if($ad->added_by != AuthUser::$user->id || !AuthUser::$user->id)
    		{
    			unset($ad->Adpics);
    		}
    	}
    }

    so new edited appendAdpics method will be

    public static function appendAdpics($ads, $all = false)
    {
    	if($all)
    	{
    		// append all images related to ad
    		Ad::appendObject($ads, 'id', 'Adpics', 'ad_id', '', MAIN_DB, '*', false, true);
    	}
    	else
    	{
    		// append only one image
    		Ad::appendObject($ads, 'id', 'Adpics', 'ad_id');
    	}
    	////////////////////////////////////
    	//  modification hide_other_adpics
    	////////////////////////////////////
    	// if not moderator or admin
    	if(!AuthUser::hasPermission(User::PERMISSION_MODERATOR))
    	{
    		// check each ad and remove adpics if ad is not by user 
    		$ads = Record::checkMakeArray($ads);
    		foreach($ads as $ad)
    		{
    			if($ad->added_by != AuthUser::$user->id || !AuthUser::$user->id)
    			{
    				unset($ad->Adpics);
    			}
    		}
    	}
    	////////////////////////////////////
    	//  modification hide_other_adpics END
    	////////////////////////////////////
    }

    This change will check if current user is not moderator then will check each add by added_by id. If added_by is not same with current logged user then removes adpics from related ad.

    Also keep log of this change for so that you will have to update your code in case you update your script in future.

    #1994 Reply

    Za Kene
    Participant

    Dear Support,

    How to allow only dealer logo that can be seen by visitors, but other image keep visible only to admins and the users.
    I use your code snippet, it causes all images including logos dealer only visible to the user and admin.
    Which code should be changed? and how?

    Thank you.

    #1998 Reply

    Za Kene
    Participant

    Dear Support,

    Is there any solution to help my problem ?

    Thank You.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Hiding the image so as not to be seen by visitors
Your information:




This entry was posted on by .