import items from custom code

2 years 8 months ago - 2 years 8 months ago #61205 by oleg_kosarev
Joomla 3.5.1
FLEXIcontent 3.0.14-rc2a
MySQL 5.6.26-cll-lve (dbtype mysqli )
PHP 7.0.3

i'm change nesesry fileds from this script FLEXIcontent item by calling the FLEXIcontent item model in custom code
// Type and language
$data['type_id'] = 1; // e.g. 1 for article //ok not error
$data['language']=  'en-GB'; // e.g. 'en-GB' //ok not error
/*-------------------------------------*/
$data['catid']   = 1; // INTEGER ... the main category of the item category !!! NULL ADMIN PANEL!!!
$data['cid']     = array(7,8,9); //e.g. array(55,117,56)  an array of the secondary categories of the item !!! NULL ADMIN PANEL!!!
/*-------------------------------------*/
$data['vstate']  = 2;  // item version is approved //Set state as : waiting for approval (unpublished)
$data['state']   = 1;  // 1 for published ...
/*-------------------------------------*/
$data['created_by'] = 860; // !!! NULL ADMIN PANEL!!!
This is file from add

File Attachment:

File Name: q.txt
File Size:5 KB


What is problems? What is fix?
Attachments:

Please Log in or Create an account to join the conversation.

2 years 8 months ago - 2 years 8 months ago #61207 by oleg_kosarev
fix author add and state
$credentials = Array('username' => "login", 'password' => "password");
JFactory::getApplication()->login($credentials);
// Create a log file
$user = JFactory::getUser();
//and
$data['created_by'] = $user->id;

Please Log in or Create an account to join the conversation.

2 years 8 months ago #61211 by ggppdk
Hello

if you do not use current user , do you some message like:
"Not authorized" ?

or do you empty screen ?

if you add error_reporting to your script do you get a warning or other message ?
error_reporting(E_ALL & ~E_STRICT);
ini_set('display_errors',1);


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.