fix default channel setting after import
This commit is contained in:
parent
247d132e17
commit
94dfe87a6b
@ -241,11 +241,13 @@ function set_default_login_identity($account_id,$channel_id,$force = true) {
|
||||
$r = q("select account_default_channel from account where account_id = %d limit 1",
|
||||
intval($account_id)
|
||||
);
|
||||
if(($r) && (count($r)) && ((! intval($r[0]['account_default_channel'])) || $force)) {
|
||||
$r = q("update account set account_default_channel = %d where account_id = %d limit 1",
|
||||
intval($channel_id),
|
||||
intval($account_id)
|
||||
);
|
||||
if($r) {
|
||||
if((intval($r[0]['account_default_channel']) == 0) || ($force)) {
|
||||
$r = q("update account set account_default_channel = %d where account_id = %d limit 1",
|
||||
intval($channel_id),
|
||||
intval($account_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ require_once('include/identity.php');
|
||||
|
||||
function import_post(&$a) {
|
||||
|
||||
if(! $a->get_account()) {
|
||||
if(! get_account_id()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,11 +119,11 @@ function import_post(&$a) {
|
||||
// reset
|
||||
$channel = $r[0];
|
||||
|
||||
set_default_login_identity($a->get_account(),$channel['channel_id'],false);
|
||||
set_default_login_identity(get_account_id(),$channel['channel_id'],false);
|
||||
|
||||
if($data['photo']) {
|
||||
require_once('include/photo/photo_driver.php');
|
||||
import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id,$channel['channel_id']);
|
||||
import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id(),$channel['channel_id']);
|
||||
}
|
||||
|
||||
$profiles = $data['profile'];
|
||||
@ -326,12 +326,17 @@ function import_post(&$a) {
|
||||
|
||||
notice( t('Import completed.') . EOL);
|
||||
|
||||
change_channel($channel['channel_id']);
|
||||
|
||||
goaway(z_root() . '/network' );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function import_content(&$a) {
|
||||
|
||||
if(! $a->get_account()) {
|
||||
if(! get_account_id()) {
|
||||
notice( t('You must be logged in to use this feature.'));
|
||||
return '';
|
||||
}
|
||||
|
Reference in New Issue
Block a user