Support » Plugin: Mage Front End Forms » echo do_shortcode for category

  • Hello Maximilian,

    First of all, thank you for your plugin, it is really great…

    Anyway I would like to ask a question:
    My users have user meta field: user_cat_ID , which stores value of post category ID. They can only read this category or all posts they can create will have category (ID) set by user_cat_ID value.

    Therefore I tried to do this by code inserted to Mage form or WordPress page, but it did not work:

    [insert_php]

    $user_id = wp_get_current_user();
    $user_cat = get_user_meta($user_id, user_cat_ID, true);
    echo do_shortcode( ‘[text name="post_category" value=$user_cat type="hidden"]‘ );

    [/insert_php]

    I used Insert php plugin and echo do_shortcode on wordpress page, form appeared corectly on front end, but buttons did not work and I could not send post…On mage form php code did not work at all

    Could you help me please ?

    BTW – When I inseted form on page, CSS of theme was kept…It was great, because I do not like to use other than theme CSS for forms. Is there any way how to ignore Mage css style ?

    Thank you, Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Maximilian Ruthe

    (@maximilian-ruthe)

    Hi Peter,
    thank you for this post,
    Give me some time to look into the best method of getting a usermeta value into an input field.
    I’ll also be including an option to disable the frontend form css on the next update.

    Meanwhile, if you don’t mind improvising, you can include this into your functions.php file to disable the frontend form css manually:

    add_action( 'wp_enqueue_scripts', 'mage_forms_disable_css',200);
    function mage_forms_disable_css(){
    	wp_deregister_style( 'mage-form' );
    	wp_dequeue_style( 'mage-form' );
    }

    Keep in mind, that you would need to copy the “select2” css rules in mage-forms.css to prevent the select and multicheck fields from not working properly.

    Hope this helps for now – will check back with news regarding the user meta field retrieve method.

    Thread Starter ynteligent

    (@ynteligent)

    Hello Maximilian,

    Thank you for your reply. I will try this code. I think that solution for both problems could be possibility to use shortcodes on wordpress page instead of Mage form page. CSS of the theme will be kept, and users can use child theme pages for additional php code.

    At the moment, when I put shortcodes directly to wordpress page, everything looks good, except buttons- these do not work. If this is fixed, plugin is perfect.

    And to be honest, I really do not understand why this plugin has only 100+ active installations. It is great and probably one of two best plugins for front end posting I have tried. And trust me, I tried almost every one.

    Peter

    • This reply was modified 4 years, 6 months ago by ynteligent.
    Plugin Author Maximilian Ruthe

    (@maximilian-ruthe)

    Thank you so much for the commendation and really appreciate the review you left : )
    Yes, the mage-forms.css does only load when it finds a [form] shortcode somewhere on the page.
    I will definitely attempt to incorporate the suggestions on the next update and will be checking back here shortly –

    Max

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘echo do_shortcode for category’ is closed to new replies.