Using Profiles like social Media sites

More
10 years 1 month ago #50303 by milind.purandare

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

More
10 years 1 month ago #50305 by ggppdk
Hello

sorry i answered a different question (confused with another forum)

you want to create an item, not display the profile item

the only way to do this is create the data array
and pass it to the save task of the model


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

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

More
10 years 1 month ago #50417 by milind.purandare
Ohh ok.

Yes I am trying to send data array to save.
But the problem is with include.
As posted earlier on this thread:
=======================================
Hi

I am so sorry still struggling with this code.

This is inside the item.php of a template called Welcome (welcome template created from blog template)...

The code hangs at :
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

The paths look ok to me.

Thanks in anticipation
===============

<?php
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );

//sub folder
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..' ));

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );


$app = JFactory::getApplication('site');
$app->initialise();

// below line of require once hangs
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');


$mynewitem = new FlexicontentModelItem();
$data = array();
$data = 0; // indicate a new item will be created

// Type and language
$data = "1" ; // e.g. 1 for article
$data= 'en-GB'; // e.g. 'en-GB'

// main category, secondary categories and tags
$data = 1; // INTEGER ... the main category of the item
$data = array("1","2","3"); //e.g. array(55,117,56) an array of the secondary categories of the item

$data = 2; // item version is approved
$data = 1; // 1 for published ...

$data = 'PHP CODE CREATED TITLE';
$data = 'PHP CODE CREATED DESCRIPTION';

$mynewitem->store($data);

?>

==============

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

More
10 years 1 month ago #50425 by ggppdk
Hello

you mean that:

anything after:
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

is not executed ?


please MAKE sure that you have enabled error reporting so that PHP errors get printed


at the top of you PHP file:
Code:
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...

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

More
10 years 3 weeks ago #50570 by milind.purandare
Thanks.

The line:
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

generates the error:
Fatal error: Cannot redeclare class FlexicontentModelItem in /mnt/data/vhosts/casite-538540.cloudaccess.net/httpdocs/administrator/components/com_flexicontent/models/item.php on line 43

If I comment the above require_once then it results in the "invalid token" error at top of the store procedure when executing
$mynewitem->store($data);

Do note the above code is in welcome item of welcome category of welcome template inherited from blog template. (all flex)

Curious query:
$mynewitem = new FlexicontentModelItem();
echo "ID:".$mynewitem->getId().":ITEM<BR>"; ;

The above returns the last flex item id... is that ok?

My million thanks in advance. This is my last barrier.

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

More
10 years 3 weeks ago #50572 by ggppdk
Hello

1. about file being included twice,
maybe there is an "include()" before the "require_once()" ?



2. the check of ITEM FORM token is being done at controller, it should not be inside the model

So comment out or remove the code:
(administrator/components/com_flexicontent/models/parentclassitem.php):
Code:
// Check for request forgeries if ( !JFactory::getApplication()->isAdmin() ) { // For flexible usage, e.g. when it is called by the new IMPORT TASK JRequest::checkToken() or jexit( 'Invalid Token' ); }




3. Also about replacing items and fields anywhere the new system plugin is finished,

usage examples:
Code:
{flexi_FIELD:field29 item:117} {flexi_FIELD:field29 item:117 method:display} {flexi_FIELD:29 item:117 method:display} {flexi_FIELD:29 item:current method:display} {flexi_ITEM:4444 ilayout:mydefault} // profile item of user 137 {flexi_ITEM:profile user:137 ilayout:mydefault} // profile item of user that is authored item no 441 {flexi_ITEM:profile author_of:441 ilayout:mydefault} // profile item of user that authored currently viewed item {flexi_ITEM:profile author_of:current}


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

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.401 seconds
Save
Cookies user preferences
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