How to stop profile Pictures from automatically posting on the newsfeed?

Aaron Green Posted in Beginning Developers 3 years ago

I am trying to prevent profile and cover photos from automatically posting to the newsfeed after upload. Experimenting I tried to delete the folder "wall" in Components/OssnProfile/plugins/default/profile/wall. This worked and stopped the automatic posting but it caused the auto pagination to act strange. It would load as if there where still post but nothing showed up. Is this even possible to do? If so can someone lead me in the right direction on a solution?

Replies
us Michieal ~ Coder ~ Replied 3 years ago

@Aaron Green,
I would have put a Define at the top, and then tested that for being set to a value. That way you could turn it back on, if you wanted too. It also allows you to search where you made changes for when you upgrade your system version, and have to transfer the modified code over to the new code.

A Quick How-to, for people that see the solution:

define('__MYVAR__', true);
...
if (isset(__MYVAR__) && __MYVAR__ == true){
    *modified code goes here*
} else {
    *original code goes here*
}

Doing this also allows you to test for incompatibilities, etc., as it gives you a quick way to turn it off - just change the value at of the define at the top of the file.

-M.

us Aaron Green Replied 3 years ago

WARNING IM NOT SURE IF THIS METHOD WILL BREAK YOUR SITE! SINCE DELETING FOLDERS AND CODE CAN. I RECOMMEND BACKING THEM UP!

Reason for this experimentation: I downloaded the new component for group postings on the newsfeed. I noticed that I had to set the ossnwall to allow all site posts in order for it to work. So I set it to all site post. I also downloaded the fake user component. When I created 20 fake users, I noticed that the newsfeed was flooded with only updated profile pics. So I began to experiment with stopping them from automatically posting when updated.

1.) I deleted the folder "wall" in components/OssnProfile/default/profile/wall. This got rid of the posts for both cover and profile pic but did not stop them from posting. Which caused the pagination to still attempt to load them.

2.) I then deleted the line of code in the upload.php which is located in components/OssnProfile/actions/photo/upload.php. The line of code that I deleted was $profile->addPhotoWallPost($file->owner_guid, $resize->{0}->guid); . This got rid of the profile pictures being posted to newsfeed.

3.) In order to stop the cover photos from uploading to the news feed I deleted a line of code in the components/OssnProfile/actions/cover/upload file. The code I deleted was $ossnprofile->addPhotoWallPost($file->owner_guid, $newcover->{0}->guid, 'cover:photo');. This stopped the cover photos from uploading to the newsfeed.

German Michael Zülsdorff Replied 3 years ago

We are pleased you have found a solution. We would be even more happy if we knew which solution, Aaron.

us Aaron Green Replied 3 years ago

Nevermind I figured out the solution. I was looking at wrong file.