This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
121 Posts
layonill
6 months ago
Topic

I am using the dynamic selection into an article form, it is suppose to give me all categories that are created, but it shows nothing, how do I fix this?

Get a VIP membership
4228 Posts
Kadministrator
6 months ago
5
Level 1

It is impossible to help you based on your description as it only states it does nor work for you, for the start copy the query you created.

121 Posts
layonill
6 months ago
4
Level 2

the query  is in construction mode, in that case I just have to put the name of the table, #__categories, and the WHERE created_by = $user->id, but it does not show me the fields, why it does not give me the info?

4228 Posts
Kadministrator
6 months ago
3
Level 3

Your query is not correct, you need to define text and value properties https://www.seblod.com/resources/extensions/archives/seblod-2-x-select-dynamic-field

121 Posts
layonill
6 months ago
2
Level 4

I did that, the text=title and value =id, the page gives me an error

4228 Posts
Kadministrator
6 months ago
1
Level 5
SELECT title AS text, id AS value from #__categories 

should work. Otherwise there is something broken on your system.

121 Posts
layonill
6 months ago
0
Level 6

where do I add the created_by = $user->id?

43 Posts
Jan
6 months ago
6
Level 1

See

https://www.seblod.com/community/forums/fields-plug-ins/select-dynamic-problem#post60660

121 Posts
layonill
6 months ago
5
Level 2

but you write that in phpmyadmin or in the field construction?

43 Posts
Jan
6 months ago
4
Level 3

In neither of these. I have added

// Set
$field->value = $value;

on line 533 and 534 of select_dynamic.php in \plugins\cck_field\select_dynamic. This is for version 3.17.1 (Seblod 3.17.1) If you use another version look in select_dynamic.php and find function onCCK_FieldPrepareSearch. Add the lines just before //Return like this:

// onCCK_FieldPrepareSearch
public function onCCK_FieldPrepareSearch( &$field, $value = '', &$config = array(), $inherit = array(), $return = false )
{
if ( self::$type != $field->type ) {
return;
}

// Init
if ( $field->bool3 ) {
$divider = $field->match_value ? $field->match_value : $field->divider;
$field->match_value = $divider;
if ( is_array( $value ) ) {
$value = implode( $divider, $value );
}

$field->divider = $divider;
} else {
$field->match_value = $field->match_value ? $field->match_value : ',';
}
self::onCCK_FieldPrepareForm( $field, $value, $config, $inherit, $return );

// Set
$field->value = $value;

// Return
if ( $return === true ) {
return $field;
}
}

121 Posts
layonill
6 months ago
3
Level 4

how do I ad the created by user?, is the only thing I need to complete this so i gives me the values based on the current user logged, the query right now is like this "SELECT title AS text, id AS value from #__categories WHERE parent_id=8" I just need to know how do I make it to show me the info of the current user, it's almost complete

43 Posts
Jan
6 months ago
2
Level 5

I don't know. The table #__categories has a column created_user_id. You can retrieve those numbers. I don't know how to get the live user out of these.

4228 Posts
Kadministrator
6 months ago
1
Level 6

I tested and there is no bug, everything works correctly - your problem is there is no "created_by" column in categories table, correct query which works is

SELECT title as text, id as value FROM #__categories WHERE created_user_id = $user->id
121 Posts
layonill
6 months ago
0
Level 7

solved, thanks a lot

Get a Book for SEBLOD