Support Forum » User Profile

Forum Replies Created

Viewing 9 posts - 46 through 54 (of 54 total)
  • Author
    Posts
  • in reply to: Default value in radio field #13968
    proyectohappyweb@gmail.com[email protected]
    Participant

    I use custom table to save the values.

    in reply to: List of post to edit in frontend #13944
    proyectohappyweb@gmail.com[email protected]
    Participant

    No, everything works fine. Another question:

    Someone who knows:
    http://xxx.es/crear-articulo/?rwmb_frontend_field_post_id=540

    Knowing this url and changing the post id, anyone can enter and update all the posts...

    What people do to solve it?

    I think one solution is make a function wiht the add_action('template_redirect',
    and check that the user has permission to modify the post id.

    I don't know if to do this, is important this code, that I don't understand very well:

    add_filter( 'rwmb_frontend_field_value_post_id', 'my_custom_population_function', 10, 2 );
    function my_custom_population_function( $value, $args ) {
        if ( $args['id'] === 'your_meta_box_id' ) { // Only filter for a specific form.
            $value = 123;
        }
        return $value;
    }

    I can see the args printed in the page, but when I call the action template_redirect, or the arguments are not yet, or I do not know how to collect them.

    Is there any easier solution? Or does it have to be done this way?

    Thanks,
    Sergio

    in reply to: List of post to edit in frontend #13914
    proyectohappyweb@gmail.com[email protected]
    Participant

    Hello,

    Finally I create a list-page with a table in html with a list of one of my custom post type.
    In each post row I put in one column the link to edit the post.

    I put the shortcode in 3 places:

    --> 1 Place:
    I create a page named crear-articulo (to create) with the shortcode:
    [mb_frontend_form post_type="articulo" edit="true" id="organizacion" post_fields="title,content" label_title="Título" submit_button="Dar de alta el artículo"]

    --> 2 Place:
    I create a page named modificar-articulo (to update) with the shortcode:
    [mb_frontend_form post_type="articulo" edit="true" id="organizacion" post_fields="title,content" label_title="Título" submit_button="Dar de alta el artículo" post_id="current"]

    --> 3 Place:
    I add a filter to add after the $content the shortcode to can update the actual post:
    [mb_frontend_form post_type="articulo" edit="true" id="organizacion" post_fields="title,content" label_title="Título" submit_button="Dar de alta el artículo" post_id="current"]

    To edit the post, I have some options?

    --> 1 Option: Put in each row the link to the same page to create de post:

    `$link = home_url( '/crear-articulo/' );
    $link = add_query_arg( 'rwmb_frontend_field_post_id', $post->ID, $link );        
    return '<a href="'.$link.'">Editar</a>';`
    

    --> 2 Option: Put in each row the link to the update post page:

    `$link = home_url( '/modificar-articulo/' );
    $link = add_query_arg( 'rwmb_frontend_field_post_id', $post->ID, $link );        
    return '<a href="'.$link.'">Editar</a>';`
    

    Questions:
    - What is the best option? Am I doing well so far?
    - With the option 1, I only have to create one page to create and update posts. But I have a issue with the shortcodes. In the content field of the create page, the shortcodes are not shown, they are already half solved:
    Ex: It appear this the text but not the shortcode...
    Título del spoiler
    Contenido oculto
    Título del spoiler
    Contenido oculto
    Título del spoiler
    Contenido oculto

    But in the update page, the shortcodes are displayed well, as in the backoffice editor:

    [su_accordion class=""]
    [su_spoiler title="Título del spoiler" open="no" style="default" icon="plus" anchor="" class=""]Contenido oculto[/su_spoiler] 
    [su_spoiler title="Título del spoiler" open="no" style="default" icon="plus" anchor="" class=""]Contenido oculto[/su_spoiler] 
    [su_spoiler title="Título del spoiler" open="no" style="default" icon="plus" anchor="" class=""]Contenido oculto[/su_spoiler] 
    [/su_accordion]

    The same issue have in the shortcode situated in the 3 place.

    Many Thanks.

    in reply to: Metabox in Buddypress #13899
    proyectohappyweb@gmail.com[email protected]
    Participant

    Ok thanks!

    in reply to: Date format between custom field and database field #13885
    proyectohappyweb@gmail.com[email protected]
    Participant

    Perfect!! Many thanks!!

    in reply to: Date format between custom field and database field #13871
    proyectohappyweb@gmail.com[email protected]
    Participant

    ok perfect, I will use option 2:

            array (
                'id' => 'fecha_inicio_evento',
                'type' => 'date',
                'name' => 'Fecha Inicio',
                'js_options' => array(
                    'dateFormat' => "dd/mm/yy",
                ),
                'save_format' => 'Y-m-d',
                'timestamp' => false,
            ),
    

    Also, in docs: https://docs.metabox.io/fields/date/
    Say that:
    "Saving in timestamp also allows you to query posts with a specific order by this field".
    I try to put timestamp to true. I tried to change the field of database from 'fecha_inicio_evento' => 'DATE', to 'fecha_inicio_evento' => 'TIMESTAMP', and I can not make it work...

    I docs it says "However, you still can sort posts by meta value if you set date format to something similar to yy-mm-dd.".

    With my settings, could I sort by date?

    Many thanks.

    in reply to: Take values from database in a select #13822
    proyectohappyweb@gmail.com[email protected]
    Participant

    ohh perfect!!! It run fantastic.

    The only thing is:

    this code

    if ( !empty( $groups ) ) {
        return [];
    }

    is

    if ( empty( $groups ) ) {
        return [];
    }

    Many thanks with the quickly response!!
    Greetings.

    in reply to: Take settings values in add_action( 'init' #13820
    proyectohappyweb@gmail.com[email protected]
    Participant

    I add, don't know how, but using ACF settings, with priority 0, it run well.

    thanks.

    in reply to: Take settings values in add_action( 'init' #13819
    proyectohappyweb@gmail.com[email protected]
    Participant

    I undersntand...But in the same function that I use his fields of metabox settings I registered the cpt:

    I take this values in Metabox:

    $mb_activacion_articulo = rwmb_meta( 'modulo_articulos_activacion', array( 'object_type' => 'setting' ), 'multi_tema_privado' );
    if ($mb_activacion_articulo == 1) $show_articulo = true;    
    $mb_slug_articulo = rwmb_meta( 'modulo_articulos_slug', array( 'object_type' => 'setting' ), 'multi_tema_privado' );
    

    And I registered the cpt:

                    'rewrite' => array('slug' => $slug_articulo),
            'show_in_menu'        => $show_articulo,
            'show_in_nav_menus'   => $show_articulo,
            'show_in_admin_bar'   => $show_articulo,
        register_post_type( 'articulo', $args );

    If I put some value priority more than 20. When I save the settings, the canghes will appear not after the refresh save, I have to refresh another time.

    It's ok my explain?

    Thanks

Viewing 9 posts - 46 through 54 (of 54 total)