Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 11, 20213 yr I want to fetch followers and following members for a specific user. how can i do it?
September 11, 20213 yr Query the core_follow table. I don’t remember if there’s any method ready for this and can’t check now as I’m on a mobile device. EDIT: you can probably try: $member-> followers(). Edited September 11, 20213 yr by Adriano Faria
September 11, 20213 yr Author 46 minutes ago, Adriano Faria said: you can probably try: $member-> followers(). thanks a lot , works for followers. what about the following, i also want to fetch the members who follow a specific member. I took a look at `\IPS\Member` class and found this method. public function following( $app, $area, $id ) { // } I have no idea if it works for the following members or not.
September 11, 20213 yr Author /** * Following * * @param string $app Application key * @param string $area Area * @param int $id Item ID * @return bool */ this method just returns a bool value. checks if a member follow the current member or not. I didn't find other method that returns the following members list!!
September 11, 20213 yr Author Solution 14 minutes ago, Adriano Faria said: Then make a query! I did! for followers : \IPS\Db::i()->select( 'follow_member_id', 'core_follow', [ 'follow_app=? AND follow_area=? AND follow_rel_id=?', 'core', 'member', \IPS\Member::loggedIn()->member_id ] ) for following : \IPS\Db::i()->select( 'follow_rel_id', 'core_follow', [ 'follow_app=? AND follow_area=? AND follow_member_id=?', 'core', 'member', \IPS\Member::loggedIn()->member_id ] ) maybe helps someone! Edited September 11, 20213 yr by ReyDev