ReyDev Posted September 11, 2021 Share Posted September 11, 2021 I want to fetch followers and following members for a specific user. how can i do it? Link to comment Share on other sites More sharing options...
Adriano Faria Posted September 11, 2021 Share Posted September 11, 2021 (edited) 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, 2021 by Adriano Faria Link to comment Share on other sites More sharing options...
ReyDev Posted September 11, 2021 Author Share Posted September 11, 2021 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. Link to comment Share on other sites More sharing options...
Adriano Faria Posted September 11, 2021 Share Posted September 11, 2021 Probably. $app = core and $area = member. ReyDev 1 Link to comment Share on other sites More sharing options...
ReyDev Posted September 11, 2021 Author Share Posted September 11, 2021 /** * 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!! Link to comment Share on other sites More sharing options...
Adriano Faria Posted September 11, 2021 Share Posted September 11, 2021 Then make a query! Link to comment Share on other sites More sharing options...
Solution ReyDev Posted September 11, 2021 Author Solution Share Posted September 11, 2021 (edited) 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, 2021 by ReyDev Link to comment Share on other sites More sharing options...
Recommended Posts