import items from custom code

5 years 9 months ago - 5 years 9 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.

5 years 9 months ago - 5 years 9 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.

5 years 9 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.
Save
Cookies user prefences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline