Jump to content

Featured Replies

Posted

I want to fetch followers and following members for a specific user. how can i do it? 

Solved by ReyDev

Go to solution

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 by Adriano Faria

  • 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.

Probably. $app = core and $area = member.

  • 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!!

Then make a query!

  • 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 by ReyDev

Recently Browsing 0

  • No registered users viewing this page.