]> git.mxchange.org Git - friendica-addons.git/commitdiff
Use new Model methods for group
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 9 Dec 2017 18:50:29 +0000 (13:50 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 9 Dec 2017 18:50:29 +0000 (13:50 -0500)
pumpio/pumpio.php
statusnet/statusnet.php
twitter/twitter.php

index c3201f424e9ae0dee5c48f38874cf94845abbd58..e60c631714dd9fa18fd5e143a1f41bc239604329 100644 (file)
@@ -10,6 +10,8 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
+use Friendica\Model\Group;
+use Friendica\Model\User;
 
 require 'addon/pumpio/oauth/http.php';
 require 'addon/pumpio/oauth/oauth_client.php';
@@ -1022,14 +1024,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
 
                $contact_id = $r[0]['id'];
 
-               $g = q("select def_gid from user where uid = %d limit 1",
-                       intval($uid)
-               );
-
-               if($g && intval($g[0]['def_gid'])) {
                        require_once('include/group.php');
-                       group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
-               }
+               Group::addMember(User::getDefaultGroup($uid), $contact_id);
        } else {
                $contact_id = $r[0]["id"];
 
index a9e309cff2f30f24813d3c332cc9e7f26b8b482b..94f00f288029b2c9fe6e410d63183291e314c2ba 100644 (file)
@@ -49,7 +49,9 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Model\GContact;
+use Friendica\Model\Group;
 use Friendica\Model\Photo;
+use Friendica\Model\User;
 
 class StatusNetOAuth extends TwitterOAuth
 {
@@ -1054,14 +1056,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
 
                $contact_id = $r[0]['id'];
 
-               $g = q("SELECT def_gid FROM user WHERE uid = %d LIMIT 1",
-                       intval($uid)
-               );
-
-               if ($g && intval($g[0]['def_gid'])) {
                        require_once 'include/group.php';
-                       group_add_member($uid, '', $contact_id, $g[0]['def_gid']);
-               }
+               Group::addMember(User::getDefaultGroup($uid), $contact_id);
 
                $photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $contact_id);
 
index f88d4542b41a0c1a9f695216b3f9badbb7615b33..9973ad92ad7a8d3490c27cf62a6d2b0c8395d326 100644 (file)
@@ -65,7 +65,9 @@ use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
 use Friendica\Model\GContact;
+use Friendica\Model\Group;
 use Friendica\Model\Photo;
+use Friendica\Model\User;
 use Friendica\Object\Image;
 
 require_once 'include/enotify.php';
@@ -1055,14 +1057,8 @@ function twitter_fetch_contact($uid, $contact, $create_user)
 
                $contact_id = $r[0]['id'];
 
-               $g = q("SELECT def_gid FROM user WHERE uid = %d LIMIT 1",
-                       intval($uid)
-               );
-
-               if ($g && intval($g[0]['def_gid'])) {
                        require_once 'include/group.php';
-                       group_add_member($uid, '', $contact_id, $g[0]['def_gid']);
-               }
+               Group::addMember(User::getDefaultGroup($uid), $contact_id);
 
                $photos = Photo::importProfilePhoto($avatar, $uid, $contact_id, true);