37 Posts
PierreP
8 years ago
Topic

Hello,

Thanks to the Seblod equip for their great job !

I created a Seblod form which isn't a User Group form.

Inside there is a 42 field which creates a User Group :

$myUserGroup = new stdClass();
$myUserGroup->title = $config['post']['entreprise_titre'];
$myUserGroup->parent_id = 20;
$table = JTable::getInstance('Usergroup', 'JTable');
$data = (array)$myUserGroup;

with bind(), check() and store()

It creates the user group without any problem but when I want to create a user group list, the user group is absent.

I understand that it's because the user group isn't in the #__cck_core table but I don't know how to add the user group in this table...

So how can I display the user group in the list ?

Thank you in advance !

Get a Book for SEBLOD
1283 Posts
Bucklash
8 years ago
6
Level 1

Hi Pierre

Check out this link:

insert-content-type-from-custom-extension

 

There are a couple of ways to generate content dynamically. 

Klas, in his response suggested similar to this this:

$content = new JCckContent( array( 'joomla_article' ) );
$status = $content->create(
'some_content_type', 
// adds to #__content table
array(
'title'=>JFactory::getDate()->toSql(),
'catid'=>19,
'state'=>1,
'language'=>'*',
'publish_up'=>JFactory::getDate()->toSql(),
'created_by'=> JFactory::getUser()->id
),
// adds to #__cck_store_form_mycontenttype
array(
'field0'=>'something',
'field1'=>'somehing else',
)
);
<br>
37 Posts
PierreP
8 years ago
5
Level 2

Thank you for your answer.

This solution works only for joomla content, category and user.

Do you know if there is another solution ?

Thank you !

1283 Posts
Bucklash
8 years ago
4
Level 3

Hi Pierrep

First of all, as far as I understand it, by default, SEBLOD creates the Objects {"article", "category", "user", "user_group"}. {user_notes"} can be add too, I believe. I didn't understand the link you referenced.

In an afterstore field placed in an article form:
$artTitle = $config['post']['art_title'];
// Create User Group
$newPUG = new JCckContent( 
   array('joomla_user_group') 
);
$addNewPUG = $newPUG->create(
   'th_pierrep_ug', // user_goup content type name
   array(
       'title'=> $artTitle,
       'parent_id'=> '1'
   ),
   array(
   )
);
// Usergroup created
In the front end on a lst module I see the usergroups created.

Bucklash

Weirdness prevails, I have a site where I am struggling to see the user_groups that I have created dynamically. However, on a different test site, I achieved success. So your post has highlighted something I wasn't aware of.... 

37 Posts
PierreP
8 years ago
3
Level 4

Thank you very much Bucklash !

It works !!!!

The problem was I tried with joomla_usergroup and not joomla_user_group.

Thank you again !

1283 Posts
Bucklash
8 years ago
2
Level 5

Hi

Sweet!!

Glad it helped :)

When you are ready to, see if you can work this out:

Create a category and then create a CHILD category of this category, dynamically, ie ALL the code in a Beforestore or Afterstore field 

37 Posts
PierreP
8 years ago
1
Level 6

Hello Bucklash,

I tried with joomla_category but I have the error :

"Error loading component: , Component not found

I think it's what you said in this post :

https://www.seblod.com/community/forums/general-discussions/afterstore-new-jcckcontent-dynamic-content-creation

Did you find a solution ?

1283 Posts
Bucklash
8 years ago
0
Level 7

Hi

Not found a solution.

Have a theory to test after xmas...

Get db connection
Create your category or usergroup etc
Close db connection
Get a new db connection
Add 2nd new category or usergroup etc

Bucklash

Get a VIP membership