I wanted to remove the 'is now friend with' block when two users are now friends. In a large community is like 20 post in index are of this, then 2 normal posts and other 20 like this. It isn't really nice. I've read old things on how to remove this block, but they are for older versions of PHPfox. So, I went deep in the PHPfox code and I solved it! The problem is that to achieve this you need to edit PHPfox files (so when you update, please DO A BACKUP AND CHECK IF CODE IS STILL THE SAME IN THIS FILE. Otherwise you can break your site. What we're going to do is to comment out a section of a PHPfox file. PLEASE IF YOU DO THIS DO NOT ASK FOR FIX FROM PHPFOX STAFF, BECAUSE THIS ISN'T THEIR PRIORITY. THEY PROVIDE YOU PHPFOX AS IS, ANY MODIFICATION CANNOT BE SUPPORTED IN ANY CASE. If you need help, please reply to this thread and I'll try to help you out. For first, I explain what happens if you comment out these lines: practially posts DON'T GET SHOWN. But they get generated. They get generated because YOU NEED this. If they didn't get generated, could happen that your Database will break. And could lost a part of PHPfox. So, it's good to JUST HIDE these blocks, now. In fact, commenting out these lines just removes visibility, but generates data in DB. I know someone could say "You can do this with CSS 'display:none' too". But no, you can't. Because if you do so, everytime you are on index or on a profile, there will be "There are [number] new feed!" and even if you click, nothing is shown. If you reload the page, it will still notice you the N new feeds. That's because the code doesn't understand that you really saw the block. So, it's better to act via PHP, which doesn't show any advice. Before do this, I suggest to set "Feed display limit" to an higher number than 5. Like 15. That's because if you load the index, it will show you 5 feeds. No? If you have 3/4 or more feed of "is now friend with", it will show just 1-2 feeds instead of other 3-4. That's because, as I said, PHPfox still count the existence of this blocks. It's the same if you click on "View More": it will load, for example, just 3 feeds if 2 of these 5 are of "is now friend with". In fact, for example, here on PHPfox demo activity feeds are much more than five, and it doesn't cause troubles. In my website I've put 25 feeds, but it isn't the case if you don't have so much users. In medium, I suggest 15. But this is your choice! Now, let's go the the action. THIS METHOD IS FOR V4.1(BUILD3). DON'T USE ON OTHER VERSIONS BECAUSE I HAVEN'T TEST IT. USE AT YOUR OWN RISK. Open your FTP client and connect via FTP to your website. Go to: PF.Base/module/friend/include/service/callback.class.php Download that file and open it with your text editor of choice (I suggest Atom, SublimeText 3 or Notepad ++). Go to the line 80. You'll see: public function getActivityFeed($aFeed) Before it, write /*. So it will be: /* public function getActivityFeed($aFeed) Then, scroll down 'til you meet the line 236. You will see just: } This. Comment it out placing */ after it. So it will be: } */ Then, save the file and upload it in the folder where you downloaded it from your FTP client. Now, check in your website if you see any "is now friend with". You shouldn't. And, if someone would ask: yes, notificatons of new requests and accepted requests work. I tested it! If you do something wrong, download again PHPfox from your client area and look for that file, then upload it via your FTP client. In this way you'll have your file restored to the default. As I said, this method works on PHPfox 4.1 Build 3. I don't know if it do so in other versions. ____________________________ UPDATE: I found that this method loads anyway in the feeds, the block "User is now friend with user", but when PHPfox understands that is it, will "hide" it. This slows down big sites that have so many people adding other, resulting like a "white block... loading" infinite, because everytime this "white block loading" is really a "User is now friend with user" so it hides and shows the next one... that'll be obviously "User is now..." so the website seems to be slow loading, even if isn't. I found how to don't pass this to the feed. But it will save the data in the Database! That's the great thing. So, nothing will mess up. This is possible just by commenting out one line of code and nothing more. Everything works: notifications, request and so on. You should do just this, and not too what I've already posted. So, practically what we do is this: we don't say to PHPfox to send the fact that an user is now friend with someone other to the feed. (Works in both profile & main feed). This doesn't delete old "is now friend with" because they have already been sent to the feed from PHPfox. If you want to remove these you can via database but I suggest you to don't to so you don't mess up things: for this reason I don't say how to do this as is very dangerous. Later I'll say how to do the same thing I posted before but with CSS for old post. This doesn't causes any problem to PHPfox, it will just "stop" all of these feeds. But if you re-enable the feature, you will not get all the lost "is now friend with" back, because they have already been generated by PHPfox and we told it to don't do anything about. So if you want the feature back, you can just uncomment the line I'm going to say and all feed stream about this will from that moment show. The file to edit is on PHPfox core, and not an app. So please do a backup of the file. If you don't to it and something happens, please download PHPfox again and override the file I told you to edit. I don't know if this will ever work. Please backup and do all the necessary before do this again when you update PHPfox. The file to edit is here: PF.Base/module/friend/include/service/process.class.php Go on the line 111 and comment out the line, by adding a // before. So it will be:
// (Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->add('friend', $iFriendToUser, 0, 0, $iFriendId, Phpfox::getUserId()) : false); // http://www.phpfox.com/tracker/view/14671/
Please if you note, ignore the "double" comment that has been created; the other // are of a core developer to track PHPfox changes. Let them stay where they are. And that's it! Just this. If you want to revert, it's enough to remove the // that I told you to insert. From this moment any "is now friend with" will be generated anymore. As I said, older will be. If you want to hide them don't use the method above as it could break your site together with this but use this CSS method: Go in theme optons and then in CSS. Just add this code:
._app_friend{display:none;}
Then wait for saving and that's it. If it doesn't work with your theme, use this:
._app_friend{display:none!important;}
Then wait for saving. This method with CSS is not needed, in fact in my community I didn't used it: just some old "is now friend with" doesn't ruin anything! But you can do as you desire! Thank you for reading this. Hope this will help someone.
Last update on December 16, 2015 by Christian la Forgia.
Donna(data66)
Thanks for posting your tips. For those trying this, one of the most important things to do before editing core files (which voids any support and can make the site unstable) is to make a backup of the file you are editing. That way, if you need to revert it, you already have a copy on your server.
Perhaps someone would make a plugin for this or an app too.
Thanks for posting your tips. For those trying this, one of the most important things to do before editing core files (which voids any support and can make the site unstable) is to make a backup of the file you are editing. That way, if you need to revert it, you already have a copy on your server. Perhaps someone would make a plugin for this or an app too.
In fact the best thing'd be to have an app for an easy achieve of this. But currently I don't have read the PHPfox dev documentation about apps. If I have time and do so, maybe I will do the app!
Be the first person to like this.
Gatsby
In fact the best thing'd be to have an app for an easy achieve of this. But currently I don't have read the PHPfox dev documentation about apps. If I have time and do so, maybe I will do the app!
Nice work. Its good to see people thinking on their feet here. The type of post that this mod eliminates is almost the digital equivalent of human gossip..."BTW did you hear who made friends with....?". Why not make it a privacy option, as some users (such as those who block their profile from being viewed by non friends) probably do not want their new friends status broadcast to everyone anyways. It would be as simple as adding new privacy panel options select like this: Display your "New Friends" status to everyone? If set to YES, enable the segment of code blocked above, If set to NO, bypass it. When the developers get caught up of course.
Nice work. Its good to see people thinking on their feet here. The type of post that this mod eliminates is almost the digital equivalent of human gossip..."BTW did you hear who made friends with....?". Why not make it a privacy option, as some users (such as those who block their profile from being viewed by non friends) probably do not want their new friends status broadcast to everyone anyways. It would be as simple as adding new privacy panel options select like this: Display your "New Friends" status to everyone? If set to YES, enable the segment of code blocked above, If set to NO, bypass it. When the developers get caught up of course.
Yes, in fact... great suggestion! Is a bad thing the fact that users can't manage how they should be 'public'. Because this is like a 'privacy violation'. For now I cannot do the app, because with the actual documentation provided by PHPfox I don't know if I can/how to access this data, but I did an enhancement on this that will work as native and is even more simple; I post it soon!
Be the first person to like this.
I updated the article!
Now there is a new method.
What do you suggest? To remove the old one or what to do?
Be the first person to like this.
Josh (Jinkers)
Great tutorial. One (well two technically, but its a same issue) issue I saw is with the CSS selectors at the end. You are missing the semi-colon on the end of the statements. They should be: ._app_friend{display:none;} and ._app_friend{display:none!important;} Aside from that, looks good :)
Great tutorial. One (well two technically, but its a same issue) issue I saw is with the CSS selectors at the end. You are missing the semi-colon on the end of the statements. They should be: ._app_friend{display:none;} and ._app_friend{display:none!important;} Aside from that, looks good :)
Hi, thank you! Right, I missed them, ahah. But as far as I know it works anyway without any semi-colon in the end if the value is just one, anyway I edited the post!
Be the first person to like this.
Josh (Jinkers)
But as far as I know it works anyway without any semi-colon in the end if the value is just one, anyway I edited the post!
It works fine if they are the last selectors in your css. Generally, anything added after chucks a little hissy fit and hence is best practice to not leave them off :) - Just a little tip.
It works fine if they are the last selectors in your css. Generally, anything added after chucks a little hissy fit and hence is best practice to not leave them off :) - Just a little tip.
Yes, you are right, in fact this is a better approach about it. Thank you for the tip. :)
Donna(data66)
I have to post this in case some choose to modify source files like this. When we (phpFox) start our support plans again in the first quarter of next year, any source code modifications (even if in default theme code) will void any and all support from phpFox. We do not ever, nor have we ever, covered any site that modifies any of our default files.
I have to post this in case some choose to modify source files like this. When we (phpFox) start our support plans again in the first quarter of next year, any source code modifications (even if in default theme code) will void any and all support from phpFox. We do not ever, nor have we ever, covered any site that modifies any of our default files.
Hi Data, for support you mean the support that could be received by asking here for a your response or publicing a bug in the GitHub tracker? Or there is another way to ask support which I don't know?
Be the first person to like this.
Donna(data66)
Hi Data, for support you mean the support that could be received by asking here for a your response or publicing a bug in the GitHub tracker? Or there is another way to ask support which I don't know?
We will be adding a paid support desk early next year. That support would be voided if someone edits any source files. People can always get help here in the forum or at my scripttechs site though. :) Thanks for the tutorial btw. :) I'm sure other people will find it helpful.
Be the first person to like this.
Gatsby
Right, I missed them, ahah.
Are you and Luke related by any chance?
Be the first person to like this.

Does this still work?  

Be the first person to like this.

Is this an option now in the Friend's module?  I see a blurb that is fairly ambiguous.

Allow posting on Main Feed
Allow posting to Main Feed when someone is a friend.

** This seems to stop the "xyz is now friend with abc" in the main feed.

Be the first person to like this.